OSDN Git Service

Fixed the problem that the input to File1 or File2 comboboxes of the Patch Generator...
authorJun Tajima <56220423+tjmprm77@users.noreply.github.com>
Sun, 30 Aug 2020 05:57:50 +0000 (14:57 +0900)
committerJun Tajima <56220423+tjmprm77@users.noreply.github.com>
Sun, 30 Aug 2020 05:57:50 +0000 (14:57 +0900)
- When multiple items are registered in the internal item list of the CPatchDlg class, and the File1 or File2 comboboxes of the Patch Generator dialog is changed, do the following:
  - Clear the internal item list of the CPatchDlg class.
  - Clear the contents of the other combobox.

Src/PatchDlg.cpp
Src/PatchDlg.h

index 031cc61..622fb36 100644 (file)
@@ -78,6 +78,10 @@ BEGIN_MESSAGE_MAP(CPatchDlg, CTrDialog)
        ON_BN_CLICKED(IDC_DIFF_DEFAULTS, OnDefaultSettings)
        ON_CBN_SELCHANGE(IDC_DIFF_STYLE, OnSelchangeDiffStyle)
        ON_BN_CLICKED(IDC_DIFF_SWAPFILES, OnDiffSwapFiles)
+       ON_CBN_SELCHANGE(IDC_DIFF_FILE1, OnSelchangeFile1)
+       ON_CBN_SELCHANGE(IDC_DIFF_FILE2, OnSelchangeFile2)
+       ON_CBN_EDITCHANGE(IDC_DIFF_FILE1, OnEditchangeFile1)
+       ON_CBN_EDITCHANGE(IDC_DIFF_FILE2, OnEditchangeFile2)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -262,7 +266,14 @@ void CPatchDlg::OnDiffBrowseFile1()
 
        folder = m_file1;
        if (SelectFileOrFolder(GetSafeHwnd(), s, folder.c_str()))
+       {
                m_ctlFile1.SetWindowText(s.c_str());
+               if (m_fileList.size() > 1)
+               {
+                       m_ctlFile2.SetWindowText(_T(""));
+                       ClearItems();
+               }
+       }
 }
 
 /** 
@@ -275,7 +286,14 @@ void CPatchDlg::OnDiffBrowseFile2()
 
        folder = m_file2;
        if (SelectFileOrFolder(GetSafeHwnd(), s, folder.c_str()))
+       {
                m_ctlFile2.SetWindowText(s.c_str());
+               if (m_fileList.size() > 1)
+               {
+                       m_ctlFile1.SetWindowText(_T(""));
+                       ClearItems();
+               }
+       }
 }
 
 /** 
@@ -429,6 +447,43 @@ void CPatchDlg::OnDefaultSettings()
        UpdateSettings();
 }
 
+void CPatchDlg::OnSelchangeFile1()
+{
+       if (m_fileList.size() > 1)
+       {
+               m_ctlFile2.SetWindowText(_T(""));
+               ClearItems();
+       }
+}
+
+void CPatchDlg::OnSelchangeFile2()
+{
+       if (m_fileList.size() > 1)
+       {
+               m_ctlFile1.SetWindowText(_T(""));
+               ClearItems();
+       }
+}
+
+void CPatchDlg::OnEditchangeFile1()
+{
+       if (m_fileList.size() > 1)
+       {
+               m_ctlFile2.SetWindowText(_T(""));
+               ClearItems();
+       }
+}
+
+void CPatchDlg::OnEditchangeFile2()
+{
+       if (m_fileList.size() > 1)
+       {
+               m_ctlFile1.SetWindowText(_T(""));
+               ClearItems();
+       }
+}
+
+
 /**
  * @brief Swap sides.
  */
index 9961072..2b77ecf 100644 (file)
@@ -85,6 +85,10 @@ protected:
        afx_msg void OnSelchangeDiffStyle();
        afx_msg void OnDiffSwapFiles();
        afx_msg void OnDefaultSettings();
+       afx_msg void OnSelchangeFile1();
+       afx_msg void OnSelchangeFile2();
+       afx_msg void OnEditchangeFile1();
+       afx_msg void OnEditchangeFile2();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };