summaryrefslogtreecommitdiff
path: root/Horloge
diff options
context:
space:
mode:
Diffstat (limited to 'Horloge')
-rw-r--r--Horloge/Curvefit.cpp235
-rw-r--r--Horloge/Curvefit.h15
-rw-r--r--Horloge/Digistring.cpp904
-rw-r--r--Horloge/Digistring.h187
-rw-r--r--Horloge/Horloge.cpp74
-rw-r--r--Horloge/Horloge.dsp199
-rw-r--r--Horloge/Horloge.h50
-rw-r--r--Horloge/Horloge.rc194
-rw-r--r--Horloge/Horloge.vcproj535
-rw-r--r--Horloge/Horloge.vcproj.vspscc10
-rw-r--r--Horloge/HorlogeDlg.cpp347
-rw-r--r--Horloge/HorlogeDlg.h82
-rw-r--r--Horloge/HorlogeParseCmdLine.cpp58
-rw-r--r--Horloge/HorlogeParseCmdLine.h31
-rw-r--r--Horloge/MemDC.h104
-rw-r--r--Horloge/ReadMe.txt88
-rw-r--r--Horloge/Rgbcolor.h40
-rw-r--r--Horloge/StdAfx.cpp8
-rw-r--r--Horloge/StdAfx.h84
-rw-r--r--Horloge/res/Horloge.icobin0 -> 766 bytes
-rw-r--r--Horloge/res/Horloge.rc213
-rw-r--r--Horloge/res/ico00001.icobin0 -> 4534 bytes
-rw-r--r--Horloge/res/ico00002.icobin0 -> 766 bytes
-rw-r--r--Horloge/res/ico00003.icobin0 -> 766 bytes
-rw-r--r--Horloge/res/ico00004.icobin0 -> 766 bytes
-rw-r--r--Horloge/res/icon1.icobin0 -> 766 bytes
-rw-r--r--Horloge/resource.h44
27 files changed, 3302 insertions, 0 deletions
diff --git a/Horloge/Curvefit.cpp b/Horloge/Curvefit.cpp
new file mode 100644
index 0000000..a1854d0
--- /dev/null
+++ b/Horloge/Curvefit.cpp
@@ -0,0 +1,235 @@
+// Curvefit.cpp: implementation of the CBezierfit class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include <MATH.H>
+#include "Curvefit.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+static double DistanceError(const double *x, const double *y, const double *Rawdata, int n);
+static void Bezier(double u, const double *a, const double *b,
+ double x4, double y4, double &z, double &s);
+
+void CalcBezier(const double *Rawdata, int n, double *Control)
+{
+ double x[4];
+ double y[4];
+ double e1,e2, e3;
+ int Retry;
+ double x1a,x2a,y1a,y2a;
+
+ x[0] = Rawdata[0];
+ y[0] = Rawdata[1];
+
+ x[1] = Rawdata[2];
+ y[1] = Rawdata[3];
+
+ x[2] = Rawdata[n-4];
+ y[2] = Rawdata[n-3];
+
+ x[3] = Rawdata[n-2];
+ y[3] = Rawdata[n-1];
+
+ // seed with linear interpolation...
+ x[1] += x[1] - x[0];
+ y[1] += y[1] - y[0];
+ x[2] += x[2] - x[3];
+ y[2] += y[2] - y[3];
+
+ e1 = DistanceError(x, y, Rawdata, n);
+ for (Retry = 1; Retry <= 2; Retry++)
+ {
+// TRACE("Retry %d\n", Retry);
+// TRACE(" x1 y2 x2 y2 error\n");
+ e3 = 0.5;
+ x1a = x[1];
+ while (fabs(e3) >= 0.01)
+ {
+ x[1] += (x[1] - x[0])*e3;
+ e2 = DistanceError(x, y, Rawdata, n);
+ if (e2 == e1)
+ break;
+ if (e2 > e1)
+ {
+ x[1] = x1a;
+ e3 /=-3;
+ }
+ else
+ {
+ e1 = e2;
+ x1a = x[1];
+ }
+ }
+
+ e3 = 0.5;
+ y1a = y[1];
+ while (fabs(e3) >= 0.01)
+ {
+ y[1] += (y[1] - y[0])*e3;
+ e2 = DistanceError(x, y, Rawdata, n);
+ if (e2 == e1)
+ break;
+ if (e2 > e1)
+ {
+ y[1] = y1a;
+ e3 /=-3;
+ }
+ else
+ {
+ e1 = e2;
+ y1a = y[1];
+ }
+ }
+
+ e3 = 0.5;
+ x2a = x[2];
+ while (fabs(e3) >= 0.01)
+ {
+ x[2] += (x[2] - x[3])*e3;
+ e2 = DistanceError(x, y, Rawdata, n);
+ if (e2 == e1)
+ break;
+ if (e2 > e1)
+ {
+ x[2] = x2a;
+ e3 /=-3;
+ }
+ else
+ {
+ e1 = e2;
+ x2a = x[2];
+ }
+ }
+
+ e3 = 0.5;
+ y2a = y[2];
+ while (fabs(e3) >= 0.01)
+ {
+ y[2] += (y[2] - y[3])*e3;
+ e2 = DistanceError(x, y, Rawdata, n);
+ if (e2 == e1)
+ break;
+ if (e2 > e1)
+ {
+ y[2] = y2a;
+ e3 /=-3;
+ }
+ else
+ {
+ e1 = e2;
+ y2a = y[2];
+ }
+ }
+ } // for
+
+ Control[0] = x[1];
+ Control[1] = y[1];
+ Control[2] = x[2];
+ Control[3] = y[2];
+}
+
+double DistanceError(const double *x, const double *y,
+ const double *Rawdata, int n)
+{
+ int i;
+ double a[4];
+ double b[4];
+ double u, u1, u2;
+ double z, z1, z2,s,s1;
+ double temp;
+ double totalerror;
+ double stepsize;
+ double x4, y4;
+
+ totalerror = 0;
+ a[3] = (x[3]-x[0]+3*(x[1]-x[2]))/8;
+ b[3] = (y[3]-y[0]+3*(y[1]-y[2]))/8;
+ a[2] = (x[3]+x[0]-x[1]-x[2])*3/8;
+ b[2] = (y[3]+y[0]-y[1]-y[2])*3/8;
+ a[1] = (x[3]-x[0])/2 -a[3];
+ b[1] = (y[3]-y[0])/2 -b[3];
+ a[0] = (x[3]+x[0])/2 -a[2];
+ b[0] = (y[3]+y[0])/2 -b[2];
+
+ stepsize = 2.0/(n);
+ for (i = 2; i <= n-3; i+=2)
+ {
+ x4 = Rawdata[i];
+ y4 = Rawdata[i+1];
+ for (u = -1; u <= 1.01; u += stepsize)
+ {
+ Bezier(u, a, b, x4, y4, z, s);
+ if (s == 0)
+ {
+ u1 = u;
+ z1 = z;
+ s1 = s;
+ break;
+ }
+ if (u == -1)
+ {
+ u1 = u;
+ z1 = z;
+ s1 = s;
+ }
+ if (s < s1)
+ {
+ u1 = u;
+ z1 = z;
+ s1 = s;
+ }
+ }
+ if (s1 != 0)
+ {
+ u = u1 + stepsize;
+ if (u > 1)
+ u = 1 - stepsize;
+ Bezier(u, a, b, x4, y4, z, s);
+ while (s != 0 && z != 0)
+ {
+ u2 = u;
+ z2 = z;
+ temp = z2-z1;
+ if (temp != 0)
+ u = (z2 * u1-z1*u2)/temp;
+ else
+ u = (u1 + u2)/2;
+
+ if (u > 1)
+ u = 1;
+ else if (u < -1)
+ u = -1;
+ if (fabs(u-u2) < 0.001)
+ break;
+ u1 = u2;
+ z1 = z2;
+ Bezier(u, a, b, x4, y4, z, s);
+ }
+ }
+ totalerror += s;
+ }
+// TRACE("%8.3lf %8.3lf %8.3lf %8.3lf %8.3lf\n", x[1], y[1], x[2], y[2], totalerror);
+ return totalerror;
+}
+
+void Bezier(double u, const double *a, const double *b,
+ double x4, double y4, double &z, double &s)
+{
+ double x, y;
+ double dx4,dy4;
+ double dx,dy;
+
+ x = a[0] + u*(a[1] + u*(a[2]+u*a[3]));
+ y = b[0] + u*(b[1] + u*(b[2]+u*b[3]));
+ dx4 = x-x4; dy4 = y-y4;
+ dx = a[1] + u * (a[2] + a[2] + u*3*a[3]);
+ dy = b[1] + u * (b[2] + b[2] + u*3*b[3]);
+ z = dx * dx4 + dy*dy4;
+ s = dx4*dx4 + dy4*dy4;
+} \ No newline at end of file
diff --git a/Horloge/Curvefit.h b/Horloge/Curvefit.h
new file mode 100644
index 0000000..79918d7
--- /dev/null
+++ b/Horloge/Curvefit.h
@@ -0,0 +1,15 @@
+// Curvefit.h: interface for the CBezierfit class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CURVEFIT_H__8CC78BC2_CA92_11D3_949E_00104B6C2FFE__INCLUDED_)
+#define AFX_CURVEFIT_H__8CC78BC2_CA92_11D3_949E_00104B6C2FFE__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+void CalcBezier(const double *Rawdata, int n, double *Control);
+
+
+#endif // !defined(AFX_CURVEFIT_H__8CC78BC2_CA92_11D3_949E_00104B6C2FFE__INCLUDED_)
diff --git a/Horloge/Digistring.cpp b/Horloge/Digistring.cpp
new file mode 100644
index 0000000..a0cc6b7
--- /dev/null
+++ b/Horloge/Digistring.cpp
@@ -0,0 +1,904 @@
+// Digistring.cpp : implementation file
+//
+// Copyright (C) 2000 by Michel Wassink
+// All rights reserved
+//
+// This is free software.
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is
+// not sold for profit without the authors written consent, and
+// providing that this notice and the authors name and all copyright
+// notices remains intact. If the source code in this file is used in
+// any commercial application then a statement along the lines of
+// "Portions Copyright © 2000 Michel Wassink" must be included in
+// the startup banner, "About" box or printed documentation. An email
+// letting me know that you are using it would be nice as well. That's
+// not much to ask considering the amount of work that went into this.
+//
+// No warrantee of any kind, expressed or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
+// I'll try to keep a version up to date. I can be reached as follows:
+// mwassink@csi.com (private site)
+// An email letting me know that you are using it would be nice.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "Digistring.h"
+#include "Curvefit.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// Segment numbering:
+// ----- 13 ----- 0
+//|\ | /| 8 0 12 | | 1 2
+//| \|/ | 1 2 | |
+// -- -- == 6 7 ----- == 3
+//| /|\ | 3 4 | |
+//|/ | \| 9 5 11 | | 4 5
+// ----- 10 ----- 6
+
+#define MAXSEGCHAR7 12 // Number of supported 7 segment characters
+#define MAXSEGCHAR14 40 // Number of supported 14 segment characters
+#define MAXSEGSEMCOL 2 // Number of supported 3 segment characters
+#define NORM_DIGIHEIGHT 83 // All characters must have this height
+
+////////////////////////////////////////////////////////////////////////////////
+// For 14 segments display...
+// SP 0 1 2 3 4 5 6
+WORD CHAR_SEGM14[MAXSEGCHAR14] = {0x0000, 0x3F00, 0x1800, 0x36C0, 0x3CC0, 0x19C0, 0x2DC0, 0x2FC0,
+// 7 8 9 - A B C D E F G H
+ 0x3800, 0x3FC0, 0x3DC0, 0x00C0, 0x3BC0, 0x3CA1, 0x2700, 0x3C21, 0x27C0, 0x23C0, 0x2F80, 0x1BC0,
+// I J K L M N O P Q R S
+ 0x2421, 0x1E00, 0x0354, 0x0700, 0x1B06, 0x1B12, 0x3F00, 0x33C0, 0x3F10, 0x33D0, 0x2DC0,
+// T U V W X Y Z * +
+ 0x2021, 0x1F00, 0x030C, 0x1B18, 0x001E, 0x11E0, 0x240C, 0x00FF, 0x00E1};
+// straight style
+CPoint PtSeg14N0[5] = {CPoint(20,13), CPoint(20,36), CPoint(24,40), CPoint(28,36), CPoint(28,13)};
+CPoint PtSeg14N1[4] = {CPoint( 5, 5), CPoint(15,35), CPoint(20,37), CPoint(18,25)};
+CPoint PtSeg14N6[6] = {CPoint( 6,41), CPoint(14,45), CPoint(18,45), CPoint(22,41), CPoint(18,37),
+ CPoint(14,37)};
+CPoint PtSeg14N8[4] = {CPoint( 4, 7), CPoint( 4,40), CPoint(11,36), CPoint(11,26)};
+CPoint PtSeg14N13[4] = {CPoint( 6, 4), CPoint(11,11), CPoint(37,11), CPoint(42, 4)};
+BYTE TpSeg14N0[5] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSeg14N1[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSeg14N6[6] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO, PT_LINETO,
+ PT_LINETO};
+BYTE TpSeg14N8[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSeg14N13[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+
+// smooth style PT_BEZIERTO
+CPoint PtSeg14N0S[13] ={CPoint(20,12), CPoint(20,25), CPoint(22,36), CPoint(23,39), CPoint(24,40),
+ CPoint(25,39), CPoint(26,36), CPoint(28,25), CPoint(28,12), CPoint(26,10),
+ CPoint(24, 9), CPoint(22,10), CPoint(20,12)};
+CPoint PtSeg14N1S[10] ={CPoint(10,10), CPoint(10,13), CPoint(11,20), CPoint(13,28), CPoint(21,38),
+ CPoint(21,37), CPoint(19,26), CPoint(15,16), CPoint(11,10), CPoint(10,10)};
+CPoint PtSeg14N6S[6] = {CPoint( 8,41), CPoint(12,45), CPoint(16,45), CPoint(23,41), CPoint(16,37),
+ CPoint(12,37)};
+CPoint PtSeg14N8S[10]= {CPoint( 4, 7), CPoint( 4,39), CPoint( 5,40), CPoint( 6,40), CPoint( 9,37),
+ CPoint(11,33), CPoint(11,25), CPoint( 9,14), CPoint( 5, 6), CPoint( 4, 7)};
+CPoint PtSeg14N13S[17]={CPoint( 8, 4), CPoint( 7, 5), CPoint( 7, 6), CPoint( 9, 8), CPoint(12, 9),
+ CPoint(14,11), CPoint(19,11), CPoint(21, 9), CPoint(24, 7), CPoint(27, 9),
+ CPoint(29,11), CPoint(34,11), CPoint(36, 9), CPoint(39, 8), CPoint(41, 6),
+ CPoint(41, 5), CPoint(40, 4)};
+BYTE TpSeg14N0S[13]= {PT_MOVETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO,
+ PT_BEZIERTO, PT_BEZIERTO, PT_LINETO, PT_LINETO, PT_BEZIERTO,
+ PT_BEZIERTO, PT_BEZIERTO, PT_LINETO};
+BYTE TpSeg14N1S[10] ={PT_MOVETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO,
+ PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO};
+BYTE TpSeg14N6S[6] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO, PT_LINETO,
+ PT_LINETO};
+BYTE TpSeg14N8S[10] ={PT_MOVETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO,
+ PT_BEZIERTO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO};
+BYTE TpSeg14N13S[17]={PT_MOVETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO,
+ PT_LINETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO,
+ PT_LINETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO,
+ PT_BEZIERTO, PT_LINETO};
+///////////////////////////////////////////////////////////////////////////////
+// For 7 segments display...
+// SP 0 1 2 3 4 5
+BYTE CHAR_SEGM7[MAXSEGCHAR7] = {0x00, 0x77, 0x24, 0x5D, 0x6D, 0x2E, 0x6B,
+// 6 7 8 9 -
+ 0x7B, 0x25, 0x7F, 0x6F, 0x08};
+// straight style
+CPoint PtSeg7N0[4] = {CPoint( 5, 4), CPoint(12,11), CPoint(36,11), CPoint(43, 4)};
+CPoint PtSeg7N1[4] = {CPoint( 4, 6), CPoint( 4,40), CPoint(11,36), CPoint(11,13)};
+CPoint PtSeg7N3[6] = {CPoint( 6,41), CPoint(14,45), CPoint(34,45), CPoint(42,41), CPoint(34,37),
+ CPoint(14,37)}; // 3
+BYTE TpSeg7N0[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSeg7N1[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSeg7N3[6] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO, PT_LINETO,
+ PT_LINETO};
+
+// smooth style PT_BEZIERTO
+CPoint PtSeg7N0S[7] = {CPoint( 6, 4), CPoint( 5, 5), CPoint( 5, 6), CPoint( 8, 9), CPoint(12,11),
+ CPoint(36,11), CPoint(39, 4)};
+CPoint PtSeg7N1S[7] = {CPoint( 4, 9), CPoint( 4,39), CPoint( 6,40), CPoint( 7,40), CPoint( 9,38),
+ CPoint(11,36), CPoint(11,12)};
+CPoint PtSeg7N2S[10] = {CPoint(37,36), CPoint(39,38), CPoint(41,40), CPoint(42,40), CPoint(44,39),
+ CPoint(44, 6), CPoint(42, 4), CPoint(41, 4), CPoint(39, 8), CPoint(37,12)};
+CPoint PtSeg7N3S[6] = {CPoint( 8,41), CPoint(12,45), CPoint(36,45), CPoint(40,41), CPoint(36,37),
+ CPoint(12,37)};
+BYTE TpSeg7N0S[7] = {PT_MOVETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO,
+ PT_LINETO, PT_LINETO};
+BYTE TpSeg7N1S[7] = {PT_MOVETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO,
+ PT_LINETO, PT_LINETO};
+BYTE TpSeg7N2S[10] = {PT_MOVETO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO, PT_LINETO,
+ PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO};
+BYTE TpSeg7N3S[6] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO, PT_LINETO,
+ PT_LINETO};
+
+// For 3 segments semicoloncombi display...
+// . :
+BYTE CHAR_SEMCOL[MAXSEGSEMCOL] = {0x04, 0x03};
+
+CPoint PtSegScN0[4] = {CPoint( 4,23), CPoint( 4,32), CPoint(13,32), CPoint(13,23)};
+CPoint PtSegScN1[4] = {CPoint( 4,50), CPoint( 4,59), CPoint(13,59), CPoint(13,50)};
+CPoint PtSegScN2[4] = {CPoint( 4,68), CPoint( 4,77), CPoint(13,77), CPoint(13,68)};
+BYTE TpSegScN0[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSegScN1[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+BYTE TpSegScN2[4] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_LINETO};
+
+// Functions for mirroring points...
+CPoint PointMirror(const CPoint &P, const CPoint &M)
+{
+ return CPoint(P.x + 2*(M.x - P.x), P.y + 2*(M.y - P.y));
+}
+
+CPoint LineMirrorX(const CPoint &P, int X)
+{
+ return CPoint(P.x + 2*(X - P.x), P.y);
+}
+
+CPoint LineMirrorY(const CPoint &P, int Y)
+{
+ return CPoint(P.x, P.y + 2*(Y - P.y));
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CDSegment
+CDSegment::CDSegment()
+{
+ m_paPoints = NULL;
+ m_paTypes = NULL;
+}
+
+CDSegment::CDSegment(const CDSegment& Segment)
+{
+ ASSERT(Segment.m_paPoints != NULL); // Do not copy an unitialized segment
+
+ m_nCount = Segment.m_nCount;
+
+ m_paPoints = new CPoint[m_nCount];
+ m_paTypes = new BYTE[m_nCount];
+ if (m_paPoints != NULL && m_paTypes != NULL)
+ {
+ memcpy(m_paPoints, Segment.m_paPoints, m_nCount * sizeof(CPoint));
+ memcpy(m_paTypes, Segment.m_paTypes, m_nCount * sizeof(BYTE));
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+CDSegment::~CDSegment()
+{
+ FreeSegment();
+}
+
+void CDSegment::DefPoints(const POINT* lpaPoints, const BYTE* lpaTypes, int nCount)
+{
+ FreeSegment();
+
+ m_paPoints = new CPoint[nCount];
+ m_paTypes = new BYTE[nCount];
+ m_nCount = nCount;
+ if (m_paPoints != NULL && m_paTypes != NULL)
+ {
+ memcpy(m_paPoints, lpaPoints, m_nCount * sizeof(CPoint));
+ memcpy(m_paTypes, lpaTypes, m_nCount * sizeof(BYTE));
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+CDSegment CDSegment::operator=(const CDSegment &Segment)
+{
+ CPoint *pNewPoints;
+ BYTE * pNewTypes;
+
+ m_nCount = Segment.m_nCount;
+
+ pNewPoints = new CPoint[m_nCount];
+ pNewTypes = new BYTE[m_nCount];
+ memcpy(pNewPoints, Segment.m_paPoints, m_nCount * sizeof(CPoint));
+ memcpy(pNewTypes, Segment.m_paTypes, m_nCount * sizeof(BYTE));
+ FreeSegment(); // Get rid of old stuff
+ m_paPoints = pNewPoints;
+ m_paTypes = pNewTypes;
+
+ return *this;
+}
+
+void CDSegment::FreeSegment()
+{
+ if (m_paPoints != NULL && m_paTypes != NULL)
+ {
+ delete[] m_paPoints;
+ delete[] m_paTypes;
+ m_paPoints = NULL;
+ m_paTypes = NULL;
+ }
+}
+
+void CDSegment::Draw(CDC *pDC, CDoubleRect DrawPlace, int iWidth) const
+{
+ int i, nBez,b;
+ CPoint * paPoints;
+ double daContr[4];
+ double *pBezPts;
+ double dRelWidth, dRelHeight;
+
+ paPoints = new CPoint[m_nCount];
+ if (paPoints == NULL) return;
+
+ dRelWidth = DrawPlace.Width() / iWidth;
+ dRelHeight = DrawPlace.Height() / NORM_DIGIHEIGHT;
+ for (i = 0; i < m_nCount; i++)
+ {
+ if (m_paTypes[i] != PT_BEZIERTO)
+ {
+ paPoints[i] = CPoint(DrawPlace.left + dRelWidth * m_paPoints[i].x + 0.5,
+ DrawPlace.top + dRelHeight * m_paPoints[i].y + 0.5);
+ }
+ }
+
+ for (i = 0; i < m_nCount; i++)
+ {
+ if (m_paTypes[i] == PT_MOVETO)
+ {
+ pDC->MoveTo(paPoints[i]);
+ }
+ else if (m_paTypes[i] == PT_LINETO)
+ {
+ VERIFY(pDC->LineTo(paPoints[i]));
+ }
+ else if (m_paTypes[i] == PT_BEZIERTO)
+ {
+ // Look for the first non-bezier point(This is the EndPoint)...
+ nBez = 0;
+ do
+ {
+ nBez++;
+ } while (m_paTypes[i+nBez] == PT_BEZIERTO);
+
+ pBezPts = new double[2*(nBez+2)];
+ for (b = 0; b < (nBez+2)*2; b += 2)
+ {
+ pBezPts[b ] = DrawPlace.left + dRelWidth * m_paPoints[i-1+b/2].x;
+ pBezPts[b+1] = DrawPlace.top + dRelHeight * m_paPoints[i-1+b/2].y;
+ }
+ CalcBezier(pBezPts, 2*(nBez+2), daContr);
+ delete[] pBezPts;
+
+ paPoints[i ].x = daContr[0] + 0.5;
+ paPoints[i ].y = daContr[1] + 0.5;
+ paPoints[i+1].x = daContr[2] + 0.5;
+ paPoints[i+1].y = daContr[3] + 0.5;
+ paPoints[i+2] = paPoints[i+nBez];
+
+ VERIFY(pDC->PolyBezierTo(&paPoints[i], 3));
+ i += nBez;
+ }
+ } // for
+ delete[] paPoints;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigiChar
+
+CDigiChar::CDigiChar()
+{
+ m_Width = 49;
+ m_wSegmData = 0x0000; // All segments in offcolor
+}
+
+CDigiChar::~CDigiChar()
+{
+
+}
+
+void CDigiChar::Draw(CDC *pDC, CDoubleRect DrawPlace, CPen *pOffPen, CPen *pOnPen,
+ CBrush *pOffBrush, CBrush *pOnBrush)
+{
+ WORD SegMask;
+ DSegmentVector::iterator SegmIterator;
+
+ SegMask = 1;
+ for (SegmIterator = m_SegmentVector.begin(); SegmIterator != m_SegmentVector.end();
+ SegmIterator++)
+ {
+ if (m_wSegmData & SegMask)
+ {
+ pDC->SelectObject(pOnBrush);
+ pDC->SelectObject(pOnPen);
+ }
+ else
+ {
+ pDC->SelectObject(pOffBrush);
+ pDC->SelectObject(pOffPen);
+ }
+
+ pDC->BeginPath();
+ SegmIterator->Draw(pDC, DrawPlace, m_Width);
+ pDC->EndPath();
+ pDC->StrokeAndFillPath();
+
+ SegMask <<= 1;
+ }
+}
+void CDigiChar::SetElementData(WORD wSegmData, int /*iDispStyle*/)
+{
+ m_wSegmData = wSegmData;
+}
+
+int CDigiChar::GetNormWidth() const
+{
+ return m_Width;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigi7Segment
+
+CDigi7Segment::CDigi7Segment()
+{
+ m_Width = 49;
+ m_NSegments = 7;
+}
+
+void CDigi7Segment::SetElementData(WORD wSegmData, int iDispStyle)
+{
+ int i, p;
+ CDSegment TmpSegm;
+ LPPOINT lpTmpSegPoints = NULL;
+ LPPOINT lpSegPoints;
+ LPBYTE lpType;
+ int nCount;
+
+ m_SegmentVector.clear();
+ for (i = 0; i < m_NSegments; i++)
+ {
+ switch(i)
+ {
+ case 0:
+ case 6: if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg7N0S;
+ lpType = TpSeg7N0S;
+ nCount = 7;
+ }
+ else
+ {
+ lpSegPoints = PtSeg7N0;
+ lpType = TpSeg7N0;
+ nCount = 4;
+ }
+ break;
+ case 1:
+ case 4:if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg7N1S;
+ lpType = TpSeg7N1S;
+ nCount = 7;
+ }
+ else
+ {
+ lpSegPoints = PtSeg7N1;
+ lpType = TpSeg7N1;
+ nCount = 4;
+ }
+ break;
+ case 2:
+ case 5: if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg7N2S;
+ lpType = TpSeg7N2S;
+ nCount = 10;
+ }
+ else
+ {
+ lpSegPoints = PtSeg7N1;
+ lpType = TpSeg7N1;
+ nCount = 4;
+ }
+ break;
+ case 3: if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg7N3S;
+ lpType = TpSeg7N3S;
+ nCount = 6;
+ }
+ else
+ {
+ lpSegPoints = PtSeg7N3;
+ lpType = TpSeg7N3;
+ nCount = 6;
+ }
+ break;
+ }
+
+ switch(i)
+ {
+ case 6: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);break;
+ case 2: if (!(iDispStyle & CDigistring::DS_SMOOTH))
+ {
+ lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorX(lpSegPoints[p], (m_Width-1)/2);
+ }
+ break;
+ case 4: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);break;
+ case 5: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ if (iDispStyle & CDigistring::DS_SMOOTH)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);
+ else
+ lpTmpSegPoints[p] = PointMirror(lpSegPoints[p], CPoint((m_Width-1)/2, 41));
+ break;
+ }
+
+ if (lpTmpSegPoints == NULL)
+ TmpSegm.DefPoints(lpSegPoints, lpType, nCount);
+ else
+ {
+ TmpSegm.DefPoints(lpTmpSegPoints, lpType, nCount);
+ delete[] lpTmpSegPoints;
+ lpTmpSegPoints = NULL;
+ }
+ m_SegmentVector.push_back(TmpSegm);
+ }
+ m_wSegmData = wSegmData;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigi14Segment
+
+CDigi14Segment::CDigi14Segment()
+{
+ m_Width = 49;
+ m_NSegments = 14;
+}
+
+void CDigi14Segment::SetElementData(WORD wSegmData, int iDispStyle)
+{
+ int i, p;
+ CDSegment x;
+ LPPOINT lpTmpSegPoints = NULL;
+ LPPOINT lpSegPoints;
+ LPBYTE lpType;
+ int nCount;
+
+ m_SegmentVector.clear();
+ for (i = 0; i < m_NSegments; i++)
+ {
+ switch(i)
+ {
+ case 0:
+ case 5: if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg14N0S;
+ lpType = TpSeg14N0S;
+ nCount = 13;
+ }
+ else
+ {
+ lpSegPoints = PtSeg14N0;
+ lpType = TpSeg14N0;
+ nCount = 5;
+ }
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg14N1S;
+ lpType = TpSeg14N1S;
+ nCount = 10;
+ }
+ else
+ {
+ lpSegPoints = PtSeg14N1;
+ lpType = TpSeg14N1;
+ nCount = 5;
+ }
+ break;
+ case 6:
+ case 7:
+ if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg14N6S;
+ lpType = TpSeg14N6S;
+ nCount = 6;
+ }
+ else
+ {
+ lpSegPoints = PtSeg14N6;
+ lpType = TpSeg14N6;
+ nCount = 6;
+ }
+ break;
+ case 8:
+ case 9:
+ case 11:
+ case 12:
+ if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg14N8S;
+ lpType = TpSeg14N8S;
+ nCount = 10;
+ }
+ else
+ {
+ lpSegPoints = PtSeg14N8;
+ lpType = TpSeg14N8;
+ nCount = 4;
+ }
+ break;
+ case 13:
+ case 10:
+ if (iDispStyle & CDigistring::DS_SMOOTH)
+ {
+ lpSegPoints = PtSeg14N13S;
+ lpType = TpSeg14N13S;
+ nCount = 17;
+ }
+ else
+ {
+ lpSegPoints = PtSeg14N13;
+ lpType = TpSeg14N13;
+ nCount = 4;
+ }
+ break;
+ }
+
+ switch(i)
+ {
+ case 5: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);break;
+ case 2: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorX(lpSegPoints[p], (m_Width-1)/2);break;
+ case 3: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);break;
+ case 4: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = PointMirror(lpSegPoints[p], CPoint((m_Width-1)/2, 41));break;
+ case 7: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorX(lpSegPoints[p], (m_Width-1)/2);break;
+ case 9: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);break;
+ case 11: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = PointMirror(lpSegPoints[p], CPoint((m_Width-1)/2, 41));break;
+ case 12: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorX(lpSegPoints[p], (m_Width-1)/2);break;
+ case 10: lpTmpSegPoints = new CPoint[nCount];
+ for (p = 0; p < nCount; p++)
+ lpTmpSegPoints[p] = LineMirrorY(lpSegPoints[p], 41);break;
+ }
+
+ if (lpTmpSegPoints == NULL)
+ x.DefPoints(lpSegPoints, lpType, nCount);
+ else
+ {
+ x.DefPoints(lpTmpSegPoints, lpType, nCount);
+ delete[] lpTmpSegPoints;
+ lpTmpSegPoints = NULL;
+ }
+ m_SegmentVector.push_back(x);
+ }
+ m_wSegmData = wSegmData;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigiSemiColonCombi
+
+CDigiColonDotChar::CDigiColonDotChar()
+{
+ m_Width = 18;
+ m_NSegments = 3;
+}
+
+void CDigiColonDotChar::SetElementData(WORD wSegmData, int /*iDispStyle*/)
+{
+ int i;
+ CDSegment DSegment;
+ LPPOINT lpSegPoints;
+ LPBYTE lpType;
+ int nCount;
+
+ m_SegmentVector.clear();
+
+ for (i = 0; i < m_NSegments; i++)
+ {
+ switch(i)
+ {
+ case 0:lpSegPoints = PtSegScN0;
+ lpType = TpSegScN0;
+ nCount = 4; break;
+ case 1:
+ lpSegPoints = PtSegScN1;
+ lpType = TpSegScN1;
+ nCount = 4; break;
+ case 2:
+ lpSegPoints = PtSegScN2;
+ lpType = TpSegScN2;
+ nCount = 4; break;
+ }
+ DSegment.DefPoints(lpSegPoints, lpType, nCount);
+ m_SegmentVector.push_back(DSegment);
+ }
+
+ m_wSegmData = wSegmData;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigistring
+
+CDigistring::CDigistring()
+ : m_strText("EMPTY")
+{
+ m_DispStyle = DS_SZ_PROP;
+ m_BackColor = BLACK;
+ m_Modified = TRUE;
+ m_OffColor = DARKGREEN;
+ m_OnColor = LIGHTGREEN;
+}
+
+CDigistring::~CDigistring()
+{
+ m_CharVector.clear();
+}
+
+void CDigistring::SetText(LPCTSTR lpszText)
+{
+ if (m_strText != lpszText)
+ {
+ m_strText = lpszText;
+ m_Modified = TRUE;
+ Invalidate();
+ }
+}
+
+void CDigistring::Format(LPCTSTR lpszFormat, ...)
+{
+ TCHAR szMessage[256];
+
+ va_list argp;
+ va_start(argp, lpszFormat);
+ _vsntprintf(szMessage, 255, lpszFormat, argp);
+ va_end(argp);
+
+ SetText(szMessage);
+}
+
+void CDigistring::SetColor(COLORREF OffColor, COLORREF OnColor)
+{
+ if (m_OnColor == OnColor && m_OffColor == OffColor)
+ return;
+ m_OnColor = OnColor;
+ m_OffColor = OffColor;
+ Invalidate();
+}
+
+void CDigistring::SetBackColor(COLORREF BackColor /* = BLACK */)
+{
+ if (m_BackColor == BackColor)
+ return;
+ m_BackColor = BackColor;
+ Invalidate();
+}
+
+BOOL CDigistring::ModifyDigiStyle(DWORD dwRemove, DWORD dwAdd)
+{
+ ASSERT(!(dwRemove & dwAdd));
+ if (dwRemove & dwAdd)
+ return FALSE;
+
+ m_DispStyle |= dwAdd;
+ m_DispStyle &= ~dwRemove;
+
+ m_Modified = TRUE;
+ Invalidate();
+ return TRUE;
+}
+
+CDigiChar * CDigistring::DefineChar(TCHAR cChar)
+{
+ int iIndex;
+ CDigiChar * pDChar = NULL;
+
+ if (cChar >= _T('0') && cChar <= _T('9')
+ || cChar == _T(' ') || cChar == _T('-'))
+ {
+ if (cChar == _T(' '))
+ {
+ iIndex = 0;
+ }
+ else if (cChar == _T('-'))
+ {
+ iIndex = 11;
+ }
+ else
+ {
+ iIndex = cChar - _T('0') + 1;
+ }
+
+ if (m_DispStyle & DS_STYLE14)
+ {
+ pDChar = new CDigi14Segment;
+ pDChar->SetElementData(CHAR_SEGM14[iIndex], m_DispStyle);
+ }
+ else
+ {
+ pDChar = new CDigi7Segment;
+ pDChar->SetElementData(CHAR_SEGM7[iIndex], m_DispStyle);
+ }
+ }
+ else if (cChar >= _T('A') && cChar <= _T('Z'))
+ {
+ iIndex = cChar - _T('A') + 12;
+ pDChar = new CDigi14Segment;
+ pDChar->SetElementData(CHAR_SEGM14[iIndex], m_DispStyle);
+ }
+ else
+ {
+ iIndex = 0;
+ switch(cChar)
+ {
+ case _T(':'): iIndex++;
+ case _T('.'): pDChar = new CDigiColonDotChar;
+ pDChar->SetElementData(CHAR_SEMCOL[iIndex], m_DispStyle);
+ break;
+ case _T('*'): iIndex = MAXSEGCHAR14 - 2; pDChar = new CDigi14Segment;
+ pDChar->SetElementData(CHAR_SEGM14[iIndex], m_DispStyle);
+ break;
+ case _T('+'): iIndex = MAXSEGCHAR14 - 1; pDChar = new CDigi14Segment;
+ pDChar->SetElementData(CHAR_SEGM14[iIndex], m_DispStyle);
+ break;
+ default : ASSERT(FALSE);
+ }
+ }
+ return pDChar;
+}
+
+void CDigistring::BuildString()
+{
+ CDigiChar * pDChar;
+ if (!m_Modified) return;
+ m_CharVector.clear();
+
+ m_strText.MakeUpper();
+ for (int i = 0; i < m_strText.GetLength(); i++)
+ {
+ if ((pDChar = DefineChar(m_strText[i])) != NULL)
+ {
+ m_CharVector.push_back(*pDChar);
+ delete pDChar;
+ }
+ }
+
+ m_Modified = FALSE;
+}
+
+BEGIN_MESSAGE_MAP(CDigistring, CStatic)
+ //{{AFX_MSG_MAP(CDigistring)
+ ON_WM_PAINT()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigistring message handlers
+
+void CDigistring::OnPaint()
+{
+ CRect rect;
+ CDoubleRect CharRect;
+ GetClientRect(&rect);
+
+ CPaintDC dc(this); // device context for painting
+ dc.SetBkColor(m_BackColor);
+ CMemDC memDC(&dc, &rect);
+
+ CBrush hBrushOff, hBrushOn;
+ hBrushOff.CreateSolidBrush(m_OffColor);
+ hBrushOn.CreateSolidBrush(m_OnColor);
+ CBrush *pOldBrush = memDC.SelectObject(&hBrushOn);
+
+ int r = int(GetRValue(m_OffColor) * 0.75 + GetRValue(m_BackColor) * 0.25);
+ int g = int(GetGValue(m_OffColor) * 0.75 + GetGValue(m_BackColor) * 0.25);
+ int b = int(GetBValue(m_OffColor) * 0.75 + GetBValue(m_BackColor) * 0.25);
+
+ CPen OffPen(PS_SOLID | PS_ENDCAP_ROUND, 1, RGB(r,g,b));
+ r = int(GetRValue(m_OnColor) * 0.75 + GetRValue(m_BackColor) * 0.25);
+ g = int(GetGValue(m_OnColor) * 0.75 + GetGValue(m_BackColor) * 0.25);
+ b = int(GetBValue(m_OnColor) * 0.75 + GetBValue(m_BackColor) * 0.25);
+ CPen OnPen(PS_SOLID | PS_ENDCAP_ROUND, 1, RGB(r,g,b));
+ CPen *pOldPen = memDC.SelectObject(&OffPen);
+
+ int iTotWidth = 0;
+ double dRelWidth, dRelHeight;
+ // TODO: Add your message handler code here
+
+ DigiCharVector::iterator CharIterator;
+
+ // Calculate resizing factors...
+ BuildString();
+ for (CharIterator = m_CharVector.begin(); CharIterator != m_CharVector.end();
+ CharIterator++)
+ {
+ iTotWidth += CharIterator->GetNormWidth();
+ }
+ dRelWidth = double(rect.Width()) / iTotWidth;
+ dRelHeight = double(rect.Height()) / NORM_DIGIHEIGHT;
+
+ // If proportional make offset for centered text
+ if (m_DispStyle & DS_SZ_PROP)
+ {
+ if (dRelWidth < dRelHeight)
+ dRelHeight = dRelWidth;
+ else
+ dRelWidth = dRelHeight;
+
+ CharRect.left = (rect.Width() - dRelWidth * iTotWidth) / 2;
+ CharRect.top = (rect.Height() - dRelHeight * NORM_DIGIHEIGHT) / 2;
+ }
+ else
+ CharRect.SetRectEmpty();
+
+ // Draw all characters...
+ for (CharIterator = m_CharVector.begin(); CharIterator != m_CharVector.end();
+ CharIterator++)
+ {
+ CharRect.SetRect(CharRect.left, CharRect.top,
+ CharRect.left + dRelWidth * CharIterator->GetNormWidth(),
+ CharRect.top + dRelHeight * NORM_DIGIHEIGHT);
+
+ CharIterator->Draw(&memDC, CharRect, &OffPen, &OnPen, &hBrushOff, &hBrushOn);
+
+ CharRect.left += dRelWidth * CharIterator->GetNormWidth();
+ }
+
+ // Mama says: Clean up your mess!
+ memDC.SelectObject(pOldPen);
+ memDC.SelectObject(pOldBrush);
+ OffPen.DeleteObject();
+ OnPen.DeleteObject();
+ hBrushOff.DeleteObject();
+ hBrushOn.DeleteObject();
+}
+
+BOOL CDigistring::OnEraseBkgnd(CDC* /*pDC*/)
+{
+ // Don't erase the background to avoid flickering
+ // Background is painted in CMemDC::CMemDC(); with FillSolidRect();
+ return FALSE;
+}
diff --git a/Horloge/Digistring.h b/Horloge/Digistring.h
new file mode 100644
index 0000000..dc1352d
--- /dev/null
+++ b/Horloge/Digistring.h
@@ -0,0 +1,187 @@
+#if !defined(AFX_DIGISTRING_H__F77484C2_745F_11D3_A718_87712333104C__INCLUDED_)
+#define AFX_DIGISTRING_H__F77484C2_745F_11D3_A718_87712333104C__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// Digistring.h : header file
+//
+// Copyright (C) 2000 by Michel Wassink
+// All rights reserved
+//
+// This is free software.
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is
+// not sold for profit without the authors written consent, and
+// providing that this notice and the authors name and all copyright
+// notices remains intact. If the source code in this file is used in
+// any commercial application then a statement along the lines of
+// "Portions Copyright © 2000 Michel Wassink" must be included in
+// the startup banner, "About" box or printed documentation. An email
+// letting me know that you are using it would be nice as well. That's
+// not much to ask considering the amount of work that went into this.
+//
+// No warrantee of any kind, expressed or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Version: 1.0
+// Release: 1 (februari 2000 to www.codeguru.com and www.codeproject.com)
+// -----------------------------------------------------------------------
+// Notes to changes for release 1 (V1.0):
+// - First release.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
+// I'll try to keep a version up to date. I can be reached as follows:
+// mwassink@csi.com (private site)
+// An email letting me know that you are using it would be nice.
+/////////////////////////////////////////////////////////////////////////////
+
+#include <vector>
+using namespace std ;
+#include "MEMDC.H"
+#include "RGBCOLOR.H"
+
+// CRect class with double precision for accurate drawing.
+class CDoubleRect
+{
+public:
+ void SetRect(double x1, double y1, double x2, double y2)
+ { left = x1; top = y1; right = x2; bottom = y2;}
+ double Width() const{return right - left;}
+ double Height() const{return bottom - top;}
+ void SetRectEmpty(){left = top = right = bottom = 0.0;}
+public:
+ double left, top, right, bottom;
+};
+
+class CDSegment
+{
+public:
+ CDSegment();
+ CDSegment(const CDSegment& Segment);
+ ~CDSegment();
+ void DefPoints(const POINT* lpPoints, const BYTE* lpTypes, int nCount);
+ void Draw(CDC *pDC, CDoubleRect DrawPlace, int iWidth) const;
+ void FreeSegment();
+ CDSegment operator=(const CDSegment &Segment);
+
+// Implementation
+public:
+ CPoint * m_paPoints;
+ BYTE * m_paTypes;
+ int m_nCount;
+};
+
+typedef vector<CDSegment> DSegmentVector;
+
+class CDigiChar
+{
+// Construction
+public:
+ CDigiChar();
+
+//Attributes:
+public:
+ virtual ~CDigiChar();
+ virtual void SetElementData(WORD wSegmData, int iDispStyle);
+ void Draw(CDC *pDC, CDoubleRect DrawPlace, CPen *pOffPen, CPen *pOnpen,
+ CBrush *pOffBrush, CBrush *pOnBrush);
+ void SetColor(COLORREF OffColor, COLORREF OnColor);
+ int GetNormWidth() const;
+
+
+protected:
+ int m_Width;
+ WORD m_wSegmData;
+ DSegmentVector m_SegmentVector;
+ int m_NSegments;
+ COLORREF m_OffColor;
+ COLORREF m_OnColor;
+
+};
+
+class CDigiColonDotChar : public CDigiChar
+{
+public:
+ CDigiColonDotChar();
+ void SetElementData(WORD wSegmData, int iDispStyle);
+};
+
+class CDigi7Segment : public CDigiChar
+{
+public:
+ CDigi7Segment();
+ void SetElementData(WORD wSegmData, int iDispStyle);
+};
+
+class CDigi14Segment : public CDigiChar
+{
+public:
+ CDigi14Segment();
+ void SetElementData(WORD wSegmData, int iDispStyle);
+};
+
+typedef vector<CDigiChar> DigiCharVector;
+
+/////////////////////////////////////////////////////////////////////////////
+// CDigistring class
+
+class CDigistring : public CStatic
+{
+// Construction
+public:
+ CDigistring();
+
+// Attributes
+public:
+ enum {
+ DS_SMOOTH = 1, // Pioneer kind of characters
+ DS_STYLE14 = 2, // use allways 14 segment display.
+ DS_SZ_PROP = 4 // size proportional
+ };
+
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDigistring)
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CDigistring();
+ void SetText(LPCTSTR lpszText);
+ void Format(LPCTSTR lpszFormat, ...);
+ void SetColor(COLORREF OffColor, COLORREF OnColor);
+ void SetBackColor(COLORREF BackColor = BLACK);
+ BOOL ModifyDigiStyle(DWORD dwRemove, DWORD dwAdd);
+
+ // Generated message map functions
+protected:
+ CDigiChar * DefineChar(TCHAR cChar);
+ void BuildString();
+
+ CString m_strText;
+ BOOL m_Modified;
+ DigiCharVector m_CharVector;
+ COLORREF m_OffColor;
+ COLORREF m_OnColor;
+ COLORREF m_BackColor;
+ DWORD m_DispStyle;
+ //{{AFX_MSG(CDigistring)
+ afx_msg void OnPaint();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_DIGISTRING_H__F77484C2_745F_11D3_A718_87712333104C__INCLUDED_)
diff --git a/Horloge/Horloge.cpp b/Horloge/Horloge.cpp
new file mode 100644
index 0000000..cbe1774
--- /dev/null
+++ b/Horloge/Horloge.cpp
@@ -0,0 +1,74 @@
+// Horloge.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "Horloge.h"
+#include "HorlogeDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeApp
+
+BEGIN_MESSAGE_MAP(CHorlogeApp, CWinApp)
+ //{{AFX_MSG_MAP(CHorlogeApp)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ // DO NOT EDIT what you see in these blocks of generated code!
+ //}}AFX_MSG
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeApp construction
+
+CHorlogeApp::CHorlogeApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// The one and only CHorlogeApp object
+
+CHorlogeApp theApp;
+
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeApp initialization
+
+BOOL CHorlogeApp::InitInstance()
+{
+ // InitCommonControlsEx() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ INITCOMMONCONTROLSEX InitCtrls;
+ InitCtrls.dwSize = sizeof(InitCtrls);
+ // Set this to include all the common control classes you want to use
+ // in your application.
+ InitCtrls.dwICC = ICC_WIN95_CLASSES;
+ InitCommonControlsEx(&InitCtrls);
+
+ CWinApp::InitInstance();
+
+ //AfxEnableControlContainer();
+ CHorlogeDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with OK
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with Cancel
+ }
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
diff --git a/Horloge/Horloge.dsp b/Horloge/Horloge.dsp
new file mode 100644
index 0000000..c10c181
--- /dev/null
+++ b/Horloge/Horloge.dsp
@@ -0,0 +1,199 @@
+# Microsoft Developer Studio Project File - Name="Horloge" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=Horloge - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Horloge.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Horloge.mak" CFG="Horloge - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Horloge - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "Horloge - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/Bus/Horloge", JIEAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Horloge - Win32 Release"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
+# ADD LINK32 /nologo /subsystem:windows /machine:I386
+
+!ELSEIF "$(CFG)" == "Horloge - Win32 Debug"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"c:\users\fcolin\Program Files\Debug\Horloge.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "Horloge - Win32 Release"
+# Name "Horloge - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Curvefit.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Digistring.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Horloge.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Horloge.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\HorlogeDlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\HorlogeParseCmdLine.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Curvefit.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Digistring.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Horloge.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\HorlogeDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\HorlogeParseCmdLine.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MemDC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Rgbcolor.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\res\Horloge.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\Horloge.rc2
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ico00001.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ico00002.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ico00003.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ico00004.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\icon1.ico
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/Horloge/Horloge.h b/Horloge/Horloge.h
new file mode 100644
index 0000000..a7ab3d9
--- /dev/null
+++ b/Horloge/Horloge.h
@@ -0,0 +1,50 @@
+// Horloge.h : main header file for the HORLOGE application
+//
+
+#if !defined(AFX_HORLOGE_H__0FD083D1_0B1D_43C1_9501_73E55EBEDE61__INCLUDED_)
+#define AFX_HORLOGE_H__0FD083D1_0B1D_43C1_9501_73E55EBEDE61__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+#include "Digistring.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeApp:
+// See Horloge.cpp for the implementation of this class
+//
+
+class CHorlogeApp : public CWinApp
+{
+public:
+ CHorlogeApp();
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CHorlogeApp)
+ public:
+ virtual BOOL InitInstance();
+ //}}AFX_VIRTUAL
+
+// Implementation
+
+ //{{AFX_MSG(CHorlogeApp)
+ // NOTE - the ClassWizard will add and remove member functions here.
+ // DO NOT EDIT what you see in these blocks of generated code !
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_HORLOGE_H__0FD083D1_0B1D_43C1_9501_73E55EBEDE61__INCLUDED_)
diff --git a/Horloge/Horloge.rc b/Horloge/Horloge.rc
new file mode 100644
index 0000000..a7c0582
--- /dev/null
+++ b/Horloge/Horloge.rc
@@ -0,0 +1,194 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// French (France) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n"
+ "#ifdef _WIN32\r\n"
+ "LANGUAGE 12, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#endif //_WIN32\r\n"
+ "#include ""res\\Horloge.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""l.fra\\afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\Horloge.ico"
+IDI_FORWARD ICON "res\\icon1.ico"
+IDI_BACKWARD ICON "res\\ico00001.ico"
+IDI_PAUSE ICON "res\\ico00002.ico"
+IDI_START ICON "res\\ico00003.ico"
+IDI_NORMAL_SPEED ICON "res\\ico00004.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_HORLOGE_DIALOG DIALOGEX 0, 0, 320, 201
+STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "Horloge"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ PUSHBUTTON "Pause",IDC_PAUSE,115,82,61,28,BS_ICON
+ PUSHBUTTON "Start",IDC_START,179,82,58,28,BS_ICON
+ PUSHBUTTON "Backward",IDC_BACKWARD,111,55,30,22,BS_ICON
+ PUSHBUTTON "Forward",IDC_FORWARD,175,55,30,22,BS_ICON
+ CTEXT "SPEED",IDC_SPEED,212,55,47,22,SS_CENTERIMAGE | SS_SUNKEN
+ CTEXT "HH:MM:SS",IDC_TIME,115,12,190,34,SS_CENTERIMAGE | SS_SUNKEN
+ GROUPBOX "Ivy",IDC_STATIC,7,5,102,188
+ EDITTEXT IDC_BUSNUMBER,20,18,74,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Ivy Start",IDC_IVYSTART,41,38,31,14
+ CONTROL "Big Speed",IDC_BIGSPEED,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP,264,62,49,10
+ LISTBOX IDC_APPLIST,13,59,91,128,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ CONTROL "DateTimePicker1",IDC_SETTIME,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,251,86,54,13
+ PUSHBUTTON "-5 min",IDC_BACK_5,117,119,28,24
+ PUSHBUTTON "- 2 min",IDC_BACK_2,150,119,28,24
+ PUSHBUTTON "+2 min",IDC_FORW_2,243,119,28,24
+ PUSHBUTTON "+5 min",IDC_FORW_5,274,119,28,24
+ PUSHBUTTON "-1 min",IDC_BACK_1,181,119,28,24
+ PUSHBUTTON "+1 min",IDC_FORW_1,212,119,28,24
+ PUSHBUTTON "Change File...",IDC_FILE,113,167,48,14
+ EDITTEXT IDC_FILENAME,165,167,142,14,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "Normal Speed",IDC_NORMAL_SPEED,143,55,30,22,BS_ICON
+ CONTROL "",IDC_FILEPROGRESS,"msctls_progress32",WS_BORDER,110,148,203,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040C04B0"
+ BEGIN
+ VALUE "FileDescription", "Application MFC Horloge"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "Horloge"
+ VALUE "LegalCopyright", "Copyright (C) 2001"
+ VALUE "OriginalFilename", "Horloge.EXE"
+ VALUE "ProductName", "Application Horloge"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40c, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_HORLOGE_DIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 313
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 193
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // French (France) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE 12, 1
+#pragma code_page(1252)
+#endif //_WIN32
+#include "res\Horloge.rc2" // non-Microsoft Visual C++ edited resources
+#include "l.fra\afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Horloge/Horloge.vcproj b/Horloge/Horloge.vcproj
new file mode 100644
index 0000000..3a5bcb1
--- /dev/null
+++ b/Horloge/Horloge.vcproj
@@ -0,0 +1,535 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="Horloge"
+ ProjectGUID="{79A52956-E5E0-46FF-9EB7-112ED0CD5315}"
+ RootNamespace="Horloge"
+ SccProjectName="&quot;$/Bus/Horloge&quot;, JIEAAAAA"
+ SccLocalPath="."
+ SccProvider="MSSCCI:Microsoft Visual SourceSafe"
+ Keyword="MFCProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/Horloge.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;..\Ivy&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG"
+ Culture="1036"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Debug/Horloge.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\Ivy;&quot;..\..\..\pcre-6.4&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG"
+ Culture="1036"
+ AdditionalIncludeDirectories="$(IntDir)/"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/Horloge.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\Ivy;&quot;..\..\..\pcre-6.4&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG"
+ Culture="1036"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="rem copy &quot;$(TargetPath)&quot; &quot;C:\users\fcolin\Program Files\$(OutDir)&quot;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/Horloge.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\Ivy;&quot;..\..\..\pcre-6.4&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG"
+ Culture="1036"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ SubSystem="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="rem copy &quot;$(TargetPath)&quot; &quot;C:\users\fcolin\Program Files\$(OutDir)&quot;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ <ProjectReference
+ ReferencedProjectIdentifier="{84E0039A-6721-4B18-9792-E9AE4274AC0E}"
+ RelativePathToProject="..\Ivy\Ivy.vcproj"
+ />
+ <ProjectReference
+ ReferencedProjectIdentifier="{D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}"
+ RelativePathToProject="..\..\..\pcre\pcre.vcproj"
+ />
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\Curvefit.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Digistring.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Horloge.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\HorlogeDlg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\HorlogeParseCmdLine.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\Curvefit.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Digistring.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Horloge.h"
+ >
+ </File>
+ <File
+ RelativePath=".\HorlogeDlg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\HorlogeParseCmdLine.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MemDC.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Rgbcolor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\res\Horloge.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\Horloge.rc"
+ >
+ </File>
+ <File
+ RelativePath=".\res\Horloge.rc2"
+ >
+ </File>
+ <File
+ RelativePath=".\res\ico00001.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\ico00002.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\ico00003.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\ico00004.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\icon1.ico"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="Horloge.rc"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/Horloge/Horloge.vcproj.vspscc b/Horloge/Horloge.vcproj.vspscc
new file mode 100644
index 0000000..794f014
--- /dev/null
+++ b/Horloge/Horloge.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/Horloge/HorlogeDlg.cpp b/Horloge/HorlogeDlg.cpp
new file mode 100644
index 0000000..b6ac3d9
--- /dev/null
+++ b/Horloge/HorlogeDlg.cpp
@@ -0,0 +1,347 @@
+// HorlogeDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Horloge.h"
+#include "HorlogeDlg.h"
+#include "HorlogeParseCmdLine.h"
+
+#include "IvyApplication.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeDlg dialog
+
+CHorlogeDlg::CHorlogeDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CHorlogeDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CHorlogeDlg)
+ m_busnumber = _T("");
+ m_big_speed = FALSE;
+ m_filename = _T("");
+ //}}AFX_DATA_INIT
+ // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+ GetSystemTime(&current_time);
+ GetSystemTime(&start_time);
+ bus = NULL;
+ rate = 1.0;
+}
+
+void CHorlogeDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CHorlogeDlg)
+ DDX_Control(pDX, IDC_SETTIME, m_setTime);
+ DDX_Control(pDX, IDC_APPLIST, m_applist);
+ DDX_Control(pDX, IDC_SPEED, m_Speed);
+ DDX_Control(pDX, IDC_TIME, m_Time);
+ DDX_Text(pDX, IDC_BUSNUMBER, m_busnumber);
+ DDX_Check(pDX, IDC_BIGSPEED, m_big_speed);
+ DDX_Text(pDX, IDC_FILENAME, m_filename);
+ //}}AFX_DATA_MAP
+ DDX_Control(pDX, IDC_FILEPROGRESS, file_progress);
+}
+
+BEGIN_MESSAGE_MAP(CHorlogeDlg, CDialog)
+ //{{AFX_MSG_MAP(CHorlogeDlg)
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_BN_CLICKED(IDC_IVYSTART, OnIvystart)
+ ON_BN_CLICKED(IDC_PAUSE, OnPause)
+ ON_BN_CLICKED(IDC_START, OnStart)
+ ON_NOTIFY(DTN_DATETIMECHANGE, IDC_SETTIME, OnDatetimechangeSettime)
+ ON_BN_CLICKED(IDC_BACKWARD, OnBackward)
+ ON_BN_CLICKED(IDC_FORWARD, OnForward)
+ ON_BN_CLICKED(IDC_BACK_5, OnBack5)
+ ON_BN_CLICKED(IDC_BACK_2, OnBack2)
+ ON_BN_CLICKED(IDC_BACK_1, OnBack1)
+ ON_BN_CLICKED(IDC_FORW_1, OnForw1)
+ ON_BN_CLICKED(IDC_FORW_2, OnForw2)
+ ON_BN_CLICKED(IDC_FORW_5, OnForw5)
+ ON_BN_CLICKED(IDC_FILE, OnFile)
+ ON_BN_CLICKED(IDC_NORMAL_SPEED, OnNormalSpeed)
+ ON_LBN_DBLCLK(IDC_APPLIST, OnDblclkApplist)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeDlg message handlers
+
+BOOL CHorlogeDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ //SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+
+ ((CButton*)GetDlgItem(IDC_FORWARD))->SetIcon( AfxGetApp()->LoadIcon(IDI_FORWARD));
+ ((CButton*)GetDlgItem(IDC_BACKWARD))->SetIcon(AfxGetApp()->LoadIcon(IDI_BACKWARD));
+ ((CButton*)GetDlgItem(IDC_PAUSE))->SetIcon(AfxGetApp()->LoadIcon(IDI_PAUSE));
+ ((CButton*)GetDlgItem(IDC_START))->SetIcon(AfxGetApp()->LoadIcon(IDI_START));
+ ((CButton*)GetDlgItem(IDC_NORMAL_SPEED))->SetIcon(AfxGetApp()->LoadIcon(IDI_NORMAL_SPEED));
+
+
+ m_Time.Format(TEXT("%02d:%02d:%02d"), 0,0,0);
+ m_Speed.Format(TEXT("%.2f"), rate );
+ m_setTime.GetTime(&current_time);
+
+ bus = new Ivy( "Horloge","Horloge READY",this,TRUE);
+
+ // parse command Line Info
+ HorlogeParseCmdLine cmd;
+ cmd.m_busNumber = bus->GetDomain( NULL );
+
+ AfxGetApp()->ParseCommandLine( cmd );
+
+ // Set Argument from Command Line
+ m_busnumber = cmd.m_busNumber;
+
+
+ bus->BindMsg("^ClockEvent Time=([0-9]+):([0-9]+):([0-9]+) Rate=([-.0-9]+) Bs=([0-9]+)", BUS_CALLBACK_OF(CHorlogeDlg, IvyClockEvent ));
+ bus->BindMsg("^ClockDatas Time=([0-9]+):([0-9]+):([0-9]+) Rate=([-.0-9]+) Bs=([0-9]+)", BUS_CALLBACK_OF(CHorlogeDlg, IvyClockEvent ));
+ bus->BindMsg("^FileReadEvent Type=REJEU Name=([^ ]+) StartTime=([0-9]+):([0-9]+):([0-9]+) EndTime=([0-9]+):([0-9]+):([0-9]+)", BUS_CALLBACK_OF(CHorlogeDlg, IvyFileReadEvent ));
+ bus->BindMsg("^rejeu READY", BUS_CALLBACK_OF(CHorlogeDlg, IvyRejeuReady));
+
+ m_busnumber = bus->GetDomain( CStringA( m_busnumber ) );
+ UpdateData(FALSE);
+
+ // force bus start in case of start
+ if ( cmd.m_start )
+ OnIvystart();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void CHorlogeDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialog::OnPaint();
+ }
+}
+
+// The system calls this to obtain the cursor to display while the user drags
+// the minimized window.
+HCURSOR CHorlogeDlg::OnQueryDragIcon()
+{
+ return (HCURSOR) m_hIcon;
+}
+
+void CHorlogeDlg::OnIvystart()
+{
+ UpdateData(TRUE);
+ bus->stop();
+ m_busnumber = bus->GetDomain( CStringA( m_busnumber ) );
+ bus->start( CStringA(m_busnumber));
+ m_applist.ResetContent();
+ UpdateData(FALSE);
+}
+void CHorlogeDlg::OnApplicationConnected(IvyApplication *app)
+{
+ m_applist.AddString( CString(app->GetName()) );
+}
+void CHorlogeDlg::OnApplicationDisconnected(IvyApplication *app)
+{
+ m_applist.DeleteString(m_applist.FindString(0, CString(app->GetName())) );
+}
+
+void CHorlogeDlg::OnDblclkApplist()
+{
+ CString name;
+ int sel = m_applist.GetCurSel();
+ m_applist.GetText( sel, name );
+ IvyApplication *app = bus->GetApplication( CStringA(name) );
+ if ( app )
+ {
+ bus->SendDieMsg(app);
+ m_applist.DeleteString( sel );
+ }
+
+}
+
+void CHorlogeDlg::IvyClockEvent( IvyApplication *app, int argc, const char **argv )
+{
+ // Ivy ClockEvent Time=10:23:45 Rate=3 Bs=0
+ current_time.wHour = atoi( *argv++ );
+ current_time.wMinute = atoi( *argv++ );
+ current_time.wSecond = atoi( *argv++ );
+ rate = atof( *argv++ );
+ int BigSpeed = atoi( *argv++ );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+ m_Speed.Format(TEXT("%.2f"), rate );
+ m_big_speed = BigSpeed;
+ m_setTime.SetTime(&current_time);
+ CTime cur_time( current_time );
+ CTime sta_time( start_time );
+ CTimeSpan span = cur_time - sta_time;
+ file_progress.SetPos( span.GetTotalSeconds() );
+ TRACE("CHorlogeDlg::IvyClockEvent %d\n", span.GetTotalSeconds() );
+ UpdateData(FALSE);
+}
+void CHorlogeDlg::IvyFileReadEvent( IvyApplication *app, int argc, const char **argv )
+{
+ // Ivy FileReadEvent Type=REJEU Name=/home/fcolin/asterix/EAF3534D.rej StartTime=19:57:00 EndTime=20:09:59
+ const char* name = *argv++;
+ int hh_start = atoi( *argv++ );
+ int mm_start = atoi( *argv++ );
+ int ss_start = atoi( *argv++ );
+ int hh_end = atoi( *argv++ );
+ int mm_end = atoi( *argv++ );
+ int ss_end = atoi( *argv++ );
+
+ start_time.wHour = hh_start;
+ start_time.wMinute = mm_start;
+ start_time.wSecond = ss_start;
+ current_time = start_time;
+
+ long start = (( hh_start * 60 ) + mm_start ) * 60 + ss_start;
+ long end = (( hh_end * 60 ) + mm_end ) * 60 + ss_end;
+
+ TRACE("CHorlogeDlg::IvyFileReadEvent range 0 %d\n", end - start );
+ file_progress.SetRange32(0, end - start );
+ file_progress.SetStep( 1 );
+ file_progress.SetPos( 0 );
+
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+ VERIFY(m_setTime.SetTime(&current_time));
+ m_filename = name;
+ bus->SendMsg("SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ UpdateData(FALSE);
+}
+void CHorlogeDlg::IvyRejeuReady( IvyApplication *app, int argc, const char **argv )
+{
+ bus->SendMsg("GetClockDatas");
+}
+
+void CHorlogeDlg::OnPause()
+{
+ bus->SendMsg("ClockPause");
+}
+
+void CHorlogeDlg::OnStart()
+{
+ bus->SendMsg("ClockStart");
+}
+
+void CHorlogeDlg::OnBackward()
+{
+ rate -= 0.5;
+ m_Speed.Format(TEXT("%.2f"), rate );
+ bus->SendMsg("SetClock Rate=%.2f",rate);
+}
+
+void CHorlogeDlg::OnForward()
+{
+ rate += 0.5;
+ m_Speed.Format(TEXT("%.2f"), rate );
+ bus->SendMsg("SetClock Rate=%.2f",rate);
+}
+void CHorlogeDlg::OnNormalSpeed()
+{
+ rate = 1.0;
+ m_Speed.Format(TEXT("%.2f"), rate );
+ bus->SendMsg("SetClock Rate=%.2f",rate);
+}
+
+
+void CHorlogeDlg::OnDatetimechangeSettime(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ m_setTime.GetTime(&current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+ *pResult = 0;
+}
+
+
+void CHorlogeDlg::OnBack5()
+{
+ CTime new_time( current_time );
+ new_time -= CTimeSpan( 0, 0, 5, 0 );
+ new_time. GetAsSystemTime(current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+}
+
+void CHorlogeDlg::OnBack2()
+{
+ CTime new_time( current_time );
+ new_time -= CTimeSpan( 0, 0, 2, 0 );
+ new_time. GetAsSystemTime(current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+}
+
+void CHorlogeDlg::OnBack1()
+{
+ CTime new_time( current_time );
+ new_time -= CTimeSpan( 0, 0, 1, 0 );
+ new_time. GetAsSystemTime(current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+}
+
+void CHorlogeDlg::OnForw1()
+{
+ CTime new_time( current_time );
+ new_time += CTimeSpan( 0, 0, 1, 0 );
+ new_time. GetAsSystemTime(current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+}
+
+void CHorlogeDlg::OnForw2()
+{
+ CTime new_time( current_time );
+ new_time += CTimeSpan( 0, 0, 2, 0 );
+ new_time. GetAsSystemTime(current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+}
+
+void CHorlogeDlg::OnForw5()
+{
+ CTime new_time( current_time );
+ new_time += CTimeSpan( 0, 0, 5, 0 );
+ new_time. GetAsSystemTime(current_time);
+ bus->SendMsg( "SetClock Time=%d:%d:%d", current_time.wHour, current_time.wMinute, current_time.wSecond );
+ m_Time.Format(TEXT("%02d:%02d:%02d"), current_time.wHour, current_time.wMinute, current_time.wSecond);
+}
+
+void CHorlogeDlg::OnFile()
+{
+ CFileDialog file(TRUE,TEXT(".rej"),NULL, OFN_FILEMUSTEXIST,TEXT("Rejeu Files (*.rej)|*.rej|All Files (*.*)|*.*||"));
+ if ( file.DoModal() == IDOK )
+ {
+ bus->SendMsg( "FileRead Type=rejeu Name=%S", file.GetPathName() );
+ }
+}
+
diff --git a/Horloge/HorlogeDlg.h b/Horloge/HorlogeDlg.h
new file mode 100644
index 0000000..93cb915
--- /dev/null
+++ b/Horloge/HorlogeDlg.h
@@ -0,0 +1,82 @@
+// HorlogeDlg.h : header file
+//
+
+#if !defined(AFX_HORLOGEDLG_H__8AB6D6CD_4D9E_450D_B42C_E5A6F72FCA32__INCLUDED_)
+#define AFX_HORLOGEDLG_H__8AB6D6CD_4D9E_450D_B42C_E5A6F72FCA32__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "Ivy.h"
+#include "afxcmn.h"
+/////////////////////////////////////////////////////////////////////////////
+// CHorlogeDlg dialog
+
+class CHorlogeDlg : public CDialog, public IvyApplicationCallback
+{
+// Construction
+public:
+ CHorlogeDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CHorlogeDlg)
+ enum { IDD = IDD_HORLOGE_DIALOG };
+ CDateTimeCtrl m_setTime;
+ CListBox m_applist;
+ CDigistring m_Speed;
+ CDigistring m_Time;
+ CString m_busnumber;
+ BOOL m_big_speed;
+ CString m_filename;
+ //}}AFX_DATA
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CHorlogeDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ HICON m_hIcon;
+ Ivy *bus;
+ double rate;
+ SYSTEMTIME start_time;
+ SYSTEMTIME current_time;
+ void IvyClockEvent( IvyApplication *app, int argc, const char **argv );
+ void IvyRejeuReady( IvyApplication *app, int argc, const char **argv );
+ void IvyFileReadEvent( IvyApplication *app, int argc, const char **argv );
+ void OnApplicationConnected( IvyApplication *app );
+ void OnApplicationDisconnected( IvyApplication *app );
+
+ // Generated message map functions
+ //{{AFX_MSG(CHorlogeDlg)
+ virtual BOOL OnInitDialog();
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ afx_msg void OnIvystart();
+ afx_msg void OnPause();
+ afx_msg void OnStart();
+ afx_msg void OnDatetimechangeSettime(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnBackward();
+ afx_msg void OnForward();
+ afx_msg void OnBack5();
+ afx_msg void OnBack2();
+ afx_msg void OnBack1();
+ afx_msg void OnForw1();
+ afx_msg void OnForw2();
+ afx_msg void OnForw5();
+ afx_msg void OnFile();
+ afx_msg void OnNormalSpeed();
+ afx_msg void OnDblclkApplist();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+public:
+ CProgressCtrl file_progress;
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_HORLOGEDLG_H__8AB6D6CD_4D9E_450D_B42C_E5A6F72FCA32__INCLUDED_)
diff --git a/Horloge/HorlogeParseCmdLine.cpp b/Horloge/HorlogeParseCmdLine.cpp
new file mode 100644
index 0000000..bd3e4e9
--- /dev/null
+++ b/Horloge/HorlogeParseCmdLine.cpp
@@ -0,0 +1,58 @@
+// HorlogeParseCmdLine.cpp: implementation of the HorlogeParseCmdLine class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+
+#include "HorlogeParseCmdLine.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+HorlogeParseCmdLine::HorlogeParseCmdLine()
+{
+ m_start = FALSE;
+ m_busNumber = "";
+}
+
+HorlogeParseCmdLine::~HorlogeParseCmdLine()
+{
+
+}
+
+void HorlogeParseCmdLine::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
+{
+ if (bFlag)
+ {
+ ParseParamFlag(lpszParam);
+ }
+ else
+ ParseParamNotFlag(lpszParam);
+
+}
+
+void HorlogeParseCmdLine::ParseParamFlag(LPCTSTR pszParam)
+{
+
+ if (lstrcmpi(pszParam, TEXT("start")) == 0)
+ m_start = TRUE;
+ else if (lstrcmpi(pszParam, TEXT("bus")) == 0)
+ m_shellCommand = BusNumber;
+}
+
+void HorlogeParseCmdLine::ParseParamNotFlag(LPCTSTR pszParam)
+{
+ switch ( m_shellCommand )
+ {
+ case BusNumber:
+ m_busNumber = pszParam;
+ break;
+ }
+}
diff --git a/Horloge/HorlogeParseCmdLine.h b/Horloge/HorlogeParseCmdLine.h
new file mode 100644
index 0000000..3ececad
--- /dev/null
+++ b/Horloge/HorlogeParseCmdLine.h
@@ -0,0 +1,31 @@
+// TestParseCmdLine.h: interface for the TestParseCmdLine class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FXParseCMDLINE_H__20232B92_AB99_11D2_898F_00A0245B298A__INCLUDED_)
+#define AFX_FXParseCMDLINE_H__20232B92_AB99_11D2_898F_00A0245B298A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class HorlogeParseCmdLine : public CCommandLineInfo
+{
+public:
+
+ BOOL m_start;
+ CString m_busNumber;
+ virtual void ParseParam( LPCTSTR lpszParam, BOOL bFlag, BOOL bLast );
+ HorlogeParseCmdLine();
+ virtual ~HorlogeParseCmdLine();
+ enum {
+ BusNumber,
+ Start,
+ }m_shellCommand;
+
+protected:
+ void ParseParamNotFlag(LPCTSTR pszParam);
+ void ParseParamFlag(LPCTSTR pszParam);
+};
+
+#endif // !defined(AFX_FXParseCMDLINE_H__20232B92_AB99_11D2_898F_00A0245B298A__INCLUDED_)
diff --git a/Horloge/MemDC.h b/Horloge/MemDC.h
new file mode 100644
index 0000000..494fbbe
--- /dev/null
+++ b/Horloge/MemDC.h
@@ -0,0 +1,104 @@
+#ifndef _MEMDC_H_
+#define _MEMDC_H_
+
+//////////////////////////////////////////////////
+// CMemDC - memory DC
+//
+// Author: Keith Rule
+// Email: keithr@europa.com
+// Copyright 1996-1999, Keith Rule
+//
+// You may freely use or modify this code provided this
+// Copyright is included in all derived versions.
+//
+// History - 10/3/97 Fixed scrolling bug.
+// Added print support. - KR
+//
+// 11/3/99 Fixed most common complaint. Added
+// background color fill. - KR
+//
+// 11/3/99 Added support for mapping modes other than
+// MM_TEXT as suggested by Lee Sang Hun. - KR
+//
+// This class implements a memory Device Context which allows
+// flicker free drawing.
+
+class CMemDC : public CDC {
+private:
+ CBitmap m_bitmap; // Offscreen bitmap
+ CBitmap* m_oldBitmap; // bitmap originally found in CMemDC
+ CDC* m_pDC; // Saves CDC passed in constructor
+ CRect m_rect; // Rectangle of drawing area.
+ BOOL m_bMemDC; // TRUE if CDC really is a Memory DC.
+public:
+
+ CMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()
+ {
+ ASSERT(pDC != NULL);
+
+ // Some initialization
+ m_pDC = pDC;
+ m_oldBitmap = NULL;
+ m_bMemDC = !pDC->IsPrinting();
+
+ // Get the rectangle to draw
+ if (pRect == NULL) {
+ pDC->GetClipBox(&m_rect);
+ } else {
+ m_rect = *pRect;
+ }
+
+ if (m_bMemDC) {
+ // Create a Memory DC
+ CreateCompatibleDC(pDC);
+ pDC->LPtoDP(&m_rect);
+
+ m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+ m_oldBitmap = SelectObject(&m_bitmap);
+
+ SetMapMode(pDC->GetMapMode());
+ pDC->DPtoLP(&m_rect);
+ SetWindowOrg(m_rect.left, m_rect.top);
+ } else {
+ // Make a copy of the relevent parts of the current DC for printing
+ m_bPrinting = pDC->m_bPrinting;
+ m_hDC = pDC->m_hDC;
+ m_hAttribDC = pDC->m_hAttribDC;
+ }
+
+ // Fill background
+ FillSolidRect(m_rect, pDC->GetBkColor());
+ }
+
+
+ ~CMemDC()
+ {
+ if (m_bMemDC) {
+ // Copy the offscreen bitmap onto the screen.
+ m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+ this, m_rect.left, m_rect.top, SRCCOPY);
+
+ //Swap back the original bitmap.
+ SelectObject(m_oldBitmap);
+ } else {
+ // All we need to do is replace the DC with an illegal value,
+ // this keeps us from accidently deleting the handles associated with
+ // the CDC that was passed to the constructor.
+ m_hDC = m_hAttribDC = NULL;
+ }
+ }
+
+ // Allow usage as a pointer
+ CMemDC* operator->()
+ {
+ return this;
+ }
+
+ // Allow usage as a pointer
+ operator CMemDC*()
+ {
+ return this;
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/Horloge/ReadMe.txt b/Horloge/ReadMe.txt
new file mode 100644
index 0000000..4065fc4
--- /dev/null
+++ b/Horloge/ReadMe.txt
@@ -0,0 +1,88 @@
+========================================================================
+ MICROSOFT FOUNDATION CLASS LIBRARY : Horloge
+========================================================================
+
+
+AppWizard has created this Horloge application for you. This application
+not only demonstrates the basics of using the Microsoft Foundation classes
+but is also a starting point for writing your application.
+
+This file contains a summary of what you will find in each of the files that
+make up your Horloge application.
+
+Horloge.dsp
+ This file (the project file) contains information at the project level and
+ is used to build a single project or subproject. Other users can share the
+ project (.dsp) file, but they should export the makefiles locally.
+
+Horloge.h
+ This is the main header file for the application. It includes other
+ project specific headers (including Resource.h) and declares the
+ CHorlogeApp application class.
+
+Horloge.cpp
+ This is the main application source file that contains the application
+ class CHorlogeApp.
+
+Horloge.rc
+ This is a listing of all of the Microsoft Windows resources that the
+ program uses. It includes the icons, bitmaps, and cursors that are stored
+ in the RES subdirectory. This file can be directly edited in Microsoft
+ Visual C++.
+
+Horloge.clw
+ This file contains information used by ClassWizard to edit existing
+ classes or add new classes. ClassWizard also uses this file to store
+ information needed to create and edit message maps and dialog data
+ maps and to create prototype member functions.
+
+res\Horloge.ico
+ This is an icon file, which is used as the application's icon. This
+ icon is included by the main resource file Horloge.rc.
+
+res\Horloge.rc2
+ This file contains resources that are not edited by Microsoft
+ Visual C++. You should place all resources not editable by
+ the resource editor in this file.
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+AppWizard creates one dialog class:
+
+HorlogeDlg.h, HorlogeDlg.cpp - the dialog
+ These files contain your CHorlogeDlg class. This class defines
+ the behavior of your application's main dialog. The dialog's
+ template is in Horloge.rc, which can be edited in Microsoft
+ Visual C++.
+
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named Horloge.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+ This is the standard header file, which defines new resource IDs.
+ Microsoft Visual C++ reads and updates this file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+If your application uses MFC in a shared DLL, and your application is
+in a language other than the operating system's current language, you
+will need to copy the corresponding localized resources MFC42XXX.DLL
+from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
+and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
+For example, MFC42DEU.DLL contains resources translated to German.) If you
+don't do this, some of the UI elements of your application will remain in the
+language of the operating system.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Horloge/Rgbcolor.h b/Horloge/Rgbcolor.h
new file mode 100644
index 0000000..1c45453
--- /dev/null
+++ b/Horloge/Rgbcolor.h
@@ -0,0 +1,40 @@
+/////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2000 by Michel Wassink
+// All rights reserved
+//
+// This is free software.
+// You may redistribute it by any means providing it is not sold for profit
+// without the author written consent.
+//
+// No warrantee of any kind, expressed or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
+// I'll try to keep a version up to date. I can be reached as follows:
+// mwassink@csi.com (private site)
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __RGBCOLOR_H__
+#define __RGBCOLOR_H__
+
+#define BLACK RGB( 000, 000, 000 )
+#define DARKBLUE RGB( 000, 000, 128 )
+#define DARKGREEN RGB( 000, 064, 000 )
+#define DARKCYAN RGB( 000, 064, 064 )
+#define DARKRED RGB( 064, 000, 000 )
+#define DARKMAGENTA RGB( 128, 000, 128 )
+#define BROWN RGB( 128, 128, 000 )
+#define DARKGRAY RGB( 128, 128, 128 )
+
+#define LIGHTGRAY RGB( 192, 192, 192 )
+#define LIGHTBLUE RGB( 000, 000, 255 )
+#define LIGHTGREEN RGB( 000, 255, 000 )
+#define LIGHTCYAN RGB( 000, 255, 255 )
+#define LIGHTRED RGB( 255, 000, 000 )
+#define LIGHTMAGENTA RGB( 255, 000, 255 )
+#define YELLOW RGB( 255, 255, 000 )
+#define WHITE RGB( 255, 255, 255 )
+
+#endif // __RGBCOLOR_H__
diff --git a/Horloge/StdAfx.cpp b/Horloge/StdAfx.cpp
new file mode 100644
index 0000000..ec4138a
--- /dev/null
+++ b/Horloge/StdAfx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// Horloge.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
+
diff --git a/Horloge/StdAfx.h b/Horloge/StdAfx.h
new file mode 100644
index 0000000..18ddc2a
--- /dev/null
+++ b/Horloge/StdAfx.h
@@ -0,0 +1,84 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__71A27006_2E49_42EE_BE8E_4A7CB7E53C16__INCLUDED_)
+#define AFX_STDAFX_H__71A27006_2E49_42EE_BE8E_4A7CB7E53C16__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows XP or later.
+#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#endif
+//#include "commctrl.h"
+
+
+
+#include <winsock.h>
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+#endif // !defined(AFX_STDAFX_H__71A27006_2E49_42EE_BE8E_4A7CB7E53C16__INCLUDED_)
+
+
+
+
+
+
+
diff --git a/Horloge/res/Horloge.ico b/Horloge/res/Horloge.ico
new file mode 100644
index 0000000..da2c09d
--- /dev/null
+++ b/Horloge/res/Horloge.ico
Binary files differ
diff --git a/Horloge/res/Horloge.rc2 b/Horloge/res/Horloge.rc2
new file mode 100644
index 0000000..181da8f
--- /dev/null
+++ b/Horloge/res/Horloge.rc2
@@ -0,0 +1,13 @@
+//
+// HORLOGE.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Horloge/res/ico00001.ico b/Horloge/res/ico00001.ico
new file mode 100644
index 0000000..aa862a1
--- /dev/null
+++ b/Horloge/res/ico00001.ico
Binary files differ
diff --git a/Horloge/res/ico00002.ico b/Horloge/res/ico00002.ico
new file mode 100644
index 0000000..47fcdbe
--- /dev/null
+++ b/Horloge/res/ico00002.ico
Binary files differ
diff --git a/Horloge/res/ico00003.ico b/Horloge/res/ico00003.ico
new file mode 100644
index 0000000..9eff079
--- /dev/null
+++ b/Horloge/res/ico00003.ico
Binary files differ
diff --git a/Horloge/res/ico00004.ico b/Horloge/res/ico00004.ico
new file mode 100644
index 0000000..b1e3652
--- /dev/null
+++ b/Horloge/res/ico00004.ico
Binary files differ
diff --git a/Horloge/res/icon1.ico b/Horloge/res/icon1.ico
new file mode 100644
index 0000000..614b0a0
--- /dev/null
+++ b/Horloge/res/icon1.ico
Binary files differ
diff --git a/Horloge/resource.h b/Horloge/resource.h
new file mode 100644
index 0000000..a400f6a
--- /dev/null
+++ b/Horloge/resource.h
@@ -0,0 +1,44 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by Horloge.rc
+//
+#define IDD_HORLOGE_DIALOG 102
+#define IDR_MAINFRAME 128
+#define IDI_FORWARD 141
+#define IDI_BACKWARD 142
+#define IDI_PAUSE 143
+#define IDI_START 144
+#define IDI_NORMAL_SPEED 146
+#define IDC_PAUSE 1001
+#define IDC_START 1002
+#define IDC_BACKWARD 1003
+#define IDC_FORWARD 1004
+#define IDC_NORMAL_SPEED 1005
+#define IDC_SPEED 1010
+#define IDC_TIME 1011
+#define IDC_BUSNUMBER 1026
+#define IDC_IVYSTART 1027
+#define IDC_BIGSPEED 1028
+#define IDC_APPLIST 1030
+#define IDC_SETTIME 1031
+#define IDC_BACK_5 1034
+#define IDC_BACK_2 1035
+#define IDC_FORW_2 1036
+#define IDC_FORW_5 1037
+#define IDC_BACK_1 1038
+#define IDC_FORW_1 1039
+#define IDC_FILE 1040
+#define IDC_FILENAME 1041
+#define IDC_PROGRESS1 1043
+#define IDC_FILEPROGRESS 1043
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 149
+#define _APS_NEXT_COMMAND_VALUE 32772
+#define _APS_NEXT_CONTROL_VALUE 1044
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif