Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the "Go to" dialog. #1779

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Src/MergeEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,7 @@ void CMergeEditView::OnWMGoto()
dlg.m_strParam = strutils::to_str(nRealLine + 1);
dlg.m_nFile = (pDoc->m_nBuffers < 3) ? (m_nThisPane == 1 ? 2 : 0) : m_nThisPane;
dlg.m_nGotoWhat = 0;
dlg.m_nFiles = pDoc->m_nBuffers;

if (dlg.DoModal() == IDOK)
{
Expand Down
18 changes: 17 additions & 1 deletion Src/WMGotoDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class WMGotoDlg::Impl : public CTrDialog
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(WMGotoDlg)
protected:
virtual BOOL OnInitDialog() override;
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

Expand Down Expand Up @@ -62,6 +63,21 @@ WMGotoDlg::Impl::Impl(WMGotoDlg *p, CWnd* pParent /*= nullptr*/)
{
}

/**
* @brief Initialize the dialog.
* @return Always TRUE.
*/
BOOL WMGotoDlg::Impl::OnInitDialog()
{
LangTranslateDialog(m_hWnd);
CDialog::OnInitDialog();

if (m_p->m_nFiles < 3)
EnableDlgItem(IDC_WMGOTO_FILEMIDDLE, false);

return TRUE;
}

void WMGotoDlg::Impl::DoDataExchange(CDataExchange* pDX)
{
CTrDialog::DoDataExchange(pDX);
Expand All @@ -85,7 +101,7 @@ END_MESSAGE_MAP()


WMGotoDlg::WMGotoDlg()
: m_pimpl(new WMGotoDlg::Impl(this)), m_nFile(-1), m_nGotoWhat(-1) {}
: m_pimpl(new WMGotoDlg::Impl(this)), m_nFile(-1), m_nGotoWhat(-1), m_nFiles(-1) {}
WMGotoDlg::~WMGotoDlg() = default;
int WMGotoDlg::DoModal() { return static_cast<int>(m_pimpl->DoModal()); }

1 change: 1 addition & 0 deletions Src/WMGotoDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class WMGotoDlg
String m_strParam; /**< Line/difference number. */
int m_nFile; /**< Target file number. */
int m_nGotoWhat; /**< Goto line or difference? */
int m_nFiles; /**< Number of files being compared. */
private:
WMGotoDlg(const WMGotoDlg &) = delete;
WMGotoDlg & operator=(const WMGotoDlg &) = delete;
Expand Down