summaryrefslogtreecommitdiff
path: root/common/mainwnd.cpp
diff options
context:
space:
mode:
authorleo2005-06-02 21:14:41 +0000
committerleo2005-06-02 21:14:41 +0000
commit5d792b4cea12eaf00af8183d30eae2e8b976bbbc (patch)
tree051a3ec4af1df915410523e71b714fa83f188b86 /common/mainwnd.cpp
parent05bf8a4a73b090ca8776a69e32cccf7975c4b42f (diff)
Fixed a bug with the recent file list.
git-svn-id: http://svn.leocad.org/trunk@397 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/mainwnd.cpp')
-rw-r--r--common/mainwnd.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/common/mainwnd.cpp b/common/mainwnd.cpp
index 69e438c..6c644cd 100644
--- a/common/mainwnd.cpp
+++ b/common/mainwnd.cpp
@@ -71,24 +71,27 @@ void MainWnd::UpdateMRU ()
#endif
}
-void MainWnd::AddToMRU (const char *filename)
+void MainWnd::AddToMRU(const char* Filename)
{
- // update the MRU list, if an existing MRU string matches file name
- int i;
+ // Make a copy of the string in case we're loading a file from the MRU menu.
+ String str = Filename;
+ int i;
- for (i = 0; i < (LC_MRU_MAX - 1); i++)
- if (m_strMRU[i] == filename)
- break;
+ // Search for Filename in the MRU list.
+ for (i = 0; i < (LC_MRU_MAX - 1); i++)
+ if (m_strMRU[i] == Filename)
+ break;
- // move MRU strings before this one down
- for (; i > 0; i--)
- m_strMRU[i] = m_strMRU[i-1];
- m_strMRU[0] = filename;
+ // Move MRU strings before this one down.
+ for (; i > 0; i--)
+ m_strMRU[i] = m_strMRU[i-1];
- UpdateMRU ();
+ m_strMRU[0] = str;
+
+ UpdateMRU();
}
-void MainWnd::RemoveFromMRU (int index)
+void MainWnd::RemoveFromMRU(int index)
{
for (int i = index; i < (LC_MRU_MAX - 1); i++)
m_strMRU[i] = m_strMRU[i+1];