summaryrefslogtreecommitdiff
path: root/Bus/IvyProbe/IvyProbeDlg.cpp
diff options
context:
space:
mode:
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
+}