Studijní materiály
Detail souboru
Zdrojový kód
From 02ea1cb1bfb13304bea209626b99ecdeebd95584 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 11 Mar 2009 00:06:10 +0100
Subject: [PATCH] make possible to reload opened file
---
CESim.cpp | 12 ++++++++++++
CESim.h | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/CESim.cpp b/CESim.cpp
index 38b52a0..82c0e86 100644
--- a/CESim.cpp
+++ b/CESim.cpp
@@ -56,6 +56,7 @@ void _WriteOutError(int list,LPCTSTR str)
BEGIN_MESSAGE_MAP(CCESimApp, CWinApp)
//{{AFX_MSG_MAP(CCESimApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
+ ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
@@ -189,3 +190,14 @@ void CCESimApp::OnAppAbout()
/////////////////////////////////////////////////////////////////////////////
// CCESimApp message handlers
+void CCESimApp::OnFileOpen()
+{
+ CString fileName;
+ if (!CWinApp::DoPromptFileName(fileName, AFX_IDS_OPENFILE,
+ OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, TRUE, NULL))
+ return;
+
+ CWinApp::OnFileNew();
+ AfxGetApp()->OpenDocumentFile(fileName);
+}
+
diff --git a/CESim.h b/CESim.h
index 288b306..209eef3 100644
--- a/CESim.h
+++ b/CESim.h
@@ -52,6 +52,7 @@ public:
// Implementation
//{{AFX_MSG(CCESimApp)
afx_msg void OnAppAbout();
+ afx_msg void OnFileOpen();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
--
1.6.1.2