From: <sv...@op...> - 2024-10-27 12:14:26
|
Author: sagamusix Date: Sun Oct 27 13:14:11 2024 New Revision: 22000 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22000 Log: [Imp] Comments tab: Allow name label editing to be cancelled (what a boring commit 22000 \o/) Modified: trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/mptrack/view_com.h Modified: trunk/OpenMPT/mptrack/view_com.cpp ============================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp Sun Oct 27 12:01:51 2024 (r21999) +++ trunk/OpenMPT/mptrack/view_com.cpp Sun Oct 27 13:14:11 2024 (r22000) @@ -275,6 +275,13 @@ { if(pMsg) { + if(m_editLabel && pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) + { + m_editLabel = false; + m_ItemList.CancelEditLabel(); + return TRUE; + } + if((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) { @@ -568,6 +575,7 @@ CEdit *editCtrl = m_ItemList.GetEditControl(); if(editCtrl) { + m_editLabel = true; const CModSpecifications &specs = GetDocument()->GetSoundFile().GetModSpecifications(); const auto maxStrLen = (m_nListId == IDC_LIST_SAMPLES) ? specs.sampleNameLengthMax : specs.instrNameLengthMax; editCtrl->LimitText(maxStrLen); @@ -576,9 +584,16 @@ } -void CViewComments::OnEndLabelEdit(LPNMHDR pnmhdr, LRESULT *) +void CViewComments::OnEndLabelEdit(LPNMHDR pnmhdr, LRESULT *result) { CMainFrame::GetInputHandler()->Bypass(false); + if(!m_editLabel) + { + *result = FALSE; + return; + } + m_editLabel = false; + LV_DISPINFO &lvDispInfo = *reinterpret_cast<LV_DISPINFO *>(pnmhdr); LV_ITEM &lvItem = lvDispInfo.item; CModDoc *pModDoc = GetDocument(); Modified: trunk/OpenMPT/mptrack/view_com.h ============================================================================== --- trunk/OpenMPT/mptrack/view_com.h Sun Oct 27 12:01:51 2024 (r21999) +++ trunk/OpenMPT/mptrack/view_com.h Sun Oct 27 13:14:11 2024 (r22000) @@ -34,6 +34,7 @@ ModCommand::NOTE m_lastNote = NOTE_NONE; CHANNELINDEX m_noteChannel = CHANNELINDEX_INVALID; INSTRUMENTINDEX m_noteInstr = INSTRUMENTINDEX_INVALID; + bool m_editLabel = false; public: void RecalcLayout(); |