void CopySelection() { if (patternView.boxSelection.isSelecting) { patternView.boxSelection.FinalizeSelection(); } m_LastCopy = patternView.boxSelection.selection; m_CopyCol = m_LastCopy.startCol; m_CopyData = new int[m_LastCopy.lineDelta + 1, m_LastCopy.chnDelta + 1, SongData.SONG_DATA_COUNT]; if (patternView.boxSelection.hasSelection) { patternView.boxSelection.DoOperation((int line, int chn, int col) => { int data = songData.GetData(chn, line, col); line -= m_LastCopy.startLine; chn -= m_LastCopy.startChn; //data cols are absolute value try { m_CopyData[line, chn, col] = data; } catch (System.IndexOutOfRangeException) { Debug.Log("Index out of range at " + line + ", " + chn + ", " + col); } }, false); } else { m_CopyData[0, 0, 0] = patternView.GetDataAtSelection(); } }
void UpdateSelectionData() { m_Selection = new BoxSelectionRange( ); m_Selection.startLine = Mathf.Min(m_InitialSelection.row.line, m_LastSelection.row.line); m_Selection.endLine = Mathf.Max(m_InitialSelection.row.line, m_LastSelection.row.line); m_Selection.startChn = Mathf.Min(m_InitialSelection.row.channel, m_LastSelection.row.channel); m_Selection.endChn = Mathf.Max(m_InitialSelection.row.channel, m_LastSelection.row.channel); m_Selection.startCol = Mathf.Min(m_InitialSelection.col, m_LastSelection.col); m_Selection.endCol = Mathf.Max(m_InitialSelection.col, m_LastSelection.col); }