From: <sag...@us...> - 2015-03-28 01:04:42
|
Revision: 4907 http://sourceforge.net/p/modplug/code/4907 Author: saga-games Date: 2015-03-28 01:04:29 +0000 (Sat, 28 Mar 2015) Log Message: ----------- [Fix] Pattern tab: Can now also click on the first and last item of an order selection to remove the selection. [Mod] Pattern tab: Remove arbitrary limiting of the scrollbar to the first --- item in MOD/XM Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2015-03-27 15:18:21 UTC (rev 4906) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2015-03-28 01:04:29 UTC (rev 4907) @@ -39,7 +39,7 @@ //m_nScrollPos: The same as order //m_nScrollPos2nd: 2nd selection point if multiple orders are selected // (not neccessarily the higher order - GetCurSel() is taking care of that.) - ORDERINDEX m_nXScroll, m_nScrollPos, m_nScrollPos2nd, m_nDropPos; + ORDERINDEX m_nXScroll, m_nScrollPos, m_nScrollPos2nd, m_nDropPos, m_nMouseDownPos; ORDERINDEX m_nDragOrder; //To tell how many orders('orderboxes') to show at least //on both sides of current order(when updating orderslist position). Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2015-03-27 15:18:21 UTC (rev 4906) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2015-03-28 01:04:29 UTC (rev 4907) @@ -173,16 +173,7 @@ SCROLLINFO info; UINT nPage; - int nMax = 0; - if(!sndFile.GetModSpecifications().hasStopIndex) - { - // With MOD / XM, cut shown sequence to first '---' item... - nMax = sndFile.Order.GetLengthFirstEmpty(); - } else - { - // ...for S3M/IT/MPT, show sequence until the last used item. - nMax = sndFile.Order.GetLengthTailTrimmed(); - } + int nMax = sndFile.Order.GetLengthTailTrimmed(); GetScrollInfo(SB_HORZ, &info, SIF_PAGE|SIF_RANGE); info.fMask = SIF_PAGE|SIF_RANGE; @@ -377,7 +368,6 @@ BOOL COrderList::PreTranslateMessage(MSG *pMsg) //--------------------------------------------- { - //rewbs.customKeys: //handle Patterns View context keys that we want to take effect in the orderlist. if ((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) @@ -390,19 +380,16 @@ UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); - InputTargetContext ctx = (InputTargetContext)(kCtxCtrlOrderlist); - if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) + if (ih->KeyEvent(kCtxCtrlOrderlist, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. //HACK: masquerade as kCtxViewPatternsNote context until we implement appropriate // command propagation to kCtxCtrlOrderlist context. - ctx = (InputTargetContext)(kCtxViewPatternsNote); - if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) + if (ih->KeyEvent(kCtxViewPatternsNote, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. } - //end rewbs.customKeys return CWnd::PreTranslateMessage(pMsg); } @@ -617,8 +604,7 @@ CHAR s[128]; strcpy(s, ""); - // MOD orderlist always ends after first empty pattern - const ORDERINDEX nLength = (sndFile.GetType() & MOD_TYPE_MOD) ? sndFile.Order.GetLengthFirstEmpty() : sndFile.Order.GetLengthTailTrimmed(); + const ORDERINDEX nLength = sndFile.Order.GetLengthTailTrimmed(); if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_HEXDISPLAY) { @@ -805,10 +791,10 @@ } m_bDragging = !IsOrderInMargins(m_nScrollPos, oldXScroll) || !IsOrderInMargins(m_nScrollPos2nd, oldXScroll); + m_nMouseDownPos = nOrder; if(m_bDragging) { - m_nDragOrder = GetCurSel(true).firstOrd; - m_nDropPos = m_nDragOrder; + m_nDragOrder = m_nDropPos = GetCurSel(true).firstOrd; SetCapture(); } } @@ -835,7 +821,7 @@ if (rect.PtInRect(pt)) { ORDERINDEX n = GetOrderFromPoint(rect, pt); - if ((n != ORDERINDEX_INVALID) && (n == m_nDropPos)) + if (n != ORDERINDEX_INVALID && n == m_nDropPos && n != m_nMouseDownPos) { // drag multiple orders (not quite as easy...) OrdSelection selection = GetCurSel(false); @@ -880,16 +866,12 @@ } } else { - ORDERINDEX nOrder = GetOrderFromPoint(rect, pt); - OrdSelection selection = GetCurSel(false); - - // this should actually have equal signs but that breaks multiselect: nOrder >= selection.nOrdLo && nOrder <= section.nOrdHi - if(pt.y < rect.bottom && m_nScrollPos2nd != ORDERINDEX_INVALID && nOrder > selection.firstOrd && nOrder < selection.lastOrd) + if(pt.y < rect.bottom && n == m_nMouseDownPos && !copyOrders) { // Remove selection if we didn't drag anything but multiselect was active m_nScrollPos2nd = ORDERINDEX_INVALID; SetFocus(); - SetCurSel(GetOrderFromPoint(rect, pt)); + SetCurSel(n); } } } @@ -920,6 +902,7 @@ { if (n != ORDERINDEX_INVALID) { + m_nMouseDownPos = ORDERINDEX_INVALID; m_nDropPos = n; InvalidateRect(NULL, FALSE); SetCursor(CMainFrame::curDragging); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |