From: <sag...@us...> - 2014-08-18 12:57:04
|
Revision: 4207 http://sourceforge.net/p/modplug/code/4207 Author: saga-games Date: 2014-08-18 12:56:55 +0000 (Mon, 18 Aug 2014) Log Message: ----------- [Imp] Instrument tab: In the sample map editor, show faint red dots for notes that are already assigned to another sample (http://forum.openmpt.org/index.php?topic=4112.msg37495#msg37495) Modified Paths: -------------- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-08-16 16:12:00 UTC (rev 4206) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-08-18 12:56:55 UTC (rev 4207) @@ -1269,11 +1269,11 @@ } for(UINT i = 0; i < 2 * 12; i++) { - UINT b = 0; - if(i == note) b = 1; - else if(chord.notes[0] && i + 1 == chord.notes[0]) b = 1; - else if(chord.notes[1] && i + 1 == chord.notes[1]) b = 1; - else if(chord.notes[2] && i + 1 == chord.notes[2]) b = 1; + UINT b = CKeyboardControl::KEYFLAG_NORMAL; + if(i == note) b = CKeyboardControl::KEYFLAG_REDDOT; + else if(chord.notes[0] && i + 1 == chord.notes[0]) b = CKeyboardControl::KEYFLAG_REDDOT; + else if(chord.notes[1] && i + 1 == chord.notes[1]) b = CKeyboardControl::KEYFLAG_REDDOT; + else if(chord.notes[2] && i + 1 == chord.notes[2]) b = CKeyboardControl::KEYFLAG_REDDOT; m_Keyboard.SetFlags(i, b); } m_Keyboard.InvalidateRect(NULL, FALSE); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-08-16 16:12:00 UTC (rev 4206) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-08-18 12:56:55 UTC (rev 4207) @@ -634,14 +634,15 @@ CRect rcClient, rect; CPaintDC dc(this); HDC hdc = dc.m_hDC; - HBRUSH brushRed; + HBRUSH brushDot[2]; if (!m_nOctaves) m_nOctaves = 1; GetClientRect(&rcClient); rect = rcClient; oldpen = ::SelectObject(hdc, CMainFrame::penBlack); oldbrush = ::SelectObject(hdc, CMainFrame::brushWhite); - brushRed = ::CreateSolidBrush(RGB(0xFF, 0, 0)); + brushDot[0] = ::CreateSolidBrush(RGB(0xFF, 0, 0)); + brushDot[1] = ::CreateSolidBrush(RGB(0xFF, 0xC0, 0xC0)); // White notes for (UINT note=0; note<m_nOctaves*7; note++) { @@ -650,9 +651,9 @@ if (val == m_nSelection) ::SelectObject(hdc, CMainFrame::brushGray); dc.Rectangle(&rect); if (val == m_nSelection) ::SelectObject(hdc, CMainFrame::brushWhite); - if ((val < NOTE_MAX) && (KeyFlags[val])) + if (val < NOTE_MAX && KeyFlags[val] != KEYFLAG_NORMAL && KeyFlags[val] < KEYFLAG_MAX) { - ::SelectObject(hdc, brushRed); + ::SelectObject(hdc, brushDot[KeyFlags[val] - 1]); dc.Ellipse(rect.left+2, rect.bottom - (rect.right-rect.left) + 2, rect.right-2, rect.bottom-2); ::SelectObject(hdc, CMainFrame::brushWhite); } @@ -681,9 +682,9 @@ if (val == m_nSelection) ::SelectObject(hdc, CMainFrame::brushGray); dc.Rectangle(&rect); if (val == m_nSelection) ::SelectObject(hdc, CMainFrame::brushBlack); - if ((val < NOTE_MAX) && (KeyFlags[val])) + if (val < NOTE_MAX && KeyFlags[val] != KEYFLAG_NORMAL && KeyFlags[val] < KEYFLAG_MAX) { - ::SelectObject(hdc, brushRed); + ::SelectObject(hdc, brushDot[KeyFlags[val] - 1]); dc.Ellipse(rect.left, rect.bottom - (rect.right-rect.left), rect.right, rect.bottom); ::SelectObject(hdc, CMainFrame::brushBlack); } @@ -693,6 +694,10 @@ } if (oldpen) ::SelectObject(hdc, oldpen); if (oldbrush) ::SelectObject(hdc, oldbrush); + for(int i = 0; i < CountOf(brushDot); i++) + { + DeleteBrush(brushDot[i]); + } } @@ -937,7 +942,9 @@ { UINT nOld = m_Keyboard.GetFlags(iNote); UINT ndx = nBaseOctave*12+iNote; - UINT nNew = (KeyboardMap[ndx] == nSample) ? CKeyboardControl::KEYFLAG_REDDOT : CKeyboardControl::KEYFLAG_NORMAL; + UINT nNew = CKeyboardControl::KEYFLAG_NORMAL; + if(KeyboardMap[ndx] == nSample) nNew = CKeyboardControl::KEYFLAG_REDDOT; + else if(KeyboardMap[ndx] != 0) nNew = CKeyboardControl::KEYFLAG_BRIGHTDOT; if (nNew != nOld) { m_Keyboard.SetFlags(iNote, nNew); Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2014-08-16 16:12:00 UTC (rev 4206) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2014-08-18 12:56:55 UTC (rev 4207) @@ -141,6 +141,8 @@ { KEYFLAG_NORMAL=0, KEYFLAG_REDDOT, + KEYFLAG_BRIGHTDOT, + KEYFLAG_MAX }; protected: HWND m_hParent; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |