Skip to content

Commit 873de68

Browse files
committed
Prevent focus shifting with open instrument editor
- This fixes #350.
1 parent 98f9b46 commit 873de68

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Source/InstrumentEditDlg.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void CInstrumentEditDlg::ClearPanels()
165165
m_iInstrument = -1;
166166
}
167167

168-
void CInstrumentEditDlg::SetCurrentInstrument(int Index)
168+
void CInstrumentEditDlg::SetCurrentInstrument(int Index, bool Focus)
169169
{
170170
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
171171
std::shared_ptr<CInstrument> pInstrument = pDoc->GetInstrument(Index);
@@ -220,6 +220,7 @@ void CInstrumentEditDlg::SetCurrentInstrument(int Index)
220220
for (int i = 0; i < PANEL_COUNT; ++i) {
221221
if (m_pPanels[i] != NULL) {
222222
m_pPanels[i]->SelectInstrument(pInstrument);
223+
if (Focus) m_pPanels[i]->SetFocus();
223224
}
224225
}
225226

Source/InstrumentEditDlg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CInstrumentEditDlg : public CDialog
3434
virtual ~CInstrumentEditDlg();
3535

3636
void ChangeNoteState(int Note);
37-
void SetCurrentInstrument(int Index);
37+
void SetCurrentInstrument(int Index, bool Focus = true);
3838
float GetRefreshRate() const; // // //
3939
void SetRefreshRate(float Rate); // // //
4040
bool IsOpened() const;

Source/InstrumentEditorSeq.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ void CInstrumentEditorSeq::SelectInstrument(std::shared_ptr<CInstrument> pInst)
7575
SetDlgItemInt(IDC_SEQ_INDEX, m_pInstrument->GetSeqIndex(m_iSelectedSetting = Sel));
7676

7777
SelectSequence(m_pInstrument->GetSeqIndex(m_iSelectedSetting), m_iSelectedSetting);
78-
79-
SetFocus();
8078
}
8179

8280
void CInstrumentEditorSeq::SelectSequence(int Sequence, int Type)

Source/MainFrm.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,8 @@ void CMainFrame::SelectInstrument(int Index)
995995

996996
// Update instrument editor
997997
if (m_wndInstEdit.IsOpened())
998-
m_wndInstEdit.SetCurrentInstrument(Index);
998+
// Do not shift focus when selecting the instrument due to a instrument column edit
999+
m_wndInstEdit.SetCurrentInstrument(Index, false);
9991000
}
10001001
else {
10011002
// Remove selection

0 commit comments

Comments
 (0)