summaryrefslogtreecommitdiff
path: root/Horloge
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:52:25 +0000
committerfcolin2007-02-01 12:52:25 +0000
commit26076079b8fecd9cbf432c01f980c78ce3808fdf (patch)
treea8d0bc6dd9ad4e3923a2de7290372eb882f61dc8 /Horloge
parente39b169d9d4070082046f55cbd6c3efbbd048fb1 (diff)
downloadivy-cplusplus-26076079b8fecd9cbf432c01f980c78ce3808fdf.zip
ivy-cplusplus-26076079b8fecd9cbf432c01f980c78ce3808fdf.tar.gz
ivy-cplusplus-26076079b8fecd9cbf432c01f980c78ce3808fdf.tar.bz2
ivy-cplusplus-26076079b8fecd9cbf432c01f980c78ce3808fdf.tar.xz
Utilisateur : Fcolin Date : 19/12/05 Heure : 14:56 Archivé dans $/Bus/Horloge Commentaire: (vss 4)
Diffstat (limited to 'Horloge')
-rw-r--r--Horloge/HorlogeDlg.cpp122
1 files changed, 69 insertions, 53 deletions
diff --git a/Horloge/HorlogeDlg.cpp b/Horloge/HorlogeDlg.cpp
index 6e26f61..0521d90 100644
--- a/Horloge/HorlogeDlg.cpp
+++ b/Horloge/HorlogeDlg.cpp
@@ -27,7 +27,8 @@ CHorlogeDlg::CHorlogeDlg(CWnd* pParent /*=NULL*/)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- memset( &time, 0, sizeof( time ) );
+ GetSystemTime(&current_time);
+ GetSystemTime(&start_time);
bus = NULL;
rate = 1.0;
}
@@ -44,6 +45,7 @@ void CHorlogeDlg::DoDataExchange(CDataExchange* pDX)
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)
@@ -87,9 +89,9 @@ BOOL CHorlogeDlg::OnInitDialog()
((CButton*)GetDlgItem(IDC_NORMAL_SPEED))->SetIcon(AfxGetApp()->LoadIcon(IDI_NORMAL_SPEED));
- m_Time.Format("%02d:%02d:%02d", 0,0,0);
- m_Speed.Format("%.2f", rate );
- m_setTime.GetTime(&time);
+ 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);
@@ -108,7 +110,7 @@ BOOL CHorlogeDlg::OnInitDialog()
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( m_busnumber );
+ m_busnumber = bus->GetDomain( CStringA( m_busnumber ) );
UpdateData(FALSE);
// force bus start in case of start
@@ -158,18 +160,18 @@ void CHorlogeDlg::OnIvystart()
{
UpdateData(TRUE);
bus->stop();
- m_busnumber = bus->GetDomain( m_busnumber );
- bus->start(m_busnumber);
+ 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( app->GetName() );
+ m_applist.AddString( CString(app->GetName()) );
}
void CHorlogeDlg::OnApplicationDisconnected(IvyApplication *app)
{
- m_applist.DeleteString(m_applist.FindString(0, app->GetName()) );
+ m_applist.DeleteString(m_applist.FindString(0, CString(app->GetName())) );
}
void CHorlogeDlg::OnDblclkApplist()
@@ -177,7 +179,7 @@ void CHorlogeDlg::OnDblclkApplist()
CString name;
int sel = m_applist.GetCurSel();
m_applist.GetText( sel, name );
- IvyApplication *app = bus->GetApplication( name );
+ IvyApplication *app = bus->GetApplication( CStringA(name) );
if ( app )
{
bus->SendDieMsg(app);
@@ -189,15 +191,20 @@ void CHorlogeDlg::OnDblclkApplist()
void CHorlogeDlg::IvyClockEvent( IvyApplication *app, int argc, const char **argv )
{
// Ivy ClockEvent Time=10:23:45 Rate=3 Bs=0
- time.wHour = atoi( *argv++ );
- time.wMinute = atoi( *argv++ );
- time.wSecond = atoi( *argv++ );
+ 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("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
- m_Speed.Format("%.2f", rate );
+ 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(&time);
+ 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 )
@@ -211,13 +218,23 @@ void CHorlogeDlg::IvyFileReadEvent( IvyApplication *app, int argc, const char **
int mm_end = atoi( *argv++ );
int ss_end = atoi( *argv++ );
- time.wHour = hh_start;
- time.wMinute = mm_start;
- time.wSecond = ss_start;
+ start_time.wHour = hh_start;
+ start_time.wMinute = mm_start;
+ start_time.wSecond = ss_start;
+ current_time = start_time;
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
- VERIFY(m_setTime.SetTime(&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 )
@@ -232,97 +249,96 @@ void CHorlogeDlg::OnPause()
void CHorlogeDlg::OnStart()
{
- bus->SendMsg("SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
bus->SendMsg("ClockStart");
}
void CHorlogeDlg::OnBackward()
{
rate -= 0.5;
- m_Speed.Format("%.2f", rate );
+ m_Speed.Format(TEXT("%.2f"), rate );
bus->SendMsg("SetClock Rate=%.2f",rate);
}
void CHorlogeDlg::OnForward()
{
rate += 0.5;
- m_Speed.Format("%.2f", rate );
+ m_Speed.Format(TEXT("%.2f"), rate );
bus->SendMsg("SetClock Rate=%.2f",rate);
}
void CHorlogeDlg::OnNormalSpeed()
{
rate = 1.0;
- m_Speed.Format("%.2f", rate );
+ m_Speed.Format(TEXT("%.2f"), rate );
bus->SendMsg("SetClock Rate=%.2f",rate);
}
void CHorlogeDlg::OnDatetimechangeSettime(NMHDR* pNMHDR, LRESULT* pResult)
{
- m_setTime.GetTime(&time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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( time );
+ CTime new_time( current_time );
new_time -= CTimeSpan( 0, 0, 5, 0 );
- new_time. GetAsSystemTime(time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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( time );
+ CTime new_time( current_time );
new_time -= CTimeSpan( 0, 0, 2, 0 );
- new_time. GetAsSystemTime(time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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( time );
+ CTime new_time( current_time );
new_time -= CTimeSpan( 0, 0, 1, 0 );
- new_time. GetAsSystemTime(time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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( time );
+ CTime new_time( current_time );
new_time += CTimeSpan( 0, 0, 1, 0 );
- new_time. GetAsSystemTime(time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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( time );
+ CTime new_time( current_time );
new_time += CTimeSpan( 0, 0, 2, 0 );
- new_time. GetAsSystemTime(time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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( time );
+ CTime new_time( current_time );
new_time += CTimeSpan( 0, 0, 5, 0 );
- new_time. GetAsSystemTime(time);
- bus->SendMsg( "SetClock Time=%d:%d:%d", time.wHour, time.wMinute, time.wSecond );
- m_Time.Format("%02d:%02d:%02d", time.wHour, time.wMinute, time.wSecond);
+ 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,"Rejeu Files (*.rej)|*.rej|All Files (*.*)|*.*||");
+ 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() );