summaryrefslogtreecommitdiff
path: root/Bus/IvyProbe/IvyProbeDlg.cpp
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:11:08 +0000
committerfcolin2007-02-01 13:11:08 +0000
commitc54abf8b83e9f9188416f49a3c42c93c1f34b4a3 (patch)
tree91410ff0ef0fe95eacca7a47ee497307b515ed88 /Bus/IvyProbe/IvyProbeDlg.cpp
parentc3b5d14f51499c0a3261dbaafa9ebc8a74740d76 (diff)
downloadivy-cplusplus-c54abf8b83e9f9188416f49a3c42c93c1f34b4a3.zip
ivy-cplusplus-c54abf8b83e9f9188416f49a3c42c93c1f34b4a3.tar.gz
ivy-cplusplus-c54abf8b83e9f9188416f49a3c42c93c1f34b4a3.tar.bz2
ivy-cplusplus-c54abf8b83e9f9188416f49a3c42c93c1f34b4a3.tar.xz
Utilisateur : Fcolin Date : 9/08/06 Heure : 16:02 Archivé dans $/Bus/IvyProbe Commentaire: (vss 22)
Diffstat (limited to 'Bus/IvyProbe/IvyProbeDlg.cpp')
-rw-r--r--Bus/IvyProbe/IvyProbeDlg.cpp53
1 files changed, 50 insertions, 3 deletions
diff --git a/Bus/IvyProbe/IvyProbeDlg.cpp b/Bus/IvyProbe/IvyProbeDlg.cpp
index 3d0e7b2..ef7bff8 100644
--- a/Bus/IvyProbe/IvyProbeDlg.cpp
+++ b/Bus/IvyProbe/IvyProbeDlg.cpp
@@ -14,6 +14,8 @@
static char THIS_FILE[] = __FILE__;
#endif
+static char BASED_CODE szFilterMsg[] = "Ivy Messages Files (*.ivm)|*.ivm|Ivy Files (*.ivm;*.ivb;*.txt)|*.ivm;*.ivb;*.txt|All Files (*.*)|*.*||";
+static char BASED_CODE szFilterBind[] = "Ivy Bindings Files (*.ivb)|*.ivb|Ivy Files (*.ivm;*.ivb;*.txt)|*.ivm;*.ivb;*.txt|All Files (*.*)|*.*||";
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
@@ -70,6 +72,8 @@ BEGIN_MESSAGE_MAP(CIvyProbeDlg, MyDialog)
ON_COMMAND(FILE_LOAD, OnLoad)
ON_COMMAND(FILE_SAVE, OnSave)
//}}AFX_MSG_MAP
+ ON_COMMAND(ID_FILE_SAVEBINDINGS, &CIvyProbeDlg::OnFileSavebindings)
+ ON_COMMAND(ID_FILE_LOADBINDINGS, &CIvyProbeDlg::OnFileLoadbindings)
END_MESSAGE_MAP()
@@ -283,7 +287,8 @@ void CIvyProbeDlg::OnSend()
int count = bus->SendMsg( CONVSTR(buffer) );
if ( m_msg.FindStringExact(-1, buffer) == CB_ERR )
{
- m_msg.AddString( buffer );
+ //m_msg.AddString( buffer );
+ m_msg.InsertString( 0, buffer );
}
WriteMessage( "Sending %d message %s",count,CONVSTR(buffer) );
m_msg.Clear();
@@ -311,7 +316,7 @@ void CIvyProbeDlg::OnLoad()
// TODO ReadString doesn't existe
CString message;
- CFileDialog dialog( TRUE, TEXT("txt"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, TEXT("Ivy Messages Files (*.txt)"));
+ CFileDialog dialog( TRUE, TEXT("ivm"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilterMsg);
if ( dialog.DoModal() == IDOK )
{
CStdioFile file( dialog.GetPathName(), CFile::modeRead | CFile::typeText );
@@ -331,7 +336,7 @@ void CIvyProbeDlg::OnSave()
// TODO WriteString doesn't existe
CString message;
- CFileDialog dialog( FALSE, TEXT("txt") , NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, TEXT("Ivy Messages Files (*.txt)"));
+ CFileDialog dialog( FALSE, TEXT("ivm") , NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilterMsg);
if ( dialog.DoModal() == IDOK )
{
CStdioFile file( dialog.GetPathName(), CFile::modeCreate | CFile::modeWrite | CFile::typeText );
@@ -345,3 +350,45 @@ void CIvyProbeDlg::OnSave()
}
#endif
}
+
+void CIvyProbeDlg::OnFileLoadbindings()
+{
+#ifndef UNDER_CE
+ // TODO ReadString doesn't existe
+ CString message;
+
+ CFileDialog dialog( TRUE, TEXT("ivb"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilterBind);
+ if ( dialog.DoModal() == IDOK )
+ {
+ CStdioFile file( dialog.GetPathName(), CFile::modeRead | CFile::typeText );
+ m_expr.ResetContent();
+ while ( file.ReadString( message ))
+ {
+ m_expr.AddString( message );
+ bus->BindMsg( CONVSTR(message) , this );
+ }
+ file.Close();
+ }
+#endif
+}
+
+void CIvyProbeDlg::OnFileSavebindings()
+{
+#ifndef UNDER_CE
+ // TODO WriteString doesn't existe
+ CString message;
+
+ CFileDialog dialog( FALSE, TEXT("ivb") , NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilterBind);
+ if ( dialog.DoModal() == IDOK )
+ {
+ CStdioFile file( dialog.GetPathName(), CFile::modeCreate | CFile::modeWrite | CFile::typeText );
+ for (int i=0;i < m_expr.GetCount();i++)
+ {
+ m_expr.GetLBText( i, message );
+ file.WriteString(message + TEXT("\n"));
+ }
+ file.Close();
+
+ }
+#endif
+}