From: <sv...@op...> - 2024-11-09 13:43:51
|
Author: sagamusix Date: Sat Nov 9 14:43:39 2024 New Revision: 22119 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22119 Log: [Imp] Instrument tab: Add tooltip when instrument mode is disabled. Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp Fri Nov 8 23:28:31 2024 (r22118) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp Sat Nov 9 14:43:39 2024 (r22119) @@ -1744,13 +1744,20 @@ //Note: pszText points to a TCHAR array of length 256 (see CChildFrame::OnToolTipText). //Note2: If there's problems in getting tooltips showing for certain tools, // setting the tab order may have effect. - ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; - - if(pIns == nullptr) return FALSE; if ((pszText) && (uId)) { CWnd *wnd = GetDlgItem(uId); bool isEnabled = wnd != nullptr && wnd->IsWindowEnabled() != FALSE; + if(!isEnabled && !m_sndFile.GetNumInstruments()) + { + _tcscpy(pszText, _T("Create a new instrument to enable instrument mode.")); + return TRUE; + } + + ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; + if(pIns == nullptr) + return FALSE; + const auto plusMinus = mpt::ToWin(mpt::Charset::UTF8, "\xC2\xB1"); const TCHAR *s = nullptr; CommandID cmd = kcNull; |