From: <rel...@us...> - 2009-12-23 13:43:38
|
Revision: 448 http://modplug.svn.sourceforge.net/modplug/?rev=448&view=rev Author: relabsoluness Date: 2009-12-23 13:43:29 +0000 (Wed, 23 Dec 2009) Log Message: ----------- [Fix] GUI: Shift key erroneously opened MIDI mapping dialog in some cases (appeared in rev. 344). [Fix] GUI: Multiselection was partly broken in load dialogs (appeared in rev. 444). [Fix] Orderlist: Follow song keyshortcut didn't work in this context (appeared in rev. 424). Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Vstplug.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-21 18:56:25 UTC (rev 447) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-23 13:43:29 UTC (rev 448) @@ -421,7 +421,8 @@ return wParam; case kcChangeLoopStatus: m_pParent->OnModCtrlMsg(CTRLMSG_PAT_LOOP, -1); return wParam; - case kcToggleFollowSong: m_pParent->OnFollowSong(); return wParam; + case kcToggleFollowSong: + m_pParent->OnModCtrlMsg(CTRLMSG_PAT_FOLLOWSONG, 0); return wParam; case kcChannelUnmuteAll: case kcUnmuteAllChnOnPatTransition: @@ -1047,8 +1048,6 @@ AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("Create new sequence")); if (pSndFile->Order.GetNumSequences() > 1) AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("Delete current sequence")); - - ::DestroyMenu(menuSequence); } } AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-12-21 18:56:25 UTC (rev 447) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-12-23 13:43:29 UTC (rev 448) @@ -3307,11 +3307,14 @@ if(filterIndex != nullptr) dlg.m_ofn.nFilterIndex = (DWORD)(*filterIndex); - // TODO is this necessary? Apparently not! - /*const size_t bufferSize = 2048; //Note: This is possibly the maximum buffer size in MFC 7(this note was written November 2006). - vector<char> filenameBuffer(bufferSize, 0); - dlg.GetOFN().lpstrFile = &filenameBuffer[0]; - dlg.GetOFN().nMaxFile = bufferSize;*/ + vector<TCHAR> filenameBuffer; + if (allowMultiSelect) + { + const size_t bufferSize = 2048; // Note: This is possibly the maximum buffer size in MFC 7(this note was written November 2006). + filenameBuffer.resize(bufferSize, 0); + dlg.GetOFN().lpstrFile = &filenameBuffer[0]; + dlg.GetOFN().nMaxFile = bufferSize; + } // Do it! CMainFrame::GetInputHandler()->Bypass(true); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2009-12-21 18:56:25 UTC (rev 447) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2009-12-23 13:43:29 UTC (rev 448) @@ -669,7 +669,7 @@ pModDoc->RecordParamChange(pVstPlugin->GetSlot(), index); } - if (CMainFrame::GetInputHandler()->ShiftPressed()) + if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && pVstPlugin->GetEditor()->m_hWnd) { CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once. CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-01-02 01:23:26
|
Revision: 453 http://modplug.svn.sourceforge.net/modplug/?rev=453&view=rev Author: saga-games Date: 2010-01-02 01:23:14 +0000 (Sat, 02 Jan 2010) Log Message: ----------- [New] Instrument Editor: Envelopes can be edited using keyboard. Various keyboard shortcuts have been added to move and edit envelope points. This uses a common "drag and drop" node with mouse editing, so a point can first be clicked and the be moved with f.e. cursor keys. [Mod] Made Graph and Pattern Randomizer shortcuts invisible. [Ref] Some more internal refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/res/smptoolb.bmp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-01-02 01:23:14 UTC (rev 453) @@ -2219,7 +2219,7 @@ commands[kcPatternGoto].isDummy = false; commands[kcPatternOpenRandomizer].UID = 1767; - commands[kcPatternOpenRandomizer].isHidden = false; + commands[kcPatternOpenRandomizer].isHidden = true; // while there's not randomizer yet, let's just disable it for now commands[kcPatternOpenRandomizer].isDummy = false; commands[kcPatternOpenRandomizer].Message = "Open pattern randomizer"; @@ -2230,7 +2230,7 @@ //rewbs.graph commands[kcViewGraph].UID = 1769; - commands[kcViewGraph].isHidden = false; + commands[kcViewGraph].isHidden = true; // while there's no graph yet, let's just disable it for now commands[kcViewGraph].isDummy = false; commands[kcViewGraph].Message = "View Graph"; //end rewbs.graph @@ -2485,6 +2485,81 @@ commands[kcEditPushForwardPaste].isDummy = false; commands[kcEditPushForwardPaste].Message = "Push Forward Paste"; + commands[kcInstrumentEnvelopePointMoveLeft].UID = 1821; + commands[kcInstrumentEnvelopePointMoveLeft].isHidden = false; + commands[kcInstrumentEnvelopePointMoveLeft].isDummy = false; + commands[kcInstrumentEnvelopePointMoveLeft].Message = "Move envelope point left"; + + commands[kcInstrumentEnvelopePointMoveRight].UID = 1822; + commands[kcInstrumentEnvelopePointMoveRight].isHidden = false; + commands[kcInstrumentEnvelopePointMoveRight].isDummy = false; + commands[kcInstrumentEnvelopePointMoveRight].Message = "Move envelope point right"; + + commands[kcInstrumentEnvelopePointMoveUp].UID = 1823; + commands[kcInstrumentEnvelopePointMoveUp].isHidden = false; + commands[kcInstrumentEnvelopePointMoveUp].isDummy = false; + commands[kcInstrumentEnvelopePointMoveUp].Message = "Move envelope point up"; + + commands[kcInstrumentEnvelopePointMoveDown].UID = 1824; + commands[kcInstrumentEnvelopePointMoveDown].isHidden = false; + commands[kcInstrumentEnvelopePointMoveDown].isDummy = false; + commands[kcInstrumentEnvelopePointMoveDown].Message = "Move envelope point down"; + + commands[kcInstrumentEnvelopePointPrev].UID = 1825; + commands[kcInstrumentEnvelopePointPrev].isHidden = false; + commands[kcInstrumentEnvelopePointPrev].isDummy = false; + commands[kcInstrumentEnvelopePointPrev].Message = "Select previous envelope point"; + + commands[kcInstrumentEnvelopePointNext].UID = 1826; + commands[kcInstrumentEnvelopePointNext].isHidden = false; + commands[kcInstrumentEnvelopePointNext].isDummy = false; + commands[kcInstrumentEnvelopePointNext].Message = "Select next envelope point"; + + commands[kcInstrumentEnvelopePointInsert].UID = 1827; + commands[kcInstrumentEnvelopePointInsert].isHidden = false; + commands[kcInstrumentEnvelopePointInsert].isDummy = false; + commands[kcInstrumentEnvelopePointInsert].Message = "Insert envelope point"; + + commands[kcInstrumentEnvelopePointRemove].UID = 1828; + commands[kcInstrumentEnvelopePointRemove].isHidden = false; + commands[kcInstrumentEnvelopePointRemove].isDummy = false; + commands[kcInstrumentEnvelopePointRemove].Message = "Remove envelope point"; + + commands[kcInstrumentEnvelopeSetLoopStart].UID = 1829; + commands[kcInstrumentEnvelopeSetLoopStart].isHidden = false; + commands[kcInstrumentEnvelopeSetLoopStart].isDummy = false; + commands[kcInstrumentEnvelopeSetLoopStart].Message = "Set loop start"; + + commands[kcInstrumentEnvelopeSetLoopEnd].UID = 1830; + commands[kcInstrumentEnvelopeSetLoopEnd].isHidden = false; + commands[kcInstrumentEnvelopeSetLoopEnd].isDummy = false; + commands[kcInstrumentEnvelopeSetLoopEnd].Message = "Set loop end"; + + commands[kcInstrumentEnvelopeSetSustainLoopStart].UID = 1831; + commands[kcInstrumentEnvelopeSetSustainLoopStart].isHidden = false; + commands[kcInstrumentEnvelopeSetSustainLoopStart].isDummy = false; + commands[kcInstrumentEnvelopeSetSustainLoopStart].Message = "Set sustain loop start"; + + commands[kcInstrumentEnvelopeSetSustainLoopEnd].UID = 1832; + commands[kcInstrumentEnvelopeSetSustainLoopEnd].isHidden = false; + commands[kcInstrumentEnvelopeSetSustainLoopEnd].isDummy = false; + commands[kcInstrumentEnvelopeSetSustainLoopEnd].Message = "Set sustain loop end"; + + commands[kcInstrumentEnvelopeToggleReleaseNode].UID = 1833; + commands[kcInstrumentEnvelopeToggleReleaseNode].isHidden = false; + commands[kcInstrumentEnvelopeToggleReleaseNode].isDummy = false; + commands[kcInstrumentEnvelopeToggleReleaseNode].Message = "Toggle release node"; + + commands[kcInstrumentEnvelopePointMoveUp8].UID = 1834; + commands[kcInstrumentEnvelopePointMoveUp8].isHidden = false; + commands[kcInstrumentEnvelopePointMoveUp8].isDummy = false; + commands[kcInstrumentEnvelopePointMoveUp8].Message = "Move envelope point up (big step)"; + + commands[kcInstrumentEnvelopePointMoveDown8].UID = 1835; + commands[kcInstrumentEnvelopePointMoveDown8].isHidden = false; + commands[kcInstrumentEnvelopePointMoveDown8].isDummy = false; + commands[kcInstrumentEnvelopePointMoveDown8].Message = "Move envelope point down (big step)"; + #ifdef _DEBUG for (int i=0; i<kcNumCommands; i++) { if (commands[i].UID != 0) { // ignore unset UIDs Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-01-02 01:23:14 UTC (rev 453) @@ -549,7 +549,22 @@ kcInstrumentLoad=kcStartInstrumentMisc, kcInstrumentSave, kcInstrumentNew, - kcEndInstrumentMisc=kcInstrumentNew, + kcInstrumentEnvelopePointPrev, + kcInstrumentEnvelopePointNext, + kcInstrumentEnvelopePointMoveLeft, + kcInstrumentEnvelopePointMoveRight, + kcInstrumentEnvelopePointMoveUp, + kcInstrumentEnvelopePointMoveUp8, + kcInstrumentEnvelopePointMoveDown, + kcInstrumentEnvelopePointMoveDown8, + kcInstrumentEnvelopePointInsert, + kcInstrumentEnvelopePointRemove, + kcInstrumentEnvelopeSetLoopStart, + kcInstrumentEnvelopeSetLoopEnd, + kcInstrumentEnvelopeSetSustainLoopStart, + kcInstrumentEnvelopeSetSustainLoopEnd, + kcInstrumentEnvelopeToggleReleaseNode, + kcEndInstrumentMisc=kcInstrumentEnvelopeToggleReleaseNode, kcStartInstrumentCtrlMisc, kcInstrumentCtrlLoad=kcStartInstrumentCtrlMisc, Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2010-01-02 01:23:14 UTC (rev 453) @@ -308,7 +308,9 @@ commandCategories.Add(*newCat); delete newCat; - newCat = new CommandCategory(" Instrument [Bottom]", kCtxViewInstruments); + newCat = new CommandCategory(" Instrument Editor", kCtxViewInstruments); + for (int c=kcStartInstrumentMisc; c<=kcEndInstrumentMisc; c++) + newCat->commands.Add(c); commandCategories.Add(*newCat); delete newCat; Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-01-02 01:23:14 UTC (rev 453) @@ -286,6 +286,42 @@ }; +// Sample editor toolbar image list index +enum +{ + SIMAGE_CHECKED = 0, + SIMAGE_ZOOMUP, + SIMAGE_ZOOMDOWN, + SIMAGE_NODRAW, + SIMAGE_DRAW, + SIMAGE_RESIZE, + SIMAGE_GENERATE, +}; + + +// Instrument editor toolbar image list index +enum +{ + IIMAGE_CHECKED = 0, + IIMAGE_VOLENV, + IIMAGE_PANENV, + IIMAGE_PITCHENV, + IIMAGE_NOPITCHENV, + IIMAGE_LOOP, + IIMAGE_SUSTAIN, + IIMAGE_CARRY, + IIMAGE_NOCARRY, + IIMAGE_VOLSWITCH, + IIMAGE_PANSWITCH, + IIMAGE_PITCHSWITCH, + IIMAGE_FILTERSWITCH, + IIMAGE_NOPITCHSWITCH, + IIMAGE_NOFILTERSWITCH, + IIMAGE_SAMPLEMAP, + IIMAGE_GRID, +}; + + ///////////////////////////////////////////////////////////////////////// // Player position notification Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-02 01:23:14 UTC (rev 453) @@ -13,10 +13,10 @@ #include "midi.h" #define ENV_ZOOM 4 -#define ENV_DRAGLOOPSTART 0x100 -#define ENV_DRAGLOOPEND 0x200 -#define ENV_DRAGSUSTAINSTART 0x400 -#define ENV_DRAGSUSTAINEND 0x800 +#define ENV_DRAGLOOPSTART (MAX_ENVPOINTS + 1) +#define ENV_DRAGLOOPEND (MAX_ENVPOINTS + 2) +#define ENV_DRAGSUSTAINSTART (MAX_ENVPOINTS + 3) +#define ENV_DRAGSUSTAINEND (MAX_ENVPOINTS + 4) // Non-client toolbar #define ENV_LEFTBAR_CY 29 @@ -117,6 +117,7 @@ m_GridSpeed = -1; m_GridScrollPos = -1; //end rewbs.envRowGrid + m_nDragItem = 1; } @@ -492,6 +493,23 @@ } +bool CViewInstrument::EnvToggleReleaseNode(int nPoint) +//---------------------------------------------------- +{ + INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); + if(envelope == nullptr) return false; + if(nPoint < 1 || nPoint > (int)EnvGetLastPoint()) return false; + + if (envelope->nReleaseNode == nPoint) + { + envelope->nReleaseNode = ENV_RELEASE_NODE_UNSET; + } else + { + envelope->nReleaseNode = static_cast<BYTE>(nPoint); + } + return true; +} + // Enable or disable a flag of the current envelope bool CViewInstrument::EnvSetFlag(const DWORD dwFlag, const bool bEnable) const //---------------------------------------------------------------------------- @@ -762,7 +780,7 @@ //rewbs.envRowGrid void CViewInstrument::DrawGrid(CDC *pDC, UINT speed) -//-------------------------------------------------------------------- +//-------------------------------------------------- { int cachedScrollPos = GetScrollPos(SB_HORZ); bool windowResized = false; @@ -904,15 +922,23 @@ rect.top = y - 3; rect.right = x + 4; rect.bottom = y + 4; - if (i) { + if (i) + { m_dcMemMain.LineTo(x, y); - } else { + } else + { m_dcMemMain.MoveTo(x, y); } - if (i == releaseNode) { + if (i == releaseNode) + { m_dcMemMain.FrameRect(&rect, CBrush::FromHandle(CMainFrame::brushHighLightRed)); m_dcMemMain.SelectObject(CMainFrame::penEnvelopeHighlight); - } else { + } else if (i == m_nDragItem - 1) + { + // currently selected env point + m_dcMemMain.FrameRect(&rect, CBrush::FromHandle(CMainFrame::brushGray)); + } else + { m_dcMemMain.FrameRect(&rect, CBrush::FromHandle(CMainFrame::brushWhite)); } @@ -959,11 +985,11 @@ return envelope->Ticks[EnvGetReleaseNode()]; } -bool CViewInstrument::EnvRemovePoint() -//------------------------------------ +bool CViewInstrument::EnvRemovePoint(UINT nPoint) +//--------------------------------------------- { CModDoc *pModDoc = GetDocument(); - if ((pModDoc) && (m_nDragItem) && (m_nDragItem-1 <= EnvGetLastPoint())) + if ((pModDoc) && (nPoint <= EnvGetLastPoint())) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; @@ -972,22 +998,28 @@ INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); if(envelope == nullptr || envelope->nNodes == 0) return false; - UINT nPoint = m_nDragItem - 1; - envelope->nNodes--; - for (UINT i=nPoint; i<envelope->nNodes; i++) + for (UINT i = nPoint; i < envelope->nNodes; i++) { envelope->Ticks[i] = envelope->Ticks[i + 1]; envelope->Values[i] = envelope->Values[i + 1]; } - if (nPoint >= envelope->nNodes) nPoint = envelope->nNodes-1; + if (nPoint >= envelope->nNodes) nPoint = envelope->nNodes - 1; if (envelope->nLoopStart > nPoint) envelope->nLoopStart--; if (envelope->nLoopEnd > nPoint) envelope->nLoopEnd--; if (envelope->nSustainStart > nPoint) envelope->nSustainStart--; if (envelope->nSustainEnd > nPoint) envelope->nSustainEnd--; - if (envelope->nReleaseNode>nPoint && envelope->nReleaseNode!=ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode--; + if (envelope->nReleaseNode>nPoint && envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode--; envelope->Ticks[0] = 0; + if(envelope->nNodes == 1) + { + // if only one node is left, just disable the envelope completely + envelope->nNodes = envelope->nLoopStart = envelope->nLoopEnd = envelope->nSustainStart = envelope->nSustainEnd = 0; + envelope->dwFlags = 0; + envelope->nReleaseNode = ENV_RELEASE_NODE_UNSET; + } + pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); return true; @@ -997,8 +1029,8 @@ } // Insert point. Returns 0 if error occured, else point ID + 1. -UINT CViewInstrument::EnvInsertPoint() -//------------------------------------ +UINT CViewInstrument::EnvInsertPoint(int nTick, int nValue) +//--------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); if (pModDoc) @@ -1007,14 +1039,12 @@ MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; if (pIns) { - int nTick = ScreenToTick(m_ptMenu.x); - int nValue = ScreenToValue(m_ptMenu.y); - if(nTick < 0) return false; + if(nTick < 0) return 0; nValue = CLAMP(nValue, 0, 64); INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); - if(envelope == nullptr) return false; + if(envelope == nullptr) return 0; BYTE cDefaultValue; switch(m_nEnv) @@ -1029,7 +1059,7 @@ cDefaultValue = (pIns->PitchEnv.dwFlags & ENV_FILTER) ? 64 : 32; break; default: - return false; + return 0; } if (envelope->nNodes < pSndFile->GetModSpecifications().envelopePointsMax) @@ -1180,18 +1210,18 @@ } switch(cLeftBarButtons[nBtn]) { - case ID_ENVSEL_VOLUME: nImage = 1; break; - case ID_ENVSEL_PANNING: nImage = 2; break; - case ID_ENVSEL_PITCH: nImage = (dwStyle & NCBTNS_DISABLED) ? 4 : 3; break; - case ID_ENVELOPE_SETLOOP: nImage = 5; break; - case ID_ENVELOPE_SUSTAIN: nImage = 6; break; - case ID_ENVELOPE_CARRY: nImage = (dwStyle & NCBTNS_DISABLED) ? 8 : 7; break; - case ID_ENVELOPE_VOLUME: nImage = 9; break; - case ID_ENVELOPE_PANNING: nImage = 10; break; - case ID_ENVELOPE_PITCH: nImage = (dwStyle & NCBTNS_DISABLED) ? 13 : 11; break; - case ID_ENVELOPE_FILTER: nImage = (dwStyle & NCBTNS_DISABLED) ? 14 : 12; break; - case ID_INSTRUMENT_SAMPLEMAP: nImage = 15; break; - case ID_ENVELOPE_VIEWGRID: nImage = 16; break; + case ID_ENVSEL_VOLUME: nImage = IIMAGE_VOLENV; break; + case ID_ENVSEL_PANNING: nImage = IIMAGE_PANENV; break; + case ID_ENVSEL_PITCH: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOPITCHENV : IIMAGE_PITCHENV; break; + case ID_ENVELOPE_SETLOOP: nImage = IIMAGE_LOOP; break; + case ID_ENVELOPE_SUSTAIN: nImage = IIMAGE_SUSTAIN; break; + case ID_ENVELOPE_CARRY: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOCARRY : IIMAGE_CARRY; break; + case ID_ENVELOPE_VOLUME: nImage = IIMAGE_VOLSWITCH; break; + case ID_ENVELOPE_PANNING: nImage = IIMAGE_PANSWITCH; break; + case ID_ENVELOPE_PITCH: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOPITCHSWITCH : IIMAGE_PITCHSWITCH; break; + case ID_ENVELOPE_FILTER: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOFILTERSWITCH : IIMAGE_FILTERSWITCH; break; + case ID_INSTRUMENT_SAMPLEMAP: nImage = IIMAGE_SAMPLEMAP; break; + case ID_ENVELOPE_VIEWGRID: nImage = IIMAGE_GRID; break; } pDC->Draw3dRect(rect.left-1, rect.top-1, ENV_LEFTBAR_CXBTN+2, ENV_LEFTBAR_CYBTN+2, c3, c4); pDC->Draw3dRect(rect.left, rect.top, ENV_LEFTBAR_CXBTN, ENV_LEFTBAR_CYBTN, c1, c2); @@ -1199,7 +1229,7 @@ pDC->FillSolidRect(&rect, crFc); rect.left += xofs; rect.top += yofs; - if (dwStyle & NCBTNS_CHECKED) m_bmpEnvBar.Draw(pDC, 0, rect.TopLeft(), ILD_NORMAL); + if (dwStyle & NCBTNS_CHECKED) m_bmpEnvBar.Draw(pDC, IIMAGE_CHECKED, rect.TopLeft(), ILD_NORMAL); m_bmpEnvBar.Draw(pDC, nImage, rect.TopLeft(), ILD_NORMAL); } else { @@ -1406,9 +1436,9 @@ { BOOL bChanged = FALSE; if (pt.x >= m_rcClient.right - 2) nTick++; - if (m_nDragItem < 0x100) + if (m_nDragItem <= MAX_ENVPOINTS) { - bChanged = EnvSetValue(m_nDragItem-1, nTick, nVal); + bChanged = EnvSetValue(m_nDragItem - 1, nTick, nVal); } else { int nPoint = ScreenToPoint(pt.x, pt.y); @@ -1517,14 +1547,14 @@ // Look if dragging a point UINT maxpoint = EnvGetLastPoint(); m_nDragItem = 0; - for (UINT i=0; i<=maxpoint; i++) + for (UINT i = 0; i <= maxpoint; i++) { int x = PointToScreen(i); int y = ValueToScreen(EnvGetValue(i)); rect.SetRect(x-6, y-6, x+7, y+7); if (rect.PtInRect(pt)) { - m_nDragItem = i+1; + m_nDragItem = i + 1; break; } } @@ -1552,7 +1582,7 @@ rect.top = m_rcClient.top; rect.bottom = m_rcClient.bottom; rect.right = PointToScreen(EnvGetLoopStart()) + 1; - rect.left = rect.right - ENV_ZOOM*2; + rect.left = rect.right - ENV_ZOOM * 2; if (rect.PtInRect(pt)) { m_nDragItem = ENV_DRAGLOOPSTART; @@ -1573,8 +1603,7 @@ // Shift-Click: Insert envelope point here if(CMainFrame::GetMainFrame()->GetInputHandler()->ShiftPressed()) { - m_ptMenu = pt; - m_nDragItem = EnvInsertPoint(); // returns point ID + 1 if successful, else 0. + m_nDragItem = EnvInsertPoint(ScreenToTick(pt.x), ScreenToValue(pt.y)); // returns point ID + 1 if successful, else 0. if(m_nDragItem > 0) { // Drag point if successful @@ -1619,13 +1648,13 @@ UINT lastpoint = EnvGetLastPoint(); m_nDragItem = ScreenToPoint(pt.x, pt.y) + 1; pSubMenu->EnableMenuItem(ID_ENVELOPE_INSERTPOINT, (lastpoint < maxpoint) ? MF_ENABLED : MF_GRAYED); - pSubMenu->EnableMenuItem(ID_ENVELOPE_REMOVEPOINT, ((m_nDragItem) && (lastpoint > 1)) ? MF_ENABLED : MF_GRAYED); - pSubMenu->EnableMenuItem(ID_ENVELOPE_CARRY, (pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? MF_ENABLED : MF_GRAYED); - pSubMenu->EnableMenuItem(ID_ENVELOPE_TOGGLERELEASENODE, (pSndFile->m_nType&(MOD_TYPE_IT|MOD_TYPE_MPT) && m_nEnv==ENV_VOLUME) ? MF_ENABLED : MF_GRAYED); + pSubMenu->EnableMenuItem(ID_ENVELOPE_REMOVEPOINT, ((m_nDragItem) && (lastpoint > 0)) ? MF_ENABLED : MF_GRAYED); + pSubMenu->EnableMenuItem(ID_ENVELOPE_CARRY, (pSndFile->GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? MF_ENABLED : MF_GRAYED); + pSubMenu->EnableMenuItem(ID_ENVELOPE_TOGGLERELEASENODE, (pSndFile->GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT) && m_nEnv == ENV_VOLUME) ? MF_ENABLED : MF_GRAYED); pSubMenu->CheckMenuItem(ID_ENVELOPE_SETLOOP, (EnvGetLoop()) ? MF_CHECKED : MF_UNCHECKED); pSubMenu->CheckMenuItem(ID_ENVELOPE_SUSTAIN, (EnvGetSustain()) ? MF_CHECKED : MF_UNCHECKED); pSubMenu->CheckMenuItem(ID_ENVELOPE_CARRY, (EnvGetCarry()) ? MF_CHECKED : MF_UNCHECKED); - pSubMenu->CheckMenuItem(ID_ENVELOPE_TOGGLERELEASENODE, (EnvGetReleaseNode()==m_nDragItem-1) ? MF_CHECKED : MF_UNCHECKED); + pSubMenu->CheckMenuItem(ID_ENVELOPE_TOGGLERELEASENODE, (EnvGetReleaseNode() == m_nDragItem - 1) ? MF_CHECKED : MF_UNCHECKED); m_ptMenu = pt; ClientToScreen(&pt); pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,this); @@ -1637,11 +1666,9 @@ //-------------------------------------------------- { // Middle mouse button: Remove envelope point - if(EnvGetLastPoint() <= 1) return; + if(EnvGetLastPoint() == 0) return; m_nDragItem = ScreenToPoint(pt.x, pt.y) + 1; - if(m_nDragItem == 0) return; - m_ptMenu = pt; - OnEnvRemovePoint(); + EnvRemovePoint(m_nDragItem - 1); } @@ -1727,21 +1754,10 @@ void CViewInstrument::OnEnvToggleReleasNode() //--------------------------------------------------- { - UINT node = m_nDragItem-1; - - CModDoc *pModDoc = GetDocument(); - if ((pModDoc) && (node>0) && (node <= EnvGetLastPoint())) + if(m_nDragItem < 2 || m_nDragItem >= EnvGetLastPoint()) return; + if(EnvToggleReleaseNode(m_nDragItem - 1)) { - INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); - if(envelope == nullptr) return; - - if (envelope->nReleaseNode == node) { - envelope->nReleaseNode = ENV_RELEASE_NODE_UNSET; - } else { - envelope->nReleaseNode = static_cast<BYTE>(node); - } - - pModDoc->SetModified(); + if(GetDocument() != nullptr) GetDocument()->SetModified(); InvalidateRect(NULL, FALSE); } } @@ -1811,13 +1827,17 @@ void CViewInstrument::OnEnvRemovePoint() //-------------------------------------- { - EnvRemovePoint(); + if(m_nDragItem > 0) + { + EnvRemovePoint(m_nDragItem - 1); + } } void CViewInstrument::OnEnvInsertPoint() //-------------------------------------- { - EnvInsertPoint(); + + EnvInsertPoint(ScreenToTick(m_ptMenu.x), ScreenToValue(m_ptMenu.y)); } @@ -2164,6 +2184,23 @@ case kcInstrumentLoad: SendCtrlMessage(IDC_INSTRUMENT_OPEN); return wParam; case kcInstrumentSave: SendCtrlMessage(IDC_INSTRUMENT_SAVEAS); return wParam; case kcInstrumentNew: SendCtrlMessage(IDC_INSTRUMENT_NEW); return wParam; + + // envelope editor + case kcInstrumentEnvelopePointPrev: EnvKbdSelectPrevPoint(); return wParam; + case kcInstrumentEnvelopePointNext: EnvKbdSelectNextPoint(); return wParam; + case kcInstrumentEnvelopePointMoveLeft: EnvKbdMovePointLeft(); return wParam; + case kcInstrumentEnvelopePointMoveRight: EnvKbdMovePointRight(); return wParam; + case kcInstrumentEnvelopePointMoveUp: EnvKbdMovePointUp(1); return wParam; + case kcInstrumentEnvelopePointMoveDown: EnvKbdMovePointDown(1); return wParam; + case kcInstrumentEnvelopePointMoveUp8: EnvKbdMovePointUp(8); return wParam; + case kcInstrumentEnvelopePointMoveDown8: EnvKbdMovePointDown(8); return wParam; + case kcInstrumentEnvelopePointInsert: EnvKbdInsertPoint(); return wParam; + case kcInstrumentEnvelopePointRemove: EnvKbdRemovePoint(); return wParam; + case kcInstrumentEnvelopeSetLoopStart: EnvKbdSetLoopStart(); return wParam; + case kcInstrumentEnvelopeSetLoopEnd: EnvKbdSetLoopEnd(); return wParam; + case kcInstrumentEnvelopeSetSustainLoopStart: EnvKbdSetSustainStart(); return wParam; + case kcInstrumentEnvelopeSetSustainLoopEnd: EnvKbdSetSustainEnd(); return wParam; + case kcInstrumentEnvelopeToggleReleaseNode: EnvKbdToggleReleaseNode(); return wParam; } if (wParam>=kcInstrumentStartNotes && wParam<=kcInstrumentEndNotes) { @@ -2204,6 +2241,181 @@ } +//////////////////////////////////////// +// Envelope Editor - Keyboard actions + +void CViewInstrument::EnvKbdSelectPrevPoint() +//------------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr) return; + if(m_nDragItem <= 1 || m_nDragItem > pEnv->nNodes) + m_nDragItem = pEnv->nNodes; + else + m_nDragItem--; + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdSelectNextPoint() +//------------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr) return; + if(m_nDragItem >= pEnv->nNodes) + m_nDragItem = 1; + else + m_nDragItem++; + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdMovePointLeft() +//----------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(m_nDragItem == 1 || pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem - 2]) + return; + pEnv->Ticks[m_nDragItem - 1]--; + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdMovePointRight() +//------------------------------------------ +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(m_nDragItem == 1 || (m_nDragItem < pEnv->nNodes && pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem])) + return; + pEnv->Ticks[m_nDragItem - 1]++; + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdMovePointUp(BYTE stepsize) +//---------------------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv->Values[m_nDragItem - 1] <= 64 - stepsize) + pEnv->Values[m_nDragItem - 1] += stepsize; + else + pEnv->Values[m_nDragItem - 1] = 64; + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdMovePointDown(BYTE stepsize) +//------------------------------------------------------ +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv->Values[m_nDragItem - 1] >= stepsize) + pEnv->Values[m_nDragItem - 1] -= stepsize; + else + pEnv->Values[m_nDragItem - 1] = 0; + RedrawWindow(); +} + +void CViewInstrument::EnvKbdInsertPoint() +//--------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr) return; + if(m_nDragItem > pEnv->nNodes) m_nDragItem = pEnv->nNodes; + WORD newTick = pEnv->Ticks[pEnv->nNodes - 1] + 4; // if last point is selected: add point after last point + BYTE newVal = pEnv->Values[pEnv->nNodes - 1]; + // if some other point is selected: interpolate between this and next point (if there's room between them) + if(m_nDragItem < pEnv->nNodes && (pEnv->Ticks[m_nDragItem] - pEnv->Ticks[m_nDragItem - 1] > 1)) + { + newTick = (pEnv->Ticks[m_nDragItem - 1] + pEnv->Ticks[m_nDragItem]) / 2; + newVal = (pEnv->Values[m_nDragItem - 1] + pEnv->Values[m_nDragItem]) / 2; + } + + UINT newPoint = EnvInsertPoint(newTick, newVal); + if(newPoint > 0) m_nDragItem = newPoint; + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdRemovePoint() +//--------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || pEnv->nNodes == 0) return; + if(m_nDragItem > pEnv->nNodes) m_nDragItem = pEnv->nNodes; + EnvRemovePoint(m_nDragItem - 1); +} + + +void CViewInstrument::EnvKbdSetLoopStart() +//---------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(!EnvGetLoop()) + EnvSetLoopStart(0); + EnvSetLoopStart(m_nDragItem - 1); + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdSetLoopEnd() +//-------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(!EnvGetLoop()) + { + EnvSetLoop(true); + EnvSetLoopStart(0); + } + EnvSetLoopEnd(m_nDragItem - 1); + RedrawWindow(); +} + + +void CViewInstrument::EnvKbdSetSustainStart() +//------------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(!EnvGetSustain()) + EnvSetSustain(true); + EnvSetSustainStart(m_nDragItem - 1); + RedrawWindow(); + +} + + +void CViewInstrument::EnvKbdSetSustainEnd() +//----------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(!EnvGetSustain()) + { + EnvSetSustain(true); + EnvSetSustainStart(0); + } + EnvSetSustainEnd(m_nDragItem - 1); + RedrawWindow(); + +} + + +void CViewInstrument::EnvKbdToggleReleaseNode() +//--------------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + EnvToggleReleaseNode(m_nDragItem - 1); + RedrawWindow(); +} + + // Get a pointer to the currently selected envelope. INSTRUMENTENVELOPE *CViewInstrument::GetEnvelopePtr() const //--------------------------------------------------------- Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/View_ins.h 2010-01-02 01:23:14 UTC (rev 453) @@ -85,6 +85,7 @@ bool EnvSetLoopEnd(int nPoint); bool EnvSetSustainStart(int nPoint); bool EnvSetSustainEnd(int nPoint); + bool EnvToggleReleaseNode(int nPoint); // Set envelope status bool EnvToggleEnv(INSTRUMENTENVELOPE *pEnv, CSoundFile *pSndFile, MODINSTRUMENT *pIns, bool bEnable, BYTE cDefaultValue, DWORD dwChanFlag, DWORD dwExtraFlags = 0); @@ -93,13 +94,28 @@ bool EnvSetPitchEnv(bool bEnable); bool EnvSetFilterEnv(bool bEnable); + // Keyboard envelope control + void EnvKbdSelectPrevPoint(); + void EnvKbdSelectNextPoint(); + void EnvKbdMovePointLeft(); + void EnvKbdMovePointRight(); + void EnvKbdMovePointUp(BYTE stepsize = 1); + void EnvKbdMovePointDown(BYTE stepsize = 1); + void EnvKbdInsertPoint(); + void EnvKbdRemovePoint(); + void EnvKbdSetLoopStart(); + void EnvKbdSetLoopEnd(); + void EnvKbdSetSustainStart(); + void EnvKbdSetSustainEnd(); + void EnvKbdToggleReleaseNode(); + //////////////////////// // Misc stuff void UpdateScrollSize(); BOOL SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes m_nEnv = ENV_VOLUME); INSTRUMENTENVELOPE *GetEnvelopePtr() const; - UINT EnvInsertPoint(); - bool EnvRemovePoint(); + UINT EnvInsertPoint(int nTick, int nValue); + bool EnvRemovePoint(UINT nPoint); int TickToScreen(int nTick) const; int PointToScreen(int nPoint) const; int ScreenToTick(int x) const; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2009-12-30 21:54:16 UTC (rev 452) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2010-01-02 01:23:14 UTC (rev 453) @@ -1005,10 +1005,10 @@ } switch(cLeftBarButtons[nBtn]) { - case ID_SAMPLE_ZOOMUP: nImage = 1; break; - case ID_SAMPLE_ZOOMDOWN: nImage = 2; break; - case ID_SAMPLE_DRAW: nImage = (dwStyle & NCBTNS_DISABLED) ? 18 : 16; break; - case ID_SAMPLE_ADDSILENCE: nImage = 17; break; + case ID_SAMPLE_ZOOMUP: nImage = SIMAGE_ZOOMUP; break; + case ID_SAMPLE_ZOOMDOWN: nImage = SIMAGE_ZOOMDOWN; break; + case ID_SAMPLE_DRAW: nImage = (dwStyle & NCBTNS_DISABLED) ? SIMAGE_NODRAW : SIMAGE_DRAW; break; + case ID_SAMPLE_ADDSILENCE: nImage = SIMAGE_RESIZE; break; } pDC->Draw3dRect(rect.left-1, rect.top-1, SMP_LEFTBAR_CXBTN+2, SMP_LEFTBAR_CYBTN+2, c3, c4); pDC->Draw3dRect(rect.left, rect.top, SMP_LEFTBAR_CXBTN, SMP_LEFTBAR_CYBTN, c1, c2); @@ -1016,7 +1016,7 @@ pDC->FillSolidRect(&rect, crFc); rect.left += xofs; rect.top += yofs; - if (dwStyle & NCBTNS_CHECKED) m_bmpEnvBar.Draw(pDC, 0, rect.TopLeft(), ILD_NORMAL); + if (dwStyle & NCBTNS_CHECKED) m_bmpEnvBar.Draw(pDC, SIMAGE_CHECKED, rect.TopLeft(), ILD_NORMAL); m_bmpEnvBar.Draw(pDC, nImage, rect.TopLeft(), ILD_NORMAL); } else { Modified: trunk/OpenMPT/mptrack/res/smptoolb.bmp =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-01-08 12:01:48
|
Revision: 457 http://modplug.svn.sourceforge.net/modplug/?rev=457&view=rev Author: saga-games Date: 2010-01-08 12:01:38 +0000 (Fri, 08 Jan 2010) Log Message: ----------- [Fix] Instrument Editor: Toggle Release Node was buggy [Ref] Minor improvements Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-01-07 17:10:05 UTC (rev 456) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-01-08 12:01:38 UTC (rev 457) @@ -247,14 +247,16 @@ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), false); // Enable/disable multisequence controls according the current modtype. - GetDlgItem(IDC_STATIC_SEQUENCE_NAME)->EnableWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE); - GetDlgItem(IDC_EDIT_SEQUENCE_NAME)->EnableWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE); - GetDlgItem(IDC_EDIT_SEQNUM)->EnableWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE); - GetDlgItem(IDC_SPIN_SEQNUM)->EnableWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE); + BOOL isMultiSeqAvail = (m_pSndFile->GetType() == MOD_TYPE_MPT) ? TRUE : FALSE; + GetDlgItem(IDC_STATIC_SEQUENCE_NAME)->EnableWindow(isMultiSeqAvail); + GetDlgItem(IDC_EDIT_SEQUENCE_NAME)->EnableWindow(isMultiSeqAvail); + GetDlgItem(IDC_EDIT_SEQNUM)->EnableWindow(isMultiSeqAvail); + GetDlgItem(IDC_SPIN_SEQNUM)->EnableWindow(isMultiSeqAvail); // Enable/disable pattern names - GetDlgItem(IDC_STATIC_PATTERNNAME)->EnableWindow( (m_pSndFile->GetType() & (MOD_TYPE_MPT|MOD_TYPE_IT|MOD_TYPE_XM)) ? SW_SHOW : SW_HIDE); - GetDlgItem(IDC_EDIT_PATTERNNAME)->EnableWindow( (m_pSndFile->GetType() & (MOD_TYPE_MPT|MOD_TYPE_IT|MOD_TYPE_XM)) ? SW_SHOW : SW_HIDE); + BOOL isPatNameAvail = (m_pSndFile->GetType() & (MOD_TYPE_MPT|MOD_TYPE_IT|MOD_TYPE_XM)) ? TRUE : FALSE; + GetDlgItem(IDC_STATIC_PATTERNNAME)->EnableWindow(isPatNameAvail); + GetDlgItem(IDC_EDIT_PATTERNNAME)->EnableWindow(isPatNameAvail); } //end rewbs.instroVST if (dwHintMask & HINT_MPTOPTIONS) @@ -1253,3 +1255,4 @@ m_OrderList.SelectSequence(newSeq); } } + Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-07 17:10:05 UTC (rev 456) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-08 12:01:38 UTC (rev 457) @@ -1436,7 +1436,7 @@ { BOOL bChanged = FALSE; if (pt.x >= m_rcClient.right - 2) nTick++; - if (m_nDragItem <= MAX_ENVPOINTS) + if (IsDragItemEnvPoint()) { bChanged = EnvSetValue(m_nDragItem - 1, nTick, nVal); } else @@ -1597,11 +1597,8 @@ { SetCapture(); m_dwStatus |= INSSTATUS_DRAGGING; - // refrsh active node colour - if(GetDocument()) - { - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - } + // refresh active node colour + InvalidateRect(NULL, FALSE); } else { @@ -1757,10 +1754,9 @@ } void CViewInstrument::OnEnvToggleReleasNode() -//--------------------------------------------------- +//------------------------------------------- { - if(m_nDragItem < 2 || m_nDragItem >= EnvGetLastPoint()) return; - if(EnvToggleReleaseNode(m_nDragItem - 1)) + if(IsDragItemEnvPoint() && EnvToggleReleaseNode(m_nDragItem - 1)) { if(GetDocument() != nullptr) GetDocument()->SetModified(); InvalidateRect(NULL, FALSE); @@ -2258,7 +2254,7 @@ m_nDragItem = pEnv->nNodes; else m_nDragItem--; - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + InvalidateRect(NULL, FALSE); } @@ -2271,7 +2267,7 @@ m_nDragItem = 1; else m_nDragItem++; - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2279,14 +2275,13 @@ //----------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(m_nDragItem == 1 || pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem - 2]) return; pEnv->Ticks[m_nDragItem - 1]--; - CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already - pModDoc->SetModified(); - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2294,14 +2289,13 @@ //------------------------------------------ { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(m_nDragItem == 1 || (m_nDragItem < pEnv->nNodes && pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem])) return; pEnv->Ticks[m_nDragItem - 1]++; - CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2309,15 +2303,14 @@ //---------------------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(pEnv->Values[m_nDragItem - 1] <= 64 - stepsize) pEnv->Values[m_nDragItem - 1] += stepsize; else pEnv->Values[m_nDragItem - 1] = 64; - CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2325,15 +2318,14 @@ //------------------------------------------------------ { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(pEnv->Values[m_nDragItem - 1] >= stepsize) pEnv->Values[m_nDragItem - 1] -= stepsize; else pEnv->Values[m_nDragItem - 1] = 0; - CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } void CViewInstrument::EnvKbdInsertPoint() @@ -2341,7 +2333,7 @@ { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); if(pEnv == nullptr) return; - if(m_nDragItem > pEnv->nNodes) m_nDragItem = pEnv->nNodes; + if(!IsDragItemEnvPoint()) m_nDragItem = pEnv->nNodes; WORD newTick = pEnv->Ticks[pEnv->nNodes - 1] + 4; // if last point is selected: add point after last point BYTE newVal = pEnv->Values[pEnv->nNodes - 1]; // if some other point is selected: interpolate between this and next point (if there's room between them) @@ -2360,7 +2352,7 @@ //--------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || pEnv->nNodes == 0) return; + if(pEnv == nullptr || !IsDragItemEnvPoint() || pEnv->nNodes == 0) return; if(m_nDragItem > pEnv->nNodes) m_nDragItem = pEnv->nNodes; EnvRemovePoint(m_nDragItem - 1); } @@ -2370,11 +2362,11 @@ //---------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(!EnvGetLoop()) EnvSetLoopStart(0); EnvSetLoopStart(m_nDragItem - 1); - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2382,14 +2374,14 @@ //-------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(!EnvGetLoop()) { EnvSetLoop(true); EnvSetLoopStart(0); } EnvSetLoopEnd(m_nDragItem - 1); - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2397,11 +2389,11 @@ //------------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(!EnvGetSustain()) EnvSetSustain(true); EnvSetSustainStart(m_nDragItem - 1); - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2409,14 +2401,14 @@ //----------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; if(!EnvGetSustain()) { EnvSetSustain(true); EnvSetSustainStart(0); } EnvSetSustainEnd(m_nDragItem - 1); - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + InvalidateRect(NULL, FALSE); } @@ -2424,9 +2416,12 @@ //--------------------------------------------- { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); - if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return; - EnvToggleReleaseNode(m_nDragItem - 1); - GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already + if(pEnv == nullptr || !IsDragItemEnvPoint()) return; + if(EnvToggleReleaseNode(m_nDragItem - 1)) + { + GetDocument()->SetModified(); + InvalidateRect(NULL, FALSE); + } } Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2010-01-07 17:10:05 UTC (rev 456) +++ trunk/OpenMPT/mptrack/View_ins.h 2010-01-08 12:01:38 UTC (rev 457) @@ -109,6 +109,8 @@ void EnvKbdSetSustainEnd(); void EnvKbdToggleReleaseNode(); + bool IsDragItemEnvPoint() const { return (m_nDragItem < 1 || m_nDragItem > EnvGetLastPoint() + 1) ? false : true; } + //////////////////////// // Misc stuff void UpdateScrollSize(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-01-08 20:57:02
|
Revision: 459 http://modplug.svn.sourceforge.net/modplug/?rev=459&view=rev Author: saga-games Date: 2010-01-08 20:56:53 +0000 (Fri, 08 Jan 2010) Log Message: ----------- [New] Mod Conversion: When converting a song that has subsongs to MPTM format, the user is asked if those subsongs should be converted into multiple sequences. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-01-08 12:14:54 UTC (rev 458) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-01-08 20:56:53 UTC (rev 459) @@ -289,6 +289,7 @@ BOOL RemoveChannels(BOOL bChnMask[MAX_CHANNELS]); bool MergeSequences(); + bool ConvertSubsongsToMultipleSequences(); bool m_bHasValidPath; //becomes true if document is loaded or saved. // Fix: save pattern scrollbar position when switching to other tab Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-01-08 12:14:54 UTC (rev 458) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-01-08 20:56:53 UTC (rev 459) @@ -372,7 +372,27 @@ ChangeFileExtension(nNewType); // Multisequences not suppported by other formats - if(!(m_SndFile.m_nType & MOD_TYPE_MPT)) MergeSequences(); + if(!(m_SndFile.GetType() == MOD_TYPE_MPT)) MergeSequences(); + // Convert sequence with separator patterns into multiple sequences? + if(m_SndFile.GetType() == MOD_TYPE_MPT && m_SndFile.Order.GetNumSequences() == 1) + { + bool hasSepPatterns = false; + for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++) + { + if(!m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd])) + { + hasSepPatterns = true; + break; + } + } + if(hasSepPatterns && + ::MessageBox(NULL, + "The order list contains separator items.\nThe new format supports multiple sequences, do you want to convert those separate tracks into multiple song sequences?", + "Order list conversion", MB_YESNO | MB_ICONQUESTION) == IDYES) + { + ConvertSubsongsToMultipleSequences(); + } + } //rewbs.cutomKeys: update effect key commands CInputHandler *ih = CMainFrame::GetMainFrame()->GetInputHandler(); @@ -1709,3 +1729,70 @@ return true; } + +// Split subsongs (separated by "---" or "+++" patterns) into sequences +bool CModDoc::ConvertSubsongsToMultipleSequences() +//------------------------------------------------ +{ + if(m_SndFile.GetType() != MOD_TYPE_MPT || m_SndFile.Order.GetNumSequences() != 1) return false; + bool modified = false; + + m_SndFile.Order.SetSequence(0); + for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++) + { + // end of subsong? + if(!m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd])) + { + ORDERINDEX oldLength = m_SndFile.Order.GetLengthTailTrimmed(); + // remove all separator patterns between current and next subsong first + while(nOrd < oldLength && (!m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd]))) + { + m_SndFile.Order[nOrd] = m_SndFile.Order.GetInvalidPatIndex(); + nOrd++; + modified = true; + } + if(nOrd >= oldLength) break; + ORDERINDEX startOrd = nOrd; + modified = true; + + m_SndFile.Order.AddSequence(false); + SEQUENCEINDEX newSeq = m_SndFile.Order.GetNumSequences() - 1; + m_SndFile.Order.SetSequence(newSeq); + + // resize new seqeuence if necessary + if(m_SndFile.Order.GetLength() < oldLength - startOrd) + { + m_SndFile.Order.resize(oldLength - startOrd); + } + + // now, move all following orders to the new sequence + while(nOrd < oldLength) + { + PATTERNINDEX copyPat = m_SndFile.Order.GetSequence(newSeq - 1)[nOrd]; + m_SndFile.Order[nOrd - startOrd] = copyPat; + nOrd++; + + // is this a valid pattern? adjust pattern jump commands, if necessary. + if(m_SndFile.Patterns.IsValidPat(copyPat)) + { + MODCOMMAND *m = m_SndFile.Patterns[copyPat]; + for (UINT len = m_SndFile.PatternSize[copyPat] * m_SndFile.m_nChannels; len; m++, len--) + { + if(m->command == CMD_POSITIONJUMP && m->param >= startOrd) + { + m->param -= startOrd; + } + } + } + } + m_SndFile.Order.SetSequence(newSeq - 1); + m_SndFile.Order.Remove(startOrd, oldLength - 1); + m_SndFile.Order.SetSequence(newSeq); + // start from beginning... + nOrd = 0; + if(m_SndFile.Order.GetLengthTailTrimmed() == 0 || !m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd])) break; + } + } + m_SndFile.Order.SetSequence(0); + return modified; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-01-10 14:50:43
|
Revision: 461 http://modplug.svn.sourceforge.net/modplug/?rev=461&view=rev Author: saga-games Date: 2010-01-10 14:50:33 +0000 (Sun, 10 Jan 2010) Log Message: ----------- [Mod] Reverted the "IT" and "FT2" colour schemes to what they used to be until 1.17.02.54, since those colour schemes worked better. However, since they do not resemble IT or FT2 in any way, they have been simply renamed to "Green" and "Blue". Modified Paths: -------------- trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2010-01-09 20:06:18 UTC (rev 460) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2010-01-10 14:50:33 UTC (rev 461) @@ -422,30 +422,31 @@ void COptionsColors::OnPresetFT2() //-------------------------------- { + // "blue" CustomColors[MODCOLOR_BACKNORMAL] = RGB(0x00, 0x00, 0x00); - CustomColors[MODCOLOR_TEXTNORMAL] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_BACKCURROW] = RGB(0x49, 0x75, 0x82); - CustomColors[MODCOLOR_TEXTCURROW] = RGB(0xFF, 0xFF, 0x5F); - CustomColors[MODCOLOR_BACKSELECTED] = RGB(0x28, 0x28, 0x28); + CustomColors[MODCOLOR_TEXTNORMAL] = RGB(0xE0, 0xE0, 0x40); + CustomColors[MODCOLOR_BACKCURROW] = RGB(0x70, 0x70, 0x70); + CustomColors[MODCOLOR_TEXTCURROW] = RGB(0xF0, 0xF0, 0x50); + CustomColors[MODCOLOR_BACKSELECTED] = RGB(0x40, 0x40, 0xA0); CustomColors[MODCOLOR_TEXTSELECTED] = RGB(0xFF, 0xFF, 0xFF); - CustomColors[MODCOLOR_BACKPLAYCURSOR] = RGB(0x49, 0x75, 0x82); - CustomColors[MODCOLOR_TEXTPLAYCURSOR] = RGB(0xFF, 0xFF, 0xFF); - CustomColors[MODCOLOR_BACKHILIGHT] = RGB(0x27, 0x41, 0x47); - CustomColors[MODCOLOR_NOTE] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_INSTRUMENT] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_VOLUME] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_PANNING] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_PITCH] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_GLOBALS] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_SAMPLE] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_ENVELOPES] = RGB(0xFF, 0xFF, 0x82); - CustomColors[MODCOLOR_VUMETER_LO] = RGB(0x4B, 0x7C, 0x89); - CustomColors[MODCOLOR_VUMETER_MED] = RGB(0x5F, 0x98, 0xA7); - CustomColors[MODCOLOR_VUMETER_HI] = RGB(0xEA, 0x1C, 0x78); - CustomColors[MODCOLOR_SEPSHADOW] = RGB(0x18, 0x28, 0x2C); - CustomColors[MODCOLOR_SEPFACE] = RGB(0x49, 0x75, 0x82); - CustomColors[MODCOLOR_SEPHILITE] = RGB(0x8A, 0xDB, 0xF3); - CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x27, 0x41, 0x47); + CustomColors[MODCOLOR_SAMPLE] = RGB(0xFF, 0x00, 0x00); + CustomColors[MODCOLOR_BACKPLAYCURSOR] = RGB(0x50, 0x50, 0x70); + CustomColors[MODCOLOR_TEXTPLAYCURSOR] = RGB(0xE0, 0xE0, 0x40); + CustomColors[MODCOLOR_BACKHILIGHT] = RGB(0x40, 0x40, 0x80); + CustomColors[MODCOLOR_NOTE] = RGB(0xE0, 0xE0, 0x40); + CustomColors[MODCOLOR_INSTRUMENT] = RGB(0xFF, 0xFF, 0x00); + CustomColors[MODCOLOR_VOLUME] = RGB(0x00, 0xFF, 0x00); + CustomColors[MODCOLOR_PANNING] = RGB(0x00, 0xFF, 0xFF); + CustomColors[MODCOLOR_PITCH] = RGB(0xFF, 0xFF, 0x00); + CustomColors[MODCOLOR_GLOBALS] = RGB(0xFF, 0x40, 0x40); + CustomColors[MODCOLOR_ENVELOPES] = RGB(0x00, 0x00, 0xFF); + CustomColors[MODCOLOR_VUMETER_LO] = RGB(0x00, 0xC8, 0x00); + CustomColors[MODCOLOR_VUMETER_MED] = RGB(0xFF, 0xC8, 0x00); + CustomColors[MODCOLOR_VUMETER_HI] = RGB(0xE1, 0x00, 0x00); + CustomColors[MODCOLOR_SEPSHADOW] = RGB(0x2E, 0x2E, 0x5C); + CustomColors[MODCOLOR_SEPFACE] = RGB(0x40, 0x40, 0x80); + CustomColors[MODCOLOR_SEPHILITE] = RGB(0x99, 0x99, 0xCC); + CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x2E, 0x2E, 0x5A); OnPreviewChanged(); } @@ -453,30 +454,31 @@ void COptionsColors::OnPresetIT() //------------------------------- { + // "green" CustomColors[MODCOLOR_BACKNORMAL] = RGB(0x00, 0x00, 0x00); - CustomColors[MODCOLOR_TEXTNORMAL] = RGB(0x45, 0x9A, 0x49); - CustomColors[MODCOLOR_BACKCURROW] = RGB(0x10, 0x35, 0x00); - CustomColors[MODCOLOR_TEXTCURROW] = RGB(0xEB, 0xEB, 0xCB); - CustomColors[MODCOLOR_BACKSELECTED] = RGB(0x20, 0x55, 0x00); - CustomColors[MODCOLOR_TEXTSELECTED] = RGB(0xEB, 0xEB, 0xCB); - CustomColors[MODCOLOR_BACKPLAYCURSOR] = RGB(0x59, 0x41, 0x3C); - CustomColors[MODCOLOR_TEXTPLAYCURSOR] = RGB(0x45, 0x9A, 0x49); - CustomColors[MODCOLOR_BACKHILIGHT] = RGB(0x59, 0x41, 0x3C); - CustomColors[MODCOLOR_NOTE] = RGB(0x45, 0x9A, 0x49); - CustomColors[MODCOLOR_INSTRUMENT] = RGB(0x38, 0x9E, 0x75); - CustomColors[MODCOLOR_VOLUME] = RGB(0xA2, 0xA2, 0xA2); - CustomColors[MODCOLOR_PANNING] = RGB(0x18, 0x75, 0x2C); - CustomColors[MODCOLOR_PITCH] = RGB(0x45, 0x9A, 0x49); - CustomColors[MODCOLOR_GLOBALS] = RGB(0x45, 0x9A, 0x49); - CustomColors[MODCOLOR_SAMPLE] = RGB(0x8E, 0x14, 0x55); - CustomColors[MODCOLOR_ENVELOPES] = RGB(0xA2, 0xA2, 0xA2); - CustomColors[MODCOLOR_VUMETER_LO] = RGB(0x25, 0x7D, 0x00); - CustomColors[MODCOLOR_VUMETER_MED] = RGB(0xEC, 0x99, 0x00); + CustomColors[MODCOLOR_TEXTNORMAL] = RGB(0x00, 0xE0, 0x00); + CustomColors[MODCOLOR_BACKCURROW] = RGB(0x70, 0x70, 0x70); + CustomColors[MODCOLOR_TEXTCURROW] = RGB(0x00, 0xE0, 0x00); + CustomColors[MODCOLOR_BACKSELECTED] = RGB(0xE0, 0xE0, 0xE0); + CustomColors[MODCOLOR_TEXTSELECTED] = RGB(0x00, 0x00, 0x00); + CustomColors[MODCOLOR_SAMPLE] = RGB(0xFF, 0x00, 0x00); + CustomColors[MODCOLOR_BACKPLAYCURSOR] = RGB(0x80, 0x80, 0x00); + CustomColors[MODCOLOR_TEXTPLAYCURSOR] = RGB(0x00, 0xE0, 0x00); + CustomColors[MODCOLOR_BACKHILIGHT] = RGB(0x40, 0x68, 0x40); + CustomColors[MODCOLOR_NOTE] = RGB(0x00, 0xFF, 0x00); + CustomColors[MODCOLOR_INSTRUMENT] = RGB(0xFF, 0xFF, 0x00); + CustomColors[MODCOLOR_VOLUME] = RGB(0x00, 0xFF, 0x00); + CustomColors[MODCOLOR_PANNING] = RGB(0x00, 0xFF, 0xFF); + CustomColors[MODCOLOR_PITCH] = RGB(0xFF, 0xFF, 0x00); + CustomColors[MODCOLOR_GLOBALS] = RGB(0xFF, 0x40, 0x40); + CustomColors[MODCOLOR_ENVELOPES] = RGB(0x00, 0x00, 0xFF); + CustomColors[MODCOLOR_VUMETER_LO] = RGB(0x00, 0xC8, 0x00); + CustomColors[MODCOLOR_VUMETER_MED] = RGB(0xFF, 0xC8, 0x00); CustomColors[MODCOLOR_VUMETER_HI] = RGB(0xE1, 0x00, 0x00); - CustomColors[MODCOLOR_SEPSHADOW] = RGB(0xB6, 0x96, 0x79); - CustomColors[MODCOLOR_SEPFACE] = RGB(0xB6, 0x96, 0x79); - CustomColors[MODCOLOR_SEPHILITE] = RGB(0xB6, 0x96, 0x79); - CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x35, 0x27, 0x24); + CustomColors[MODCOLOR_SEPSHADOW] = RGB(0x23, 0x38, 0x23); + CustomColors[MODCOLOR_SEPFACE] = RGB(0x40, 0x68, 0x40); + CustomColors[MODCOLOR_SEPHILITE] = RGB(0x94, 0xBC, 0x94); + CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x00, 0x40, 0x00); OnPreviewChanged(); } @@ -612,7 +614,7 @@ {PATTERN_SINGLEEXPAND, "Single click to expand tree", "Single-clicking in the left tree view will expand a branch"}, {PATTERN_MUTECHNMODE, "Ignored muted channels", "Notes will not be played on muted channels (unmuting will only start on a new note)."}, {PATTERN_AUTOSPACEBAR, "Quick cursor paste Auto-Repeat", "Leaving the space bar pressed will auto-repeat the action"}, - {PATTERN_NOEXTRALOUD, "No loud samples", "Disable loud playback of samples in the sample/instrument editor"}, + {PATTERN_NOEXTRALOUD, "No loud samples", "Disable loud playback of samples in the sample/instrument editor. Sample volume depends on the sample volume slider on the general tab when activated."}, {PATTERN_SHOWPREVIOUS, "Show Prev/Next patterns", "Displays grayed-out version of the previous/next patterns in the pattern editor. Does not work if \"always center active row\" is disabled."}, {PATTERN_CONTSCROLL, "Continuous scroll", "Jumps to the next pattern when moving past the end of a pattern"}, {PATTERN_KBDNOTEOFF, "Record note off", "Record note off when a key is released on the PC keyboard (Only works in instrument mode)."}, Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2010-01-09 20:06:18 UTC (rev 460) +++ trunk/OpenMPT/mptrack/mptrack.rc 2010-01-10 14:50:33 UTC (rev 461) @@ -298,7 +298,7 @@ END IDD_OPTIONS_COLORS DIALOGEX 0, 0, 272, 281 -STYLE DS_SETFONT | DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Colours" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -309,10 +309,10 @@ EDITTEXT IDC_SECONDARYHILITE,114,108,21,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Enable effect highlighting",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,60,114,10 CONTROL "Use small font",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,45,102,10 - PUSHBUTTON "MPT",IDC_BUTTON5,144,246,24,15 - PUSHBUTTON "FT2",IDC_BUTTON6,204,246,24,15 - PUSHBUTTON "IT",IDC_BUTTON7,174,246,24,15 - PUSHBUTTON "Buzz",IDC_BUTTON8,234,246,24,15 + PUSHBUTTON "MPT",IDC_BUTTON5,126,246,30,15 + PUSHBUTTON "Blue",IDC_BUTTON6,198,246,30,15 + PUSHBUTTON "Green",IDC_BUTTON7,162,246,30,15 + PUSHBUTTON "Buzz",IDC_BUTTON8,234,246,30,15 CONTROL "Colour",IDC_BUTTON1,"Button",BS_OWNERDRAW,25,194,51,15 CONTROL "Colour",IDC_BUTTON2,"Button",BS_OWNERDRAW,98,194,51,15 CONTROL "Colour",IDC_BUTTON3,"Button",BS_OWNERDRAW,168,194,51,15 @@ -326,8 +326,8 @@ CONTROL "",IDC_BUTTON4,"Button",BS_OWNERDRAW | BS_FLAT,65,130,114,43 CONTROL "Set highlights to songs' time signatures",IDC_CHECK5, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,75,136,10 - PUSHBUTTON "Load...",IDC_LOAD_COLORSCHEME,18,246,48,15 - PUSHBUTTON "Save...",IDC_SAVE_COLORSCHEME,72,246,48,15 + PUSHBUTTON "Load...",IDC_LOAD_COLORSCHEME,18,246,42,15 + PUSHBUTTON "Save...",IDC_SAVE_COLORSCHEME,66,246,42,15 GROUPBOX "Colour Presets",IDC_STATIC,6,228,264,42 END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-02-20 19:20:46
|
Revision: 501 http://modplug.svn.sourceforge.net/modplug/?rev=501&view=rev Author: saga-games Date: 2010-02-20 19:20:37 +0000 (Sat, 20 Feb 2010) Log Message: ----------- [Fix] Treeview: Insert/Duplicate sequence actions didn't set the document modified. Grey out those two actions if no additional sequences can be added. [Imp] Orderlist: Sequence menu also allows to insert empty sequences now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-20 16:32:10 UTC (rev 500) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-20 19:20:37 UTC (rev 501) @@ -60,7 +60,7 @@ ON_COMMAND(ID_ORDERLIST_COPY, OnDuplicatePattern) ON_COMMAND(ID_PATTERNCOPY, OnPatternCopy) ON_COMMAND(ID_PATTERNPASTE, OnPatternPaste) - ON_COMMAND_RANGE(ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, OnSelectSequence) + ON_COMMAND_RANGE(ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, OnSelectSequence) ON_MESSAGE(WM_MOD_DRAGONDROPPING, OnDragonDropping) ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest) ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) @@ -1070,9 +1070,12 @@ AppendMenu(menuSequence, flags, ID_SEQUENCE_ITEM + i, str); } if (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES) - AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("Create new sequence")); + { + AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("Duplicate current sequence")); + AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("Create empty sequence")); + } if (pSndFile->Order.GetNumSequences() > 1) - AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("Delete current sequence")); + AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, TEXT("Delete current sequence")); } } AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); @@ -1366,7 +1369,7 @@ BEGIN_CRITICAL(); CMainFrame::GetMainFrame()->ResetNotificationBuffer(); CSoundFile& rSf = *m_pModDoc->GetSoundFile(); - if (nSeq == MAX_SEQUENCES + 1) + if (nSeq == MAX_SEQUENCES + 2) { CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), rSf.Order.m_sName); CString str; @@ -1379,8 +1382,8 @@ return; } } - else if (nSeq == MAX_SEQUENCES) - rSf.Order.AddSequence(); + else if (nSeq == MAX_SEQUENCES || nSeq == MAX_SEQUENCES + 1) + rSf.Order.AddSequence((nSeq == MAX_SEQUENCES)); else if (nSeq < rSf.Order.GetNumSequences()) rSf.Order.SetSequence(nSeq); ORDERINDEX nPosCandidate = rSf.Order.GetLengthTailTrimmed() - 1; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-02-20 16:32:10 UTC (rev 500) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-02-20 19:20:37 UTC (rev 501) @@ -2333,8 +2333,8 @@ { AppendMenu(hMenu, MF_STRING, ID_MODTREE_SWITCHTO, "&Switch to Seqeuence"); } - AppendMenu(hMenu, MF_STRING, ID_MODTREE_INSERT, "&Insert Sequence"); - AppendMenu(hMenu, MF_STRING, ID_MODTREE_DUPLICATE, "D&uplicate Sequence"); + AppendMenu(hMenu, MF_STRING | (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES ? 0 : MF_GRAYED), ID_MODTREE_INSERT, "&Insert Sequence"); + AppendMenu(hMenu, MF_STRING | (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES ? 0 : MF_GRAYED), ID_MODTREE_DUPLICATE , "D&uplicate Sequence"); AppendMenu(hMenu, MF_STRING, ID_MODTREE_REMOVE, "&Delete Sequence"); } break; @@ -2867,6 +2867,7 @@ { pSndFile->Order.SetSequence((SEQUENCEINDEX)modItemID); pSndFile->Order.AddSequence(true); + pModDoc->SetModified(); UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SEQNAMES|HINT_MODSEQUENCE); pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES|HINT_MODSEQUENCE); } @@ -2889,6 +2890,7 @@ if (pModDoc && pSndFile && ((modItemType == MODITEM_SEQUENCE) || (modItemType == MODITEM_HDR_ORDERS))) { pSndFile->Order.AddSequence(false); + pModDoc->SetModified(); UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SEQNAMES|HINT_MODSEQUENCE); pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES|HINT_MODSEQUENCE); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-02-20 23:14:07
|
Revision: 504 http://modplug.svn.sourceforge.net/modplug/?rev=504&view=rev Author: saga-games Date: 2010-02-20 23:13:54 +0000 (Sat, 20 Feb 2010) Log Message: ----------- [New] Pattern Editor: Key shortcut + context menu entry for toggling the plugin editor of the PC note that's under the cursor. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-02-20 23:13:54 UTC (rev 504) @@ -2560,6 +2560,11 @@ commands[kcInstrumentEnvelopePointMoveDown8].isDummy = false; commands[kcInstrumentEnvelopePointMoveDown8].Message = "Move envelope point down (big step)"; + commands[kcPatternEditPCNotePlugin].UID = 1836; + commands[kcPatternEditPCNotePlugin].isHidden = false; + commands[kcPatternEditPCNotePlugin].isDummy = false; + commands[kcPatternEditPCNotePlugin].Message = "Edit plugin assigned to PC note"; + #ifdef _DEBUG for (int i=0; i<kcNumCommands; i++) { if (commands[i].UID != 0) { // ignore unset UIDs Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-02-20 23:13:54 UTC (rev 504) @@ -221,6 +221,7 @@ kcSwitchToOrderList, kcNewPattern, kcDuplicatePattern, + kcPatternEditPCNotePlugin, kcTogglePluginEditor, kcShowNoteProperties, kcShowPatternProperties, Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-20 23:13:54 UTC (rev 504) @@ -114,6 +114,7 @@ ON_COMMAND(ID_CLEAR_SELECTION, OnClearSelectionFromMenu) ON_COMMAND(ID_SHOWTIMEATROW, OnShowTimeAtRow) ON_COMMAND(ID_CHANNEL_RENAME, OnRenameChannel) + ON_COMMAND(ID_PATTERN_EDIT_PCNOTE_PLUGIN, OnTogglePCNotePluginEditor) ON_COMMAND_RANGE(ID_CHANGE_INSTRUMENT, ID_CHANGE_INSTRUMENT+MAX_INSTRUMENTS, OnSelectInstrument) ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateUndo) ON_COMMAND_RANGE(ID_PLUGSELECT, ID_PLUGSELECT+MAX_MIXPLUGINS, OnSelectPlugin) //rewbs.patPlugName @@ -1225,7 +1226,8 @@ AppendMenu(hMenu, MF_SEPARATOR, 0, ""); if (BuildVisFXCtxMenu(hMenu, ih) | //Use bitwise ORs to avoid shortcuts BuildAmplifyCtxMenu(hMenu, ih) | - BuildSetInstCtxMenu(hMenu, ih, pSndFile) ) + BuildSetInstCtxMenu(hMenu, ih, pSndFile) | + BuildPCNoteCtxMenu(hMenu, ih, pSndFile) ) AppendMenu(hMenu, MF_SEPARATOR, 0, ""); if (BuildGrowShrinkCtxMenu(hMenu, ih)) AppendMenu(hMenu, MF_SEPARATOR, 0, ""); @@ -3620,6 +3622,7 @@ case kcDuplicatePattern: SendCtrlMessage(CTRLMSG_PAT_DUPPATTERN); return wParam; case kcSwitchToOrderList: OnSwitchToOrderList(); case kcSwitchOverflowPaste: CMainFrame::m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; return wParam; + case kcPatternEditPCNotePlugin: OnTogglePCNotePluginEditor(); return wParam; } //Ranges: @@ -4988,6 +4991,23 @@ } +bool CViewPattern::BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) +//----------------------------------------------------------------------------------------- +{ + MODCOMMAND *mSelStart = nullptr; + if((pSndFile == nullptr) || (!pSndFile->Patterns.IsValidPat(m_nPattern))) + return false; + mSelStart = pSndFile->Patterns[m_nPattern].GetpModCommand(GetSelectionStartRow(), GetSelectionStartChan()); + if((mSelStart == nullptr) || (!mSelStart->IsPcNote())) + return false; + if(mSelStart->instr < 1 || mSelStart->instr > MAX_MIXPLUGINS) + return false; + + AppendMenu(hMenu, MF_STRING, ID_PATTERN_EDIT_PCNOTE_PLUGIN, "Toggle plugin editor\t" + ih->GetKeyTextFromCommand(kcPatternEditPCNotePlugin)); + return true; +} + + UINT CViewPattern::GetSelectionStartRow() { //----------------------------------------- return min(GetRowFromCursor(m_dwBeginSel), GetRowFromCursor(m_dwEndSel)); @@ -5232,3 +5252,24 @@ SetFocus(); } } + + +void CViewPattern::OnTogglePCNotePluginEditor() +//--------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if(pModDoc == nullptr) return; + CSoundFile *pSndFile = pModDoc->GetSoundFile(); + if((pSndFile == nullptr) || (!pSndFile->Patterns.IsValidPat(m_nPattern))) + return; + + MODCOMMAND *mSelStart = nullptr; + mSelStart = pSndFile->Patterns[m_nPattern].GetpModCommand(GetSelectionStartRow(), GetSelectionStartChan()); + if((mSelStart == nullptr) || (!mSelStart->IsPcNote())) + return; + if(mSelStart->instr < 1 || mSelStart->instr > MAX_MIXPLUGINS) + return; + + PLUGINDEX nPlg = (PLUGINDEX)(mSelStart->instr - 1); + pModDoc->TogglePluginEditor(nPlg); +} Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/View_pat.h 2010-02-20 23:13:54 UTC (rev 504) @@ -303,6 +303,7 @@ afx_msg void OnRunScript(); afx_msg void OnShowTimeAtRow(); afx_msg void OnRenameChannel(); + afx_msg void OnTogglePCNotePluginEditor(); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -331,6 +332,7 @@ bool BuildSetInstCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); bool BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler* ih); bool BuildChannelMiscCtxMenu(HMENU hMenu, CSoundFile* pSndFile); + bool BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); UINT GetSelectionStartRow(); UINT GetSelectionEndRow(); Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/resource.h 2010-02-20 23:13:54 UTC (rev 504) @@ -1202,6 +1202,7 @@ #define ID_SAMPLE_GENERATE 60445 #define ID_NOTEMAP_TRANS_UP 60446 #define ID_NOTEMAP_TRANS_DOWN 60447 +#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448 // Next default values for new objects // @@ -1209,7 +1210,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 526 -#define _APS_NEXT_COMMAND_VALUE 60448 +#define _APS_NEXT_COMMAND_VALUE 60449 #define _APS_NEXT_CONTROL_VALUE 2427 #define _APS_NEXT_SYMED_VALUE 901 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-02-22 20:53:16
|
Revision: 508 http://modplug.svn.sourceforge.net/modplug/?rev=508&view=rev Author: saga-games Date: 2010-02-22 20:53:09 +0000 (Mon, 22 Feb 2010) Log Message: ----------- [Fix] Pattern Editor: Now, plugin slot 100 can also be automated using PC Notes. [Fix] Instrument Editor: It was impossible to assign plugin slot 100 to an instrument. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-02-22 00:21:17 UTC (rev 507) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-02-22 20:53:09 UTC (rev 508) @@ -1174,7 +1174,7 @@ } else { m_CbnMidiCh.SetCurSel(0); } - if (pIns->nMixPlug < MAX_MIXPLUGINS) { + if (pIns->nMixPlug <= MAX_MIXPLUGINS) { m_CbnMixPlug.SetCurSel(pIns->nMixPlug); } else { m_CbnMixPlug.SetCurSel(0); @@ -2027,7 +2027,7 @@ //--------------------------------------- { MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; - BYTE nPlug = static_cast<BYTE>(m_CbnMixPlug.GetItemData(m_CbnMixPlug.GetCurSel()) & 0xff); + PLUGINDEX nPlug = static_cast<PLUGINDEX>(m_CbnMixPlug.GetItemData(m_CbnMixPlug.GetCurSel()) & 0xff); // TODO is the 0xFF necessary? if (pIns) { @@ -2042,7 +2042,7 @@ m_CbnPluginVolumeHandling.EnableWindow(); } - if (nPlug>=0 && nPlug<MAX_MIXPLUGINS+1) + if (nPlug>=0 && nPlug <= MAX_MIXPLUGINS) { if ((!IsLocked()) && pIns->nMixPlug != nPlug) { m_pModDoc->SetModified(); @@ -2852,5 +2852,5 @@ m_CbnMixPlug.SetItemData(m_CbnMixPlug.AddString(s), nPlug); } MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; - if ((pIns) && (pIns->nMixPlug < MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug); + if ((pIns) && (pIns->nMixPlug <= MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug); } Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-22 00:21:17 UTC (rev 507) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-22 20:53:09 UTC (rev 508) @@ -4078,13 +4078,26 @@ MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite - UINT instr = p->instr; + UINT instr = p->instr, nTotalMax, nTempMax; + if(p->IsPcNote()) // this is a plugin index + { + nTotalMax = MAX_MIXPLUGINS + 1; + nTempMax = MAX_MIXPLUGINS + 1; + } else if(pSndFile->GetNumInstruments() > 0) // this is an instrument index + { + nTotalMax = MAX_INSTRUMENTS; + nTempMax = pSndFile->GetNumInstruments(); + } else + { + nTotalMax = MAX_SAMPLES; + nTempMax = pSndFile->GetNumSamples(); + } + instr = ((instr * 10) + val) % 1000; - if (instr >= MAX_INSTRUMENTS) instr = instr % 100; - if ( ((pSndFile->m_nInstruments==0) && (pSndFile->m_nSamples<100)) || // if we're using samples & have less than 100 samples - (pSndFile->m_nInstruments < 100)) { // or if we're using instruments and have less than 100 instruments - instr = instr % 100; // --> ensure the entered instrument value is less than 100. - } + if (instr >= nTotalMax) instr = instr % 100; + if (nTempMax < 100) // if we're using samples & have less than 100 samples + instr = instr % 100; // or if we're using instruments and have less than 100 instruments + // --> ensure the entered instrument value is less than 100. p->instr = instr; if (IsEditingEnabled_bmsg()) @@ -4973,7 +4986,7 @@ //Add options to remove instrument from selection. AppendMenu(instrumentChangeMenu, MF_SEPARATOR, 0, 0); AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT, "Remove instrument"); - AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+GetCurrentInstrument(), "Set to current instrument"); + AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + GetCurrentInstrument(), "Set to current instrument"); } return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-02-23 15:53:19
|
Revision: 509 http://modplug.svn.sourceforge.net/modplug/?rev=509&view=rev Author: saga-games Date: 2010-02-23 15:53:10 +0000 (Tue, 23 Feb 2010) Log Message: ----------- [New] Instrument Editor: Envelope zooming. Might still look very weird (especially the first tick and around loop points). Includes two new keyboard shortcuts. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/res/envbar.bmp trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-02-22 20:53:09 UTC (rev 508) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-02-23 15:53:10 UTC (rev 509) @@ -2565,7 +2565,17 @@ commands[kcPatternEditPCNotePlugin].isDummy = false; commands[kcPatternEditPCNotePlugin].Message = "Edit plugin assigned to PC note"; - #ifdef _DEBUG + commands[kcInstrumentEnvelopeZoomIn].UID = 1837; + commands[kcInstrumentEnvelopeZoomIn].isHidden = false; + commands[kcInstrumentEnvelopeZoomIn].isDummy = false; + commands[kcInstrumentEnvelopeZoomIn].Message = "Zoom In"; + + commands[kcInstrumentEnvelopeZoomOut].UID = 1838; + commands[kcInstrumentEnvelopeZoomOut].isHidden = false; + commands[kcInstrumentEnvelopeZoomOut].isDummy = false; + commands[kcInstrumentEnvelopeZoomOut].Message = "Zoom Out"; + +#ifdef _DEBUG for (int i=0; i<kcNumCommands; i++) { if (commands[i].UID != 0) { // ignore unset UIDs for (int j=i+1; j<kcNumCommands; j++) { Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2010-02-22 20:53:09 UTC (rev 508) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-02-23 15:53:10 UTC (rev 509) @@ -550,6 +550,8 @@ kcInstrumentLoad=kcStartInstrumentMisc, kcInstrumentSave, kcInstrumentNew, + kcInstrumentEnvelopeZoomIn, + kcInstrumentEnvelopeZoomOut, kcInstrumentEnvelopePointPrev, kcInstrumentEnvelopePointNext, kcInstrumentEnvelopePointMoveLeft, Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-02-22 20:53:09 UTC (rev 508) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-02-23 15:53:10 UTC (rev 509) @@ -319,6 +319,10 @@ IIMAGE_NOFILTERSWITCH, IIMAGE_SAMPLEMAP, IIMAGE_GRID, + IIMAGE_ZOOMIN, + IIMAGE_NOZOOMIN, + IIMAGE_ZOOMOUT, + IIMAGE_NOZOOMOUT, }; Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2010-02-22 20:53:09 UTC (rev 508) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-02-23 15:53:10 UTC (rev 509) @@ -12,7 +12,9 @@ #include ".\view_ins.h" #include "midi.h" -#define ENV_ZOOM 4 +#define ENV_ZOOM 4.0f +#define ENV_MIN_ZOOM 2.0f +#define ENV_MAX_ZOOM 100.0f #define ENV_DRAGLOOPSTART (MAX_ENVPOINTS + 1) #define ENV_DRAGLOOPEND (MAX_ENVPOINTS + 2) #define ENV_DRAGSUSTAINSTART (MAX_ENVPOINTS + 3) @@ -45,6 +47,8 @@ ID_SEPARATOR, ID_ENVELOPE_VIEWGRID, //rewbs.envRowGrid ID_SEPARATOR, + ID_ENVELOPE_ZOOM_IN, + ID_ENVELOPE_ZOOM_OUT, }; @@ -81,6 +85,8 @@ ON_COMMAND(ID_ENVELOPE_PITCH, OnEnvPitchChanged) ON_COMMAND(ID_ENVELOPE_FILTER, OnEnvFilterChanged) ON_COMMAND(ID_ENVELOPE_VIEWGRID, OnEnvToggleGrid) //rewbs.envRowGrid + ON_COMMAND(ID_ENVELOPE_ZOOM_IN, OnEnvZoomIn) + ON_COMMAND(ID_ENVELOPE_ZOOM_OUT, OnEnvZoomOut) ON_COMMAND(ID_ENVSEL_VOLUME, OnSelectVolumeEnv) ON_COMMAND(ID_ENVSEL_PANNING, OnSelectPanningEnv) ON_COMMAND(ID_ENVSEL_PITCH, OnSelectPitchEnv) @@ -118,7 +124,7 @@ m_GridScrollPos = -1; //end rewbs.envRowGrid m_nDragItem = 1; - + m_fZoom = ENV_ZOOM; } @@ -142,9 +148,9 @@ SIZE sizeTotal, sizePage, sizeLine; UINT ntickmax = EnvGetTick(EnvGetLastPoint()); - sizeTotal.cx = (ntickmax + 2) * ENV_ZOOM; + sizeTotal.cx = (INT)((ntickmax + 2) * m_fZoom); sizeTotal.cy = 1; - sizeLine.cx = ENV_ZOOM; + sizeLine.cx = (INT)m_fZoom; sizeLine.cy = 2; sizePage.cx = sizeLine.cx * 4; sizePage.cy = sizeLine.cy; @@ -625,7 +631,7 @@ int CViewInstrument::TickToScreen(int nTick) const //------------------------------------------------ { - return ((nTick+1) * ENV_ZOOM) - GetScrollPos(SB_HORZ); + return ((int)((nTick + 1) * m_fZoom)) - GetScrollPos(SB_HORZ); } int CViewInstrument::PointToScreen(int nPoint) const @@ -638,14 +644,14 @@ int CViewInstrument::ScreenToTick(int x) const //-------------------------------------------- { - return (GetScrollPos(SB_HORZ) + x + 1 - ENV_ZOOM) / ENV_ZOOM; + return (int)(((float)GetScrollPos(SB_HORZ) + (float)x + 1 - m_fZoom) / m_fZoom); } int CViewInstrument::QuickScreenToTick(int x, int cachedScrollPos) const //---------------------------------------------------------------------- { - return (cachedScrollPos + x + 1 - ENV_ZOOM) / ENV_ZOOM; + return (int)(((float)cachedScrollPos + (float)x + 1 - m_fZoom) / m_fZoom); } int CViewInstrument::ScreenToValue(int y) const @@ -745,6 +751,8 @@ case ID_ENVELOPE_FILTER: if (!(pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else if (EnvGetFilterEnv()) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_VIEWGRID: if (m_bGrid) dwStyle |= NCBTNS_CHECKED; break; + case ID_ENVELOPE_ZOOM_IN: if (m_fZoom >= ENV_MAX_ZOOM) dwStyle |= NCBTNS_DISABLED; break; + case ID_ENVELOPE_ZOOM_OUT: if (m_fZoom <= ENV_MIN_ZOOM) dwStyle |= NCBTNS_DISABLED; break; } if (m_nBtnMouseOver == i) { @@ -884,10 +892,10 @@ // Drawing Loop Start/End if (EnvGetLoop()) { - int x1 = PointToScreen(EnvGetLoopStart()) - (ENV_ZOOM/2); + int x1 = PointToScreen(EnvGetLoopStart()) - (int)(m_fZoom / 2); m_dcMemMain.MoveTo(x1, 0); m_dcMemMain.LineTo(x1, m_rcClient.bottom); - int x2 = PointToScreen(EnvGetLoopEnd()) + (ENV_ZOOM/2); + int x2 = PointToScreen(EnvGetLoopEnd()) + (int)(m_fZoom / 2); m_dcMemMain.MoveTo(x2, 0); m_dcMemMain.LineTo(x2, m_rcClient.bottom); } @@ -897,12 +905,12 @@ m_dcMemMain.SelectObject(CMainFrame::penHalfDarkGray); int nspace = m_rcClient.bottom/4; int n1 = EnvGetSustainStart(); - int x1 = PointToScreen(n1) - (ENV_ZOOM/2); + int x1 = PointToScreen(n1) - (int)(m_fZoom / 2); int y1 = ValueToScreen(EnvGetValue(n1)); m_dcMemMain.MoveTo(x1, y1 - nspace); m_dcMemMain.LineTo(x1, y1+nspace); int n2 = EnvGetSustainEnd(); - int x2 = PointToScreen(n2) + (ENV_ZOOM/2); + int x2 = PointToScreen(n2) + (int)(m_fZoom / 2); int y2 = ValueToScreen(EnvGetValue(n2)); m_dcMemMain.MoveTo(x2, y2-nspace); m_dcMemMain.LineTo(x2, y2+nspace); @@ -916,7 +924,7 @@ UINT releaseNode = EnvGetReleaseNode(); for (UINT i=0; i<=maxpoint; i++) { - int x = (EnvGetTick(i) + 1) * ENV_ZOOM - nScrollPos; + int x = (int)((EnvGetTick(i) + 1) * m_fZoom) - nScrollPos; int y = ValueToScreen(EnvGetValue(i)); rect.left = x - 3; rect.top = y - 3; @@ -1222,6 +1230,8 @@ case ID_ENVELOPE_FILTER: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOFILTERSWITCH : IIMAGE_FILTERSWITCH; break; case ID_INSTRUMENT_SAMPLEMAP: nImage = IIMAGE_SAMPLEMAP; break; case ID_ENVELOPE_VIEWGRID: nImage = IIMAGE_GRID; break; + case ID_ENVELOPE_ZOOM_IN: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOZOOMIN : IIMAGE_ZOOMIN; break; + case ID_ENVELOPE_ZOOM_OUT: nImage = (dwStyle & NCBTNS_DISABLED) ? IIMAGE_NOZOOMOUT : IIMAGE_ZOOMOUT; break; } pDC->Draw3dRect(rect.left-1, rect.top-1, ENV_LEFTBAR_CXBTN+2, ENV_LEFTBAR_CYBTN+2, c3, c4); pDC->Draw3dRect(rect.left, rect.top, ENV_LEFTBAR_CXBTN, ENV_LEFTBAR_CYBTN, c1, c2); @@ -1467,12 +1477,12 @@ if (pt.x <= 0) { UpdateScrollSize(); - OnScrollBy(CSize(pt.x-ENV_ZOOM, 0), TRUE); + OnScrollBy(CSize(pt.x - (int)m_fZoom, 0), TRUE); } if (pt.x >= m_rcClient.right-1) { UpdateScrollSize(); - OnScrollBy(CSize(ENV_ZOOM+pt.x-m_rcClient.right, 0), TRUE); + OnScrollBy(CSize((int)m_fZoom + pt.x - m_rcClient.right, 0), TRUE); } pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); @@ -1487,7 +1497,7 @@ rect.top = ValueToScreen(EnvGetValue(EnvGetSustainStart())) - nspace; rect.bottom = rect.top + nspace * 2; rect.right = PointToScreen(EnvGetSustainStart()) + 1; - rect.left = rect.right - ENV_ZOOM*2; + rect.left = rect.right - (int)(m_fZoom * 2); if (rect.PtInRect(pt)) { bSplitCursor = TRUE; // ENV_DRAGSUSTAINSTART; @@ -1496,7 +1506,7 @@ rect.top = ValueToScreen(EnvGetValue(EnvGetSustainEnd())) - nspace; rect.bottom = rect.top + nspace * 2; rect.left = PointToScreen(EnvGetSustainEnd()) - 1; - rect.right = rect.left + ENV_ZOOM*2; + rect.right = rect.left + (int)(m_fZoom *2); if (rect.PtInRect(pt)) bSplitCursor = TRUE; // ENV_DRAGSUSTAINEND; } } @@ -1505,14 +1515,14 @@ rect.top = m_rcClient.top; rect.bottom = m_rcClient.bottom; rect.right = PointToScreen(EnvGetLoopStart()) + 1; - rect.left = rect.right - ENV_ZOOM*2; + rect.left = rect.right - (int)(m_fZoom * 2); if (rect.PtInRect(pt)) { bSplitCursor = TRUE; // ENV_DRAGLOOPSTART; } else { rect.left = PointToScreen(EnvGetLoopEnd()) - 1; - rect.right = rect.left + ENV_ZOOM*2; + rect.right = rect.left + (int)(m_fZoom * 2); if (rect.PtInRect(pt)) bSplitCursor = TRUE; // ENV_DRAGLOOPEND; } } @@ -1564,7 +1574,7 @@ rect.top = ValueToScreen(EnvGetValue(EnvGetSustainStart())) - nspace; rect.bottom = rect.top + nspace * 2; rect.right = PointToScreen(EnvGetSustainStart()) + 1; - rect.left = rect.right - ENV_ZOOM*2; + rect.left = rect.right - (int)(m_fZoom * 2); if (rect.PtInRect(pt)) { m_nDragItem = ENV_DRAGSUSTAINSTART; @@ -1573,7 +1583,7 @@ rect.top = ValueToScreen(EnvGetValue(EnvGetSustainEnd())) - nspace; rect.bottom = rect.top + nspace * 2; rect.left = PointToScreen(EnvGetSustainEnd()) - 1; - rect.right = rect.left + ENV_ZOOM*2; + rect.right = rect.left + (int)(m_fZoom * 2); if (rect.PtInRect(pt)) m_nDragItem = ENV_DRAGSUSTAINEND; } } @@ -1582,14 +1592,14 @@ rect.top = m_rcClient.top; rect.bottom = m_rcClient.bottom; rect.right = PointToScreen(EnvGetLoopStart()) + 1; - rect.left = rect.right - ENV_ZOOM * 2; + rect.left = rect.right - (int)(m_fZoom * 2); if (rect.PtInRect(pt)) { m_nDragItem = ENV_DRAGLOOPSTART; } else { rect.left = PointToScreen(EnvGetLoopEnd()) - 1; - rect.right = rect.left + ENV_ZOOM*2; + rect.right = rect.left + (int)(m_fZoom * 2); if (rect.PtInRect(pt)) m_nDragItem = ENV_DRAGLOOPEND; } } @@ -1813,7 +1823,7 @@ //rewbs.envRowGrid void CViewInstrument::OnEnvToggleGrid() -//---------------------------------------- +//------------------------------------- { m_bGrid = !m_bGrid; if (m_bGrid) @@ -1862,7 +1872,7 @@ void CViewInstrument::PlayNote(UINT note) -//----------------------------------------------------------------- +//--------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); @@ -2187,6 +2197,8 @@ case kcInstrumentNew: SendCtrlMessage(IDC_INSTRUMENT_NEW); return wParam; // envelope editor + case kcInstrumentEnvelopeZoomIn: OnEnvZoomIn(); return wParam; + case kcInstrumentEnvelopeZoomOut: OnEnvZoomOut(); return wParam; case kcInstrumentEnvelopePointPrev: EnvKbdSelectPrevPoint(); return wParam; case kcInstrumentEnvelopePointNext: EnvKbdSelectNextPoint(); return wParam; case kcInstrumentEnvelopePointMoveLeft: EnvKbdMovePointLeft(); return wParam; @@ -2242,6 +2254,17 @@ } +void CViewInstrument::EnvSetZoom(float fNewZoom) +//---------------------------------------------- +{ + m_fZoom = fNewZoom; + Limit(m_fZoom, ENV_MIN_ZOOM, ENV_MAX_ZOOM); + InvalidateRect(NULL, FALSE); + UpdateScrollSize(); + UpdateNcButtonState(); +} + + //////////////////////////////////////// // Envelope Editor - Keyboard actions Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2010-02-22 20:53:09 UTC (rev 508) +++ trunk/OpenMPT/mptrack/View_ins.h 2010-02-23 15:53:10 UTC (rev 509) @@ -6,7 +6,7 @@ #define INSSTATUS_SPLITCURSOR 0x04 // Non-Client toolbar buttons -#define ENV_LEFTBAR_BUTTONS 17 +#define ENV_LEFTBAR_BUTTONS 19 //========================================== class CViewInstrument: public CModScrollView @@ -34,6 +34,8 @@ CDC m_dcMemMain; CBitmap m_bmpMemMain; CBitmap* oldBitmap; + + float m_fZoom; //rewbs.envRowGrid public: @@ -133,6 +135,10 @@ void PlayNote(UINT note); //rewbs.customKeys void DrawGrid(CDC *memDC, UINT speed); //rewbs.envRowGrid + void OnEnvZoomIn() { EnvSetZoom(m_fZoom + 1); }; + void OnEnvZoomOut() { EnvSetZoom(m_fZoom - 1); }; + void EnvSetZoom(float fNewZoom); + public: //{{AFX_VIRTUAL(CViewInstrument) virtual void OnDraw(CDC *); Modified: trunk/OpenMPT/mptrack/res/envbar.bmp =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-02-22 20:53:09 UTC (rev 508) +++ trunk/OpenMPT/mptrack/resource.h 2010-02-23 15:53:10 UTC (rev 509) @@ -1203,6 +1203,8 @@ #define ID_NOTEMAP_TRANS_UP 60446 #define ID_NOTEMAP_TRANS_DOWN 60447 #define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448 +#define ID_ENVELOPE_ZOOM_IN 60449 +#define ID_ENVELOPE_ZOOM_OUT 60450 // Next default values for new objects // @@ -1210,7 +1212,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 526 -#define _APS_NEXT_COMMAND_VALUE 60449 +#define _APS_NEXT_COMMAND_VALUE 60451 #define _APS_NEXT_CONTROL_VALUE 2427 #define _APS_NEXT_SYMED_VALUE 901 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-08 14:26:12
|
Revision: 519 http://modplug.svn.sourceforge.net/modplug/?rev=519&view=rev Author: saga-games Date: 2010-03-08 14:26:04 +0000 (Mon, 08 Mar 2010) Log Message: ----------- [Fix] Sample Undo: If no custom value was set, the default value was set ridiculously high (tx Paul Legovitch) [Fix] Sample Undo: Fixed another possible problem when undoing actions with very little memory left. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Undo.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-07 16:25:09 UTC (rev 518) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-08 14:26:04 UTC (rev 519) @@ -203,7 +203,7 @@ | PATTERN_SHOWPREVIOUS | PATTERN_CONTSCROLL | PATTERN_SYNCMUTE | PATTERN_AUTODELAY | PATTERN_NOTEFADE; DWORD CMainFrame::m_nRowSpacing = 16; DWORD CMainFrame::m_nRowSpacing2 = 4; -UINT CMainFrame::m_nSampleUndoMaxBuffer = 100 << 20; +UINT CMainFrame::m_nSampleUndoMaxBuffer = 0; // Real sample buffer undo size will be set later. // GDI HICON CMainFrame::m_hIcon = NULL; @@ -446,7 +446,7 @@ CSoundFile::s_DefaultPlugVolumeHandling = static_cast<uint8>(GetPrivateProfileInt("Misc", "DefaultPlugVolumeHandling", PLUGIN_VOLUMEHANDLING_IGNORE, iniFile)); if(CSoundFile::s_DefaultPlugVolumeHandling > 2) CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; - m_nSampleUndoMaxBuffer = GetPrivateProfileLong("Sample Editor" , "UndoBufferSize", m_nSampleUndoMaxBuffer, iniFile); + m_nSampleUndoMaxBuffer = GetPrivateProfileLong("Sample Editor" , "UndoBufferSize", m_nSampleUndoMaxBuffer >> 20, iniFile); m_nSampleUndoMaxBuffer = max(1, m_nSampleUndoMaxBuffer) << 20; TCHAR szPath[_MAX_PATH] = ""; Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2010-03-07 16:25:09 UTC (rev 518) +++ trunk/OpenMPT/mptrack/Undo.cpp 2010-03-08 14:26:04 UTC (rev 519) @@ -343,7 +343,7 @@ case sundo_delete: // insert deleted data pNewSample = pSndFile->AllocateSample(pUndo->OldSample.GetSampleSizeInBytes() + 4 * nBytesPerSample); - if(pNewSample == nullptr && pUndo->OldSample.nLength > 0) return false; + if(pNewSample == nullptr) return false; memcpy(pNewSample, pCurrentSample, pUndo->nChangeStart * nBytesPerSample); memcpy(pNewSample + pUndo->nChangeStart * nBytesPerSample, pUndo->SamplePtr, nChangeLen * nBytesPerSample); memcpy(pNewSample + pUndo->nChangeEnd * nBytesPerSample, pCurrentSample + pUndo->nChangeStart * nBytesPerSample, (pUndo->OldSample.nLength - pUndo->nChangeEnd) * nBytesPerSample); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-12 23:35:23
|
Revision: 526 http://modplug.svn.sourceforge.net/modplug/?rev=526&view=rev Author: saga-games Date: 2010-03-12 23:35:13 +0000 (Fri, 12 Mar 2010) Log Message: ----------- [Fix] Treeview: A crash could occour if the instrument library path was too long (f.e. because of malicious strings in the [Paths] section of the INI file) [Imp] Treeview: J2B files were not shown in treeview. [Ref] Added portable mode flag to CTrackApp class. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-12 18:28:00 UTC (rev 525) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-12 23:35:13 UTC (rev 526) @@ -845,6 +845,7 @@ strcpy(m_szPluginCacheFileName, m_szConfigDirectory); // plugin cache strcat(m_szPluginCacheFileName, "plugin.cache"); + m_bPortableMode = bIsAppDir; } BOOL CTrackApp::InitInstance() Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-12 18:28:00 UTC (rev 525) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-12 23:35:13 UTC (rev 526) @@ -158,6 +158,7 @@ TCHAR m_szConfigFileName[_MAX_PATH]; TCHAR m_szPluginCacheFileName[_MAX_PATH]; TCHAR m_szStringsFileName[_MAX_PATH]; + bool m_bPortableMode; #ifdef UPDATECHECKENABLED // Internet request context @@ -201,6 +202,7 @@ BOOL IsWaveExEnabled() const { return m_bExWaveSupport; } BOOL IsDebug() const { return m_bDebugMode; } LPCSTR GetConfigFileName() const { return m_szConfigFileName; } + bool IsPortableMode() const { return m_bPortableMode; } LPCSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; } LPCSTR GetConfigPath() const { return m_szConfigDirectory; } void SetupPaths(); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-12 18:28:00 UTC (rev 525) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-12 23:35:13 UTC (rev 526) @@ -1615,8 +1615,14 @@ } } } + + // The path is too long - we can't continue. This can actually only happen with an invalid path + if(strlen(szPath) >= ARRAYELEMCOUNT(szPath) - 1) + return; + // Enumerating Directories and samples/instruments - if (szPath[strlen(szPath)-1] != '\\') strcat(szPath, "\\"); + if (szPath[strlen(szPath) - 1] != '\\') + strcat(szPath, "\\"); strcpy(m_szInstrLibPath, szPath); strcat(szPath, "*.*"); memset(&wfd, 0, sizeof(wfd)); @@ -1701,6 +1707,7 @@ || (!lstrcmpi(s, ".wow")) || (!lstrcmpi(s, ".gdm")) || (!lstrcmpi(s, ".imf")) + || (!lstrcmpi(s, ".j2b")) #ifndef NO_MO3_SUPPORT || (!lstrcmpi(s, ".mo3")) #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-13 14:17:41
|
Revision: 528 http://modplug.svn.sourceforge.net/modplug/?rev=528&view=rev Author: saga-games Date: 2010-03-13 14:17:33 +0000 (Sat, 13 Mar 2010) Log Message: ----------- [Imp] Sample Editor: Remember previous settings in RAW import dialog [New] Sample Editor: Option to not ask for RAW import settings again (settings are remembered independently for all modules) Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 00:22:53 UTC (rev 527) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 14:17:33 UTC (rev 528) @@ -159,6 +159,7 @@ { m_nSample = 1; m_nLockCount = 1; + m_nPreviousRawFormat = 0; } @@ -722,9 +723,17 @@ if (!bOk) { CRawSampleDlg dlg(this); + if(m_nPreviousRawFormat != 0) + { + dlg.m_nFormat = m_nPreviousRawFormat; + dlg.m_bRememberFormat = true; + } EndWaitCursor(); - if (dlg.DoModal() == IDOK) + if ((m_nPreviousRawFormat != 0) || (dlg.DoModal() == IDOK)) { + + m_nPreviousRawFormat = ((dlg.m_bRememberFormat)) ? dlg.m_nFormat : 0; + BeginWaitCursor(); UINT flags = 0; MODSAMPLE *pSmp = &m_pSndFile->Samples[m_nSample]; Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 00:22:53 UTC (rev 527) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 14:17:33 UTC (rev 528) @@ -32,6 +32,7 @@ uint32 m_nOverlapMs; uint16 m_nFinetuneStep; // Increment finetune by x when using spin control. Default = 25 enum {nDefaultStretchChunkSize = 8192}; + UINT m_nPreviousRawFormat; CComboBox m_ComboPitch, m_ComboQuality, m_ComboFFT; Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2010-03-13 00:22:53 UTC (rev 527) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2010-03-13 14:17:33 UTC (rev 528) @@ -1066,6 +1066,9 @@ // CRawSampleDlg +UINT CRawSampleDlg::m_nFormat = 0; + + BOOL CRawSampleDlg::OnInitDialog() //-------------------------------- { @@ -1082,6 +1085,7 @@ if (IsDlgButtonChecked(IDC_RADIO2)) m_nFormat |= 1; if (IsDlgButtonChecked(IDC_RADIO4)) m_nFormat |= 2; if (IsDlgButtonChecked(IDC_RADIO6)) m_nFormat |= 4; + m_bRememberFormat = IsDlgButtonChecked(IDC_CHK_REMEMBERSETTINGS) ? true : false; CDialog::OnOK(); } @@ -1092,6 +1096,7 @@ CheckRadioButton(IDC_RADIO1, IDC_RADIO2, (m_nFormat & 1) ? IDC_RADIO2 : IDC_RADIO1); CheckRadioButton(IDC_RADIO3, IDC_RADIO4, (m_nFormat & 2) ? IDC_RADIO4 : IDC_RADIO3); CheckRadioButton(IDC_RADIO5, IDC_RADIO6, (m_nFormat & 4) ? IDC_RADIO6 : IDC_RADIO5); + CheckDlgButton(IDC_CHK_REMEMBERSETTINGS, (m_bRememberFormat) ? MF_CHECKED : MF_UNCHECKED); } Modified: trunk/OpenMPT/mptrack/Mpdlgs.h =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.h 2010-03-13 00:22:53 UTC (rev 527) +++ trunk/OpenMPT/mptrack/Mpdlgs.h 2010-03-13 14:17:33 UTC (rev 528) @@ -134,10 +134,15 @@ //================================= { public: - UINT m_nFormat; + static UINT m_nFormat; + bool m_bRememberFormat; public: - CRawSampleDlg(CWnd *parent=NULL):CDialog(IDD_LOADRAWSAMPLE, parent) { m_nFormat = 0; } + CRawSampleDlg(CWnd *parent = NULL):CDialog(IDD_LOADRAWSAMPLE, parent) + { + //m_nFormat = 0; + m_bRememberFormat = false; + } protected: virtual BOOL OnInitDialog(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2010-03-13 00:22:53 UTC (rev 527) +++ trunk/OpenMPT/mptrack/mptrack.rc 2010-03-13 14:17:33 UTC (rev 528) @@ -424,23 +424,25 @@ CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,196,232,11,14 END -IDD_LOADRAWSAMPLE DIALOGEX 0, 0, 178, 89 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_LOADRAWSAMPLE DIALOGEX 0, 0, 178, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Unknown file type" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,66,66,50,14 - PUSHBUTTON "Cancel",IDCANCEL,120,66,50,14 - GROUPBOX "",IDC_STATIC,6,24,48,34,WS_GROUP + DEFPUSHBUTTON "OK",IDOK,66,72,50,14 + PUSHBUTTON "Cancel",IDCANCEL,120,72,50,14 + GROUPBOX "",IDC_STATIC,6,18,48,34,WS_GROUP LTEXT "Load it as a raw sample of the following format:",IDC_STATIC,6,6,156,12 - CONTROL "8-bit",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,12,32,29,10 - CONTROL "16-bit",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,12,44,33,10 - GROUPBOX "",IDC_STATIC,60,24,54,34,WS_GROUP - CONTROL "Unsigned",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,64,32,46,10 - CONTROL "Signed",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,64,44,38,10 - GROUPBOX "",IDC_STATIC,120,24,51,34,WS_GROUP - CONTROL "Mono",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,126,32,34,10 - CONTROL "Stereo",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,126,44,37,10 + CONTROL "8-bit",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,12,26,29,10 + CONTROL "16-bit",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,12,38,33,10 + GROUPBOX "",IDC_STATIC,60,18,54,34,WS_GROUP + CONTROL "Unsigned",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,64,26,46,10 + CONTROL "Signed",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,64,38,38,10 + GROUPBOX "",IDC_STATIC,120,18,51,34,WS_GROUP + CONTROL "Mono",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,126,26,34,10 + CONTROL "Stereo",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,126,38,37,10 + CONTROL "Remember these settings",IDC_CHK_REMEMBERSETTINGS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,54,168,12 END IDD_CONTROL_GLOBALS DIALOGEX 0, 0, 561, 94 @@ -1550,7 +1552,7 @@ IDD_LOADRAWSAMPLE, DIALOG BEGIN RIGHTMARGIN, 156 - BOTTOMMARGIN, 88 + BOTTOMMARGIN, 94 END IDD_CONTROL_COMMENTS, DIALOG Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-03-13 00:22:53 UTC (rev 527) +++ trunk/OpenMPT/mptrack/resource.h 2010-03-13 14:17:33 UTC (rev 528) @@ -948,6 +948,7 @@ #define IDC_EDIT_PRESET_EXPR 2424 #define IDC_LIST_SAMPLEGEN_PRESETS 2425 #define IDC_CHECK_UNDO 2426 +#define IDC_CHK_REMEMBERSETTINGS 2427 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -1200,11 +1201,11 @@ #define ID_SAMPLE_GENERATOR_MENU 60244 #define ID_SAMPLE_GENERATOR_PRESET_MENU 60344 #define ID_SAMPLE_GENERATE 60445 -#define ID_NOTEMAP_TRANS_UP 60446 -#define ID_NOTEMAP_TRANS_DOWN 60447 -#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448 -#define ID_ENVELOPE_ZOOM_IN 60449 -#define ID_ENVELOPE_ZOOM_OUT 60450 +#define ID_NOTEMAP_TRANS_UP 60446 +#define ID_NOTEMAP_TRANS_DOWN 60447 +#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448 +#define ID_ENVELOPE_ZOOM_IN 60449 +#define ID_ENVELOPE_ZOOM_OUT 60450 // Next default values for new objects // @@ -1213,7 +1214,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 526 #define _APS_NEXT_COMMAND_VALUE 60451 -#define _APS_NEXT_CONTROL_VALUE 2427 +#define _APS_NEXT_CONTROL_VALUE 2428 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-13 16:02:53
|
Revision: 529 http://modplug.svn.sourceforge.net/modplug/?rev=529&view=rev Author: saga-games Date: 2010-03-13 16:02:46 +0000 (Sat, 13 Mar 2010) Log Message: ----------- [Ref] Removed unnecessary ancient code change comments, fixed some compiler warnings in sample editor Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/View_smp.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 14:17:33 UTC (rev 528) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 16:02:46 UTC (rev 529) @@ -53,8 +53,6 @@ #define BASENOTE_MIN (1*12) // C-1 #define BASENOTE_MAX (9*12) // C-9 -#pragma warning(disable:4244) - BEGIN_MESSAGE_MAP(CCtrlSamples, CModControlDlg) //{{AFX_MSG_MAP(CCtrlSamples) ON_WM_VSCROLL() @@ -321,12 +319,12 @@ } -BOOL CCtrlSamples::SetCurrentSample(UINT nSmp, LONG lZoom, BOOL bUpdNum) -//---------------------------------------------------------------------- +bool CCtrlSamples::SetCurrentSample(SAMPLEINDEX nSmp, LONG lZoom, bool bUpdNum) +//----------------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); CSoundFile *pSndFile; - if (!pModDoc) return FALSE; + if (!pModDoc) return false; pSndFile = pModDoc->GetSoundFile(); if (pSndFile->m_nSamples < 1) pSndFile->m_nSamples = 1; if ((nSmp < 1) || (nSmp > pSndFile->m_nSamples)) return FALSE; @@ -335,7 +333,6 @@ if (m_nSample != nSmp) { m_nSample = nSmp; - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, NULL); } if (bUpdNum) @@ -349,7 +346,7 @@ m_ComboZoom.SetCurSel(lZoom); PostViewMessage(VIEWMSG_SETCURRENTSAMPLE, (lZoom << 16) | m_nSample); UnlockControls(); - return TRUE; + return true; } @@ -392,12 +389,11 @@ } } } - SetCurrentSample((lParam > 0) ? lParam : m_nSample); + SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample); - m_nFinetuneStep = CMainFrame::GetPrivateProfileLong("Sample Editor", "FinetuneStep", 25, theApp.GetConfigFileName()); + m_nFinetuneStep = (uint16)GetPrivateProfileInt("Sample Editor", "FinetuneStep", 25, theApp.GetConfigFileName()); // Initial Update - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] if (!m_bInitialized) UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_MODTYPE, NULL); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetSampleViewState()); @@ -428,7 +424,7 @@ break; case CTRLMSG_SMP_OPENFILE: - if (lParam) return OpenSample((LPCSTR)lParam); + if (lParam) return OpenSample((LPCSTR)lParam) ? TRUE : FALSE; break; case CTRLMSG_SMP_SONGDROP: @@ -437,7 +433,7 @@ LPDRAGONDROP pDropInfo = (LPDRAGONDROP)lParam; CSoundFile *pSndFile = (CSoundFile *)(pDropInfo->lDropParam); if (pDropInfo->pModDoc) pSndFile = pDropInfo->pModDoc->GetSoundFile(); - if (pSndFile) return OpenSample(pSndFile, pDropInfo->dwDropItem); + if (pSndFile) return OpenSample(pSndFile, (SAMPLEINDEX)pDropInfo->dwDropItem) ? TRUE : FALSE; } break; @@ -446,7 +442,7 @@ break; case CTRLMSG_SETCURRENTINSTRUMENT: - SetCurrentSample(lParam, -1, TRUE); + SetCurrentSample((SAMPLEINDEX)lParam, -1, TRUE); break; //rewbs.customKeys @@ -535,8 +531,6 @@ m_ToolBar2.UpdateStyle(); } if (!(dwHintMask & (HINT_SAMPLEINFO|HINT_MODTYPE))) return; - // 05/01/05 : ericus replaced ">> 24" by ">> 20" : 4000 samples -> 12bits [see Moddoc.h] - //if (((dwHintMask >> 20) != (m_nSample&0x0fff)) && (!(dwHintMask & HINT_MODTYPE))) return; if (((dwHintMask >> HINT_SHIFT_SMP) != m_nSample) && (!(dwHintMask & HINT_MODTYPE))) return; LockControls(); if (!m_bInitialized) dwHintMask |= HINT_MODTYPE; @@ -691,35 +685,32 @@ } -BOOL CCtrlSamples::OpenSample(LPCSTR lpszFileName) +bool CCtrlSamples::OpenSample(LPCSTR lpszFileName) //------------------------------------------------ { CMappedFile f; CHAR szName[_MAX_FNAME], szExt[_MAX_EXT]; LPBYTE lpFile; DWORD len; - BOOL bOk; + bool bOk = false; BeginWaitCursor(); if ((!lpszFileName) || (!f.Open(lpszFileName))) { EndWaitCursor(); - return FALSE; + return false; } len = f.GetLength(); if (len > CTrackApp::gMemStatus.dwTotalPhys) len = CTrackApp::gMemStatus.dwTotalPhys; - bOk = FALSE; lpFile = f.Lock(len); if (!lpFile) goto OpenError; BEGIN_CRITICAL(); m_pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace); + bOk = m_pSndFile->ReadSampleFromFile(m_nSample, lpFile, len); - if (m_pSndFile->ReadSampleFromFile(m_nSample, lpFile, len)) - { - bOk = TRUE; - } END_CRITICAL(); + if (!bOk) { CRawSampleDlg dlg(this); @@ -772,7 +763,7 @@ } if (m_pSndFile->ReadSample(pSmp, flags, p16, l16)) { - bOk = TRUE; + bOk = true; } END_CRITICAL(); } else @@ -816,18 +807,17 @@ pSmp->nPan = 128; pSmp->uFlags |= CHN_PANNING; } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); m_pModDoc->SetModified(); } - return TRUE; + return true; } -BOOL CCtrlSamples::OpenSample(CSoundFile *pSndFile, UINT nSample) -//--------------------------------------------------------------- +bool CCtrlSamples::OpenSample(CSoundFile *pSndFile, SAMPLEINDEX nSample) +//---------------------------------------------------------------------- { - if ((!pSndFile) || (!nSample) || (nSample > pSndFile->m_nSamples)) return FALSE; + if ((!pSndFile) || (!nSample) || (nSample > pSndFile->m_nSamples)) return false; BeginWaitCursor(); BEGIN_CRITICAL(); @@ -841,11 +831,10 @@ pSmp->uFlags |= CHN_PANNING; } END_CRITICAL(); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); m_pModDoc->SetModified(); EndWaitCursor(); - return TRUE; + return true; } @@ -857,7 +846,7 @@ { if ((!IsLocked()) && (m_pSndFile)) { - UINT n = GetDlgItemInt(IDC_EDIT_SAMPLE); + SAMPLEINDEX n = (SAMPLEINDEX)GetDlgItemInt(IDC_EDIT_SAMPLE); if ((n > 0) && (n <= m_pSndFile->m_nSamples) && (n != m_nSample)) { SetCurrentSample(n, -1, FALSE); @@ -913,7 +902,6 @@ } } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (smp << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES); if ((pSndFile->m_nInstruments) && (!m_pModDoc->FindSampleParent(smp))) { @@ -1102,7 +1090,7 @@ return; //Default case: Normalize current sample - UINT iMinSample = m_nSample, iMaxSample = m_nSample; + SAMPLEINDEX iMinSample = m_nSample, iMaxSample = m_nSample; //If only one sample is selected, parts of it may be amplified UINT iStart = 0, iEnd = 0; @@ -1124,20 +1112,22 @@ BeginWaitCursor(); - BOOL bModified = FALSE; + bool bModified = false; - for(UINT iSmp = iMinSample; iSmp <= iMaxSample; iSmp++) + for(SAMPLEINDEX iSmp = iMinSample; iSmp <= iMaxSample; iSmp++) { if (m_pSndFile->Samples[iSmp].pSample) { - BOOL bOk = FALSE; + bool bOk = false; MODSAMPLE *pSmp = &m_pSndFile->Samples[iSmp]; - if(iMinSample != iMaxSample) { + if(iMinSample != iMaxSample) + { //if more than one sample is selected, always amplify the whole sample. iStart = 0; iEnd = pSmp->nLength; - } else { + } else + { //one sample: correct the boundaries, if needed if (iEnd > pSmp->nLength) iEnd = pSmp->nLength; if (iStart > iEnd) iStart = iEnd; @@ -1153,7 +1143,7 @@ if (pSmp->uFlags & CHN_16BIT) { - signed short *p = (signed short *)pSmp->pSample; + int16 *p = (int16 *)pSmp->pSample; int max = 1; for (UINT i = iStart; i < iEnd; i++) { @@ -1165,14 +1155,14 @@ max++; for (UINT j = iStart; j < iEnd; j++) { - int l = p[j]; - p[j] = (l << 15) / max; + int l = (((int)p[j]) << 15) / max; + p[j] = (int16)l; } - bModified = bOk = TRUE; + bModified = bOk = true; } } else { - signed char *p = (signed char *)pSmp->pSample; + int8 *p = (int8 *)pSmp->pSample; int max = 1; for (UINT i = iStart; i < iEnd; i++) { @@ -1184,10 +1174,10 @@ max++; for (UINT j = iStart; j < iEnd; j++) { - int l = p[j]; - p[j] = (l << 7) / max; + int l = (((int)p[j]) << 7) / max; + p[j] = (int8)l; } - bModified = bOk = TRUE; + bModified = bOk = true; } } @@ -1253,7 +1243,6 @@ } } m_pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); m_pModDoc->SetModified(); EndWaitCursor(); @@ -1267,7 +1256,7 @@ if(!m_pModDoc || !m_pSndFile) return; - UINT iMinSample = m_nSample, iMaxSample = m_nSample; + SAMPLEINDEX iMinSample = m_nSample, iMaxSample = m_nSample; //Shift -> Process all samples if(CMainFrame::GetInputHandler()->ShiftPressed()) @@ -1284,11 +1273,11 @@ UINT iModified = 0; float fReportOffset = 0; - for(UINT iSmp = iMinSample; iSmp <= iMaxSample; iSmp++) + for(SAMPLEINDEX iSmp = iMinSample; iSmp <= iMaxSample; iSmp++) { UINT iStart, iEnd; - if( m_pSndFile->Samples[iSmp].pSample == nullptr ) + if(m_pSndFile->Samples[iSmp].pSample == nullptr) continue; if (iMinSample != iMaxSample) @@ -1508,7 +1497,6 @@ viewstate.dwEndSel = dwEnd + (dwEnd-dwStart); SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate); } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); m_pModDoc->SetModified(); } @@ -1643,7 +1631,6 @@ viewstate.dwEndSel = dwStart + dwRemove; SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate); } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); m_pModDoc->SetModified(); } @@ -1712,9 +1699,9 @@ //Calculate/verify samplerate at C5. long lSampleRate = pSmp->nC5Speed; if(m_pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) - lSampleRate = (double)CSoundFile::TransposeToFrequency(pSmp->RelativeTone, pSmp->nFineTune); + lSampleRate = CSoundFile::TransposeToFrequency(pSmp->RelativeTone, pSmp->nFineTune); if(lSampleRate <= 0) - lSampleRate = 8363.0; + lSampleRate = 8363; //Open dialog CPSRatioCalc dlg(pSmp->nLength, lSampleRate, @@ -1742,15 +1729,15 @@ // Time stretching if(IsDlgButtonChecked(IDC_CHECK3)){ UpdateData(TRUE); //Ensure m_dTimeStretchRatio is up-to-date with textbox content - errorcode = TimeStretch(m_dTimeStretchRatio/100.0); + errorcode = TimeStretch((float)(m_dTimeStretchRatio / 100.0)); //Update loop points only if no error occured. if(errorcode == 0) { - pSmp->nLoopStart = min(pSmp->nLoopStart * (m_dTimeStretchRatio / 100.0), pSmp->nLength); - pSmp->nLoopEnd = min(pSmp->nLoopEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength); - pSmp->nSustainStart = min(pSmp->nSustainStart * (m_dTimeStretchRatio/100.0), pSmp->nLength); - pSmp->nSustainEnd = min(pSmp->nSustainEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength); + pSmp->nLoopStart = (UINT)min(pSmp->nLoopStart * (m_dTimeStretchRatio / 100.0), pSmp->nLength); + pSmp->nLoopEnd = (UINT)min(pSmp->nLoopEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength); + pSmp->nSustainStart = (UINT)min(pSmp->nSustainStart * (m_dTimeStretchRatio/100.0), pSmp->nLength); + pSmp->nSustainEnd = (UINT)min(pSmp->nSustainEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength); } } @@ -1758,8 +1745,8 @@ else{ // Get selected pitch modifier [-12,+12] CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO4); - short pm = combo->GetCurSel() - 12; - if(pm == 0) goto error; + float pm = float(combo->GetCurSel()) - 12.0f; + if(pm == 0.0f) goto error; // Compute pitch ratio in range [0.5f ; 2.0f] (1.0f means output == input) // * pitch up -> 1.0f + n / 12.0f -> (12.0f + n) / 12.0f , considering n : pitch modifier > 0 @@ -1799,8 +1786,8 @@ } -int CCtrlSamples::TimeStretch(double ratio) -//----------------------------------------- +int CCtrlSamples::TimeStretch(float ratio) +//---------------------------------------- { static HANDLE handleSt = NULL; // Handle to SoundTouch object. if((!m_pSndFile) || (!m_pSndFile->Samples[m_nSample].pSample)) return -1; @@ -1819,7 +1806,7 @@ if(ratio <= 0.0 || ratio == 1.0) return -1; // Convert to pitch factor - float pitch = Round((float)ratio, 4); + float pitch = Round(ratio, 4); if(pitch < 0.5f) return 2 + (1<<8); if(pitch > 2.0f) return 2 + (2<<8); @@ -2013,7 +2000,7 @@ // Get selected oversampling - quality - (also refered as FFT overlapping) factor CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO5); - short ovs = combo->GetCurSel() + 4; + long ovs = combo->GetCurSel() + 4; // Get selected FFT size (power of 2 ; should not exceed MAX_BUFFER_LENGTH - see smbPitchShift.h) combo = (CComboBox *)GetDlgItem(IDC_COMBO6); @@ -2054,7 +2041,7 @@ long lSampleRate = pSmp->GetSampleRate(m_pSndFile->GetType()); // Deduce max sample value (float conversion step) - float maxSampleValue = ( 1 << (smpsize * 8 - 1) ) - 1; + float maxSampleValue = float(( 1 << (smpsize * 8 - 1) ) - 1); // Allocate working buffers float * buffer = new float[MAX_BUFFER_LENGTH + fft]; @@ -2287,7 +2274,6 @@ } } m_pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); m_pModDoc->SetModified(); } @@ -2336,7 +2322,6 @@ if (strncmp(s, m_pSndFile->m_szNames[m_nSample], 32)) { memcpy(m_pSndFile->m_szNames[m_nSample], s, 32); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this); m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); m_pModDoc->SetModified(); @@ -2357,7 +2342,6 @@ if (strncmp(s, m_pSndFile->Samples[m_nSample].filename, 22)) { memcpy(m_pSndFile->Samples[m_nSample].filename, s, 22); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, this); if (m_pSndFile->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) m_pModDoc->SetModified(); } @@ -2374,7 +2358,7 @@ nVol <<= 2; if (nVol != m_pSndFile->Samples[m_nSample].nVolume) { - m_pSndFile->Samples[m_nSample].nVolume = nVol; + m_pSndFile->Samples[m_nSample].nVolume = (WORD)nVol; m_pModDoc->SetModified(); } } @@ -2389,7 +2373,7 @@ if (nVol > 64) nVol = 64; if (nVol != m_pSndFile->Samples[m_nSample].nGlobalVol) { - m_pSndFile->Samples[m_nSample].nGlobalVol = nVol; + m_pSndFile->Samples[m_nSample].nGlobalVol = (WORD)nVol; m_pModDoc->SetModified(); } } @@ -2438,7 +2422,7 @@ //end rewbs.fix36944 if (nPan != m_pSndFile->Samples[m_nSample].nPan) { - m_pSndFile->Samples[m_nSample].nPan = nPan; + m_pSndFile->Samples[m_nSample].nPan = (WORD)nPan; if (m_pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) m_pModDoc->SetModified(); } } @@ -2451,7 +2435,7 @@ int n = GetDlgItemInt(IDC_EDIT5); if (m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_S3M|MOD_TYPE_MPT)) { - if ((n > 0) && (n <= (m_pSndFile->m_nType & MOD_TYPE_S3M) ? 65535 : 9999999) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed)) + if ((n > 0) && (n <= (m_pSndFile->GetType() == MOD_TYPE_S3M ? 65535 : 9999999)) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed)) { m_pSndFile->Samples[m_nSample].nC5Speed = n; int transp = CSoundFile::FrequencyToTranspose(n) >> 7; @@ -2469,8 +2453,9 @@ } } else { - if ((n >= -128) && (n <= 127)) { - m_pSndFile->Samples[m_nSample].nFineTune = n; + if ((n >= -128) && (n <= 127)) + { + m_pSndFile->Samples[m_nSample].nFineTune = (signed char)n; m_pModDoc->SetModified(); } @@ -2482,12 +2467,12 @@ //------------------------------------- { if (IsLocked()) return; - int n = 60 - (m_CbnBaseNote.GetCurSel() + BASENOTE_MIN); + int n = (NOTE_MIDDLEC - 1) - (m_CbnBaseNote.GetCurSel() + BASENOTE_MIN); if (m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_S3M|MOD_TYPE_MPT)) { LONG ft = CSoundFile::FrequencyToTranspose(m_pSndFile->Samples[m_nSample].nC5Speed) & 0x7f; n = CSoundFile::TransposeToFrequency(n, ft); - if ((n > 0) && (n <= (m_pSndFile->m_nType & MOD_TYPE_S3M) ? 65535 : 9999999) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed)) + if ((n > 0) && (n <= (m_pSndFile->GetType() == MOD_TYPE_S3M ? 65535 : 9999999)) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed)) { CHAR s[32]; m_pSndFile->Samples[m_nSample].nC5Speed = n; @@ -2499,8 +2484,9 @@ } } else { - if ((n >= -128) && (n < 128)) { - m_pSndFile->Samples[m_nSample].RelativeTone = n; + if ((n >= -128) && (n < 128)) + { + m_pSndFile->Samples[m_nSample].RelativeTone = (signed char)n; m_pModDoc->SetModified(); } } @@ -2525,7 +2511,7 @@ m_SpinVibDepth.GetRange(lmin, lmax); int n = GetDlgItemInt(IDC_EDIT15); if ((n >= lmin) && (n <= lmax)) { - m_pSndFile->Samples[m_nSample].nVibDepth = n; + m_pSndFile->Samples[m_nSample].nVibDepth = (BYTE)n; m_pModDoc->SetModified(); } } @@ -2539,7 +2525,7 @@ m_SpinVibSweep.GetRange(lmin, lmax); int n = GetDlgItemInt(IDC_EDIT14); if ((n >= lmin) && (n <= lmax)) { - m_pSndFile->Samples[m_nSample].nVibSweep = n; + m_pSndFile->Samples[m_nSample].nVibSweep = (BYTE)n; m_pModDoc->SetModified(); } } @@ -2553,7 +2539,7 @@ m_SpinVibRate.GetRange(lmin, lmax); int n = GetDlgItemInt(IDC_EDIT16); if ((n >= lmin) && (n <= lmax)) { - m_pSndFile->Samples[m_nSample].nVibRate = n; + m_pSndFile->Samples[m_nSample].nVibRate = (BYTE)n; m_pModDoc->SetModified(); } } @@ -2605,7 +2591,6 @@ (resets sound without any reason otherwise) - bug report 1874 */ m_pModDoc->AdjustEndOfSample(m_nSample); } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); m_pModDoc->SetModified(); } @@ -2627,7 +2612,6 @@ (resets sound without any reason otherwise) - bug report 1874 */ m_pModDoc->AdjustEndOfSample(m_nSample); } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); m_pModDoc->SetModified(); } @@ -2674,7 +2658,6 @@ && ((n < (LONG)pSmp->nSustainEnd) || (!(pSmp->uFlags & CHN_SUSTAINLOOP)))) { pSmp->nSustainStart = n; - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); m_pModDoc->SetModified(); } @@ -2691,7 +2674,6 @@ && ((n > (LONG)pSmp->nSustainStart) || (!(pSmp->uFlags & CHN_SUSTAINLOOP)))) { pSmp->nSustainEnd = n; - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); m_pModDoc->SetModified(); } @@ -2702,42 +2684,45 @@ #define BIDILOOP_ACCURACY 2 // 5% -BOOL MPT_LoopCheck(int sstart0, int sstart1, int send0, int send1) +bool MPT_LoopCheck(int sstart0, int sstart1, int send0, int send1) +//---------------------------------------------------------------- { int dse0 = send0 - sstart0; - if ((dse0 < -SMPLOOP_ACCURACY) || (dse0 > SMPLOOP_ACCURACY)) return FALSE; + if ((dse0 < -SMPLOOP_ACCURACY) || (dse0 > SMPLOOP_ACCURACY)) return false; int dse1 = send1 - sstart1; - if ((dse1 < -SMPLOOP_ACCURACY) || (dse1 > SMPLOOP_ACCURACY)) return FALSE; + if ((dse1 < -SMPLOOP_ACCURACY) || (dse1 > SMPLOOP_ACCURACY)) return false; int dstart = sstart1 - sstart0; int dend = send1 - send0; if (!dstart) dstart = dend >> 7; if (!dend) dend = dstart >> 7; - if ((dstart ^ dend) < 0) return FALSE; + if ((dstart ^ dend) < 0) return false; int delta = dend - dstart; - return ((delta > -SMPLOOP_ACCURACY) && (delta < SMPLOOP_ACCURACY)) ? TRUE : FALSE; + return ((delta > -SMPLOOP_ACCURACY) && (delta < SMPLOOP_ACCURACY)) ? true : false; } -BOOL MPT_BidiEndCheck(int spos0, int spos1, int spos2) +bool MPT_BidiEndCheck(int spos0, int spos1, int spos2) +//---------------------------------------------------- { int delta0 = spos1 - spos0; int delta1 = spos2 - spos1; int delta2 = spos2 - spos0; if (!delta0) delta0 = delta1 >> 7; if (!delta1) delta1 = delta0 >> 7; - if ((delta1 ^ delta0) < 0) return FALSE; + if ((delta1 ^ delta0) < 0) return false; return ((delta0 >= -1) && (delta0 <= 0) && (delta1 >= -1) && (delta1 <= 0) && (delta2 >= -1) && (delta2 <= 0)); } -BOOL MPT_BidiStartCheck(int spos0, int spos1, int spos2) +bool MPT_BidiStartCheck(int spos0, int spos1, int spos2) +//------------------------------------------------------ { int delta1 = spos1 - spos0; int delta0 = spos2 - spos1; int delta2 = spos2 - spos0; if (!delta0) delta0 = delta1 >> 7; if (!delta1) delta1 = delta0 >> 7; - if ((delta1 ^ delta0) < 0) return FALSE; + if ((delta1 ^ delta0) < 0) return false; return ((delta0 >= -1) && (delta0 <= 0) && (delta1 > -1) && (delta1 <= 0) && (delta2 >= -1) && (delta2 <= 0)); } @@ -2752,7 +2737,7 @@ MODSAMPLE *pSmp = &m_pSndFile->Samples[nsample]; LPSTR pSample = pSmp->pSample; short int pos; - BOOL bRedraw = FALSE; + bool bRedraw = false; LockControls(); if ((!pSmp->nLength) || (!pSample)) goto NoSample; @@ -2765,7 +2750,7 @@ // Loop Start if ((pos = (short int)m_SpinLoopStart.GetPos()) != 0) { - BOOL bOk = FALSE; + bool bOk = false; LPSTR p = pSample+pSmp->nLoopStart*pinc; int find0 = (int)pSample[pSmp->nLoopEnd*pinc-pinc]; int find1 = (int)pSample[pSmp->nLoopEnd*pinc]; @@ -2802,7 +2787,7 @@ wsprintf(s, "%u", pSmp->nLoopStart); m_EditLoopStart.SetWindowText(s); m_pModDoc->AdjustEndOfSample(m_nSample); - bRedraw = TRUE; + bRedraw = true; } m_SpinLoopStart.SetPos(0); } @@ -2810,7 +2795,7 @@ pos = (short int)m_SpinLoopEnd.GetPos(); if ((pos) && (pSmp->nLoopEnd)) { - BOOL bOk = FALSE; + bool bOk = false; LPSTR p = pSample+pSmp->nLoopEnd*pinc; int find0 = (int)pSample[pSmp->nLoopStart*pinc]; int find1 = (int)pSample[pSmp->nLoopStart*pinc+pinc]; @@ -2846,7 +2831,7 @@ wsprintf(s, "%u", pSmp->nLoopEnd); m_EditLoopEnd.SetWindowText(s); m_pModDoc->AdjustEndOfSample(m_nSample); - bRedraw = TRUE; + bRedraw = true; } m_SpinLoopEnd.SetPos(0); } @@ -2854,7 +2839,7 @@ pos = (short int)m_SpinSustainStart.GetPos(); if ((pos) && (pSmp->nSustainEnd)) { - BOOL bOk = FALSE; + bool bOk = false; LPSTR p = pSample+pSmp->nSustainStart*pinc; int find0 = (int)pSample[pSmp->nSustainEnd*pinc-pinc]; int find1 = (int)pSample[pSmp->nSustainEnd*pinc]; @@ -2890,7 +2875,7 @@ { wsprintf(s, "%u", pSmp->nSustainStart); m_EditSustainStart.SetWindowText(s); - bRedraw = TRUE; + bRedraw = true; } m_SpinSustainStart.SetPos(0); } @@ -2898,7 +2883,7 @@ pos = (short int)m_SpinSustainEnd.GetPos(); if (pos) { - BOOL bOk = FALSE; + bool bOk = false; LPSTR p = pSample+pSmp->nSustainEnd*pinc; int find0 = (int)pSample[pSmp->nSustainStart*pinc]; int find1 = (int)pSample[pSmp->nSustainStart*pinc+pinc]; @@ -2933,7 +2918,7 @@ { wsprintf(s, "%u", pSmp->nSustainEnd); m_EditSustainEnd.SetWindowText(s); - bRedraw = TRUE; + bRedraw = true; } m_SpinSustainEnd.SetPos(0); } @@ -2958,18 +2943,16 @@ m_EditFineTune.SetWindowText(s); } else { - LONG d = pSmp->nFineTune + pos; - if (d < -128) d = -128; - if (d > 127) d = 127; - pSmp->nFineTune = d; + LONG d = CLAMP(pSmp->nFineTune + pos, -128, 127); + pSmp->nFineTune = (signed char)d; wsprintf(s, "%d", d); m_EditFineTune.SetWindowText(s); } m_SpinFineTune.SetPos(0); } if ((nCode == SB_ENDSCROLL) || (nCode == SB_THUMBPOSITION)) SwitchToView(); - if (bRedraw) { - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] + if (bRedraw) + { m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); m_pModDoc->SetModified(); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 14:17:33 UTC (rev 528) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 16:02:46 UTC (rev 529) @@ -37,7 +37,7 @@ CComboBox m_ComboPitch, m_ComboQuality, m_ComboFFT; int PitchShift(float pitch); - int TimeStretch(double ratio); + int TimeStretch(float ratio); void UpdateTimeStretchParameterString(); void ReadTimeStretchParameters(); @@ -50,9 +50,9 @@ CCtrlSamples(); ~CCtrlSamples(); - BOOL SetCurrentSample(UINT n, LONG lZoom=-1, BOOL bUpdNum=TRUE); - BOOL OpenSample(LPCSTR lpszFileName); - BOOL OpenSample(CSoundFile *pSndFile, UINT nSample); + bool SetCurrentSample(SAMPLEINDEX nSmp, LONG lZoom = -1, bool bUpdNum = true); + bool OpenSample(LPCSTR lpszFileName); + bool OpenSample(CSoundFile *pSndFile, SAMPLEINDEX nSample); LONG* GetSplitPosRef() {return &CMainFrame::glSampleWindowHeight;} //rewbs.varWindowSize public: Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2010-03-13 14:17:33 UTC (rev 528) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2010-03-13 16:02:46 UTC (rev 529) @@ -397,11 +397,8 @@ void CViewSample::UpdateView(DWORD dwHintMask, CObject *) //------------------------------------------------------- { - // 05/01/05 : ericus replaced ">> 24" by ">> 20" : 4000 samples -> 12bits [see Moddoc.h] - //rewbs: replaced 0xff by 0x0fff for 4000 samples. if ((dwHintMask & (HINT_MPTOPTIONS|HINT_MODTYPE)) || ((dwHintMask & HINT_SAMPLEDATA) && (m_nSample == (dwHintMask >> HINT_SHIFT_SMP))) ) - //|| ((dwHintMask & HINT_SAMPLEDATA) && ((m_nSample&0x0fff) == (dwHintMask >> 20))) ) { UpdateScrollSize(); UpdateNcButtonState(); @@ -1613,7 +1610,6 @@ pSmp->uFlags |= CHN_LOOP; pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } } @@ -1638,7 +1634,6 @@ pSmp->uFlags |= CHN_SUSTAINLOOP; pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } } @@ -1745,7 +1740,6 @@ SetCurSel(0, 0); pModDoc->AdjustEndOfSample(m_nSample); pModDoc->SetModified(); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | dwUpdateFlags, NULL); } @@ -1914,7 +1908,6 @@ SetCurSel(0, 0); pModDoc->AdjustEndOfSample(m_nSample); pModDoc->SetModified(); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } CloseClipboard(); @@ -1961,7 +1954,6 @@ END_CRITICAL(); pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); } } @@ -2005,7 +1997,7 @@ END_CRITICAL(); pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] + pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); } } @@ -2070,7 +2062,6 @@ pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); SetCurSel(0, 0); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); } EndWaitCursor(); @@ -2274,7 +2265,6 @@ if (bUpdate) { pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); pModDoc->SetModified(); } @@ -2340,7 +2330,6 @@ (resets sound without any reason otherwise) - bug report 1874 */ pModDoc->AdjustEndOfSample(m_nSample); } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } } @@ -2366,7 +2355,6 @@ (resets sound without any reason otherwise) - bug report 1874 */ pModDoc->AdjustEndOfSample(m_nSample); } - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } } @@ -2387,7 +2375,6 @@ pSmp->nSustainStart = m_dwMenuParam; pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } } @@ -2408,7 +2395,6 @@ pSmp->nSustainEnd = m_dwMenuParam; pModDoc->SetModified(); pModDoc->AdjustEndOfSample(m_nSample); - // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } } @@ -2496,7 +2482,7 @@ } LRESULT CViewSample::OnMidiMsg(WPARAM dwMidiDataParam, LPARAM) -//------------------------------------------------------- +//------------------------------------------------------------ { const DWORD dwMidiData = dwMidiDataParam; static BYTE midivolume = 127; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-09-29 06:39:02
|
Revision: 4320 http://sourceforge.net/p/modplug/code/4320 Author: manxorist Date: 2014-09-29 06:38:49 +0000 (Mon, 29 Sep 2014) Log Message: ----------- [Fix] Soundcard settings: Fix crash when opening settings dialog if the current device is unavailable (broke in r4306). [Fix] Soundcard settings: Only initialize soundcard settings page if the page got actually selected. Revision Links: -------------- http://sourceforge.net/p/modplug/code/4306 Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-09-28 09:22:57 UTC (rev 4319) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-09-29 06:38:49 UTC (rev 4320) @@ -152,26 +152,9 @@ COptionsSoundcard::COptionsSoundcard(SoundDevice::ID dev) //------------------------------------------------------- : CPropertyPage(IDD_OPTIONS_SOUNDCARD) - , m_CurrentDeviceInfo(theApp.GetSoundDevicesManager()->FindDeviceInfo(dev)) - , m_CurrentDeviceCaps(theApp.GetSoundDevicesManager()->GetDeviceCaps(dev, CMainFrame::GetMainFrame()->gpSoundDevice)) - , m_CurrentDeviceDynamicCaps(theApp.GetSoundDevicesManager()->GetDeviceDynamicCaps(dev, TrackerSettings::Instance().GetSampleRates(), CMainFrame::GetMainFrame(), CMainFrame::GetMainFrame()->gpSoundDevice, true)) - , m_Settings(TrackerSettings::Instance().GetSoundDeviceSettings(dev)) + , m_InitialDevice(dev) { - if(theApp.GetSoundDevicesManager()->IsDeviceUnavailable(dev)) - { - Reporting::Information("Device not availble. Reverting to default device."); - // if the device is unavailable, use the default device - SoundDevice::ID newdev = theApp.GetSoundDevicesManager()->FindDeviceInfoBestMatch(std::wstring()).id; - if(newdev != dev) - { - Reporting::Information("Device not availble. Reverting to default device."); - SetDevice(newdev); - UpdateEverything(); - } else - { - Reporting::Warning("Device not availble."); - } - } + return; } @@ -221,6 +204,7 @@ //------------------------------------ { CPropertyPage::OnInitDialog(); + SetDevice(m_InitialDevice, true); UpdateEverything(); return TRUE; } Modified: trunk/OpenMPT/mptrack/Mpdlgs.h =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.h 2014-09-28 09:22:57 UTC (rev 4319) +++ trunk/OpenMPT/mptrack/Mpdlgs.h 2014-09-29 06:38:49 UTC (rev 4320) @@ -32,6 +32,8 @@ CStatic m_StaticChannelMapping[NUM_CHANNELCOMBOBOXES]; CComboBox m_CbnChannelMapping[NUM_CHANNELCOMBOBOXES]; + SoundDevice::ID m_InitialDevice; + void SetDevice(SoundDevice::ID dev, bool forceReload=false); SoundDevice::Info m_CurrentDeviceInfo; SoundDevice::Caps m_CurrentDeviceCaps; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-03-27 15:18:27
|
Revision: 4906 http://sourceforge.net/p/modplug/code/4906 Author: manxorist Date: 2015-03-27 15:18:21 +0000 (Fri, 27 Mar 2015) Log Message: ----------- [Imp] VUMeter: Make decay speed configurable via hidden setting [Display]VuMeterDecaySpeedDecibelPerSecond. The default (88) corresponds to the speed OpenMPT had used until now. The meter is still linear though, and the dynamic range stays at 48dB (which the configured speed gets scaled to). Using a logarithmic setting gives the value a more natural feeling and makes it easier to provide a logarithmic VUMeter in the future. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2015-03-24 17:03:16 UTC (rev 4905) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2015-03-27 15:18:21 UTC (rev 4906) @@ -850,10 +850,21 @@ } +const float VUMeter::dynamicRange = 48.0f; // corresponds to the current implementation of the UI widget displaying the result + + +void VUMeter::SetDecaySpeedDecibelPerSecond(float decibelPerSecond) +//----------------------------------------------------------------- +{ + float linearDecayRate = decibelPerSecond / dynamicRange; + decayParam = Util::Round<int32>(linearDecayRate * MIXING_CLIPMAX); +} + + void VUMeter::Decay(int32 secondsNum, int32 secondsDen) //----------------------------------------------------- { - int32 decay = Util::muldivr(120000 << 11, secondsNum, secondsDen); + int32 decay = Util::muldivr(decayParam, secondsNum, secondsDen); for(std::size_t channel = 0; channel < maxChannels; ++channel) { channels[channel].peak = std::max(channels[channel].peak - decay, 0); @@ -2271,6 +2282,7 @@ //--------------------------------------------------------- { OPENMPT_PROFILE_FUNCTION(Profiler::GUI); + m_VUMeter.SetDecaySpeedDecibelPerSecond(TrackerSettings::Instance().VuMeterDecaySpeedDecibelPerSecond); // update in notification update in order to avoid querying the settings framework from inside audio thread Notification *pnotify = (Notification *)lParam; if (pnotify) { Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2015-03-24 17:03:16 UTC (rev 4905) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2015-03-27 15:18:21 UTC (rev 4906) @@ -303,6 +303,7 @@ { public: static const std::size_t maxChannels = 4; + static const float dynamicRange; // corresponds to the current implementation of the UI widget diplaying the result struct Channel { int32 peak; @@ -311,7 +312,11 @@ }; private: Channel channels[maxChannels]; + int32 decayParam; public: + VUMeter() : decayParam(0) { SetDecaySpeedDecibelPerSecond(88.0f); } + void SetDecaySpeedDecibelPerSecond(float decibelPerSecond); +public: const Channel & operator [] (std::size_t channel) const { return channels[channel]; } void Process(const int *mixbuffer, std::size_t numChannels, std::size_t numFrames); // mixbuffer is interleaved void Decay(int32 secondsNum, int32 secondsDen); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-03-24 17:03:16 UTC (rev 4905) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-03-27 15:18:21 UTC (rev 4906) @@ -160,6 +160,7 @@ , gnMsgBoxVisiblityFlags(conf, "Display", "MDIGraphHeight", uint32_max) , GUIUpdateInterval(conf, "Display", "GUIUpdateInterval", 0) , VuMeterUpdateInterval(conf, "Display", "VuMeterUpdateInterval", 15) + , VuMeterDecaySpeedDecibelPerSecond(conf, "Display", "VuMeterDecaySpeedDecibelPerSecond", 88.0f) , rememberSongWindows(conf, "Display", "RememberSongWindows", true) , commentsFont(conf, "Display", "Comments Font", FontSetting("Courier New", 120)) // Misc Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2015-03-24 17:03:16 UTC (rev 4905) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2015-03-27 15:18:21 UTC (rev 4906) @@ -417,6 +417,7 @@ Setting<uint32> gnMsgBoxVisiblityFlags; Setting<uint32> GUIUpdateInterval; CachedSetting<uint32> VuMeterUpdateInterval; + CachedSetting<float> VuMeterDecaySpeedDecibelPerSecond; Setting<bool> rememberSongWindows; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-17 23:18:23
|
Revision: 534 http://modplug.svn.sourceforge.net/modplug/?rev=534&view=rev Author: saga-games Date: 2010-03-17 23:18:14 +0000 (Wed, 17 Mar 2010) Log Message: ----------- [Fix] Pattern Editor: In the note properties, the Gxx effect for XM files was not limited properly. [Imp] Pattern Editor: Instead of simply ignoring note off/cut/fade when working with .MOD files, it is converted to C00. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-15 20:27:57 UTC (rev 533) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-17 23:18:14 UTC (rev 534) @@ -2288,7 +2288,7 @@ else nmax = 0xFF; break; case CMD_GLOBALVOLUME: - nmax = (nType & MOD_TYPE_IT | MOD_TYPE_MPT) ? 128 : 64; + nmax = (nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? 128 : 64; break; case CMD_MODCMDEX: Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-15 20:27:57 UTC (rev 533) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-17 23:18:14 UTC (rev 534) @@ -4157,6 +4157,14 @@ else if( note < pSndFile->GetModSpecifications().noteMin) note = pSndFile->GetModSpecifications().noteMin; + // Special case: Convert note off commands to C00 for MOD files + if((pSndFile->GetType() == MOD_TYPE_MOD) && (note == NOTE_NOTECUT || note == NOTE_FADE || note == NOTE_KEYOFF)) + { + TempEnterFX(CMD_VOLUME); + TempEnterFXparam(0); + return; + } + // Check whether the module format supports the note. if( pSndFile->GetModSpecifications().HasNote(note) == false ) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-19 18:43:56
|
Revision: 535 http://modplug.svn.sourceforge.net/modplug/?rev=535&view=rev Author: saga-games Date: 2010-03-19 18:43:47 +0000 (Fri, 19 Mar 2010) Log Message: ----------- [Fix] Pattern Editor: Display "fine" / "extra fine" portamento effects properly (S3M/IT/MPTM), display SFx macro properly, display MOD effects with no memory properly. [Ref] Fixed a path in mptrack.h (which apparently doesn't work in VC6, in which OpenMPT doesn't compile properly anyway) Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-17 23:18:14 UTC (rev 534) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-19 18:43:47 UTC (rev 535) @@ -2327,7 +2327,7 @@ case CMD_GLOBALVOLSLIDE: case CMD_CHANNELVOLSLIDE: case CMD_PANNINGSLIDE: - if (m_SndFile.m_nType & MOD_TYPE_S3MITMPT) + if (m_SndFile.GetType() & MOD_TYPE_S3MITMPT) { if (!param) pos = 29; else if (((param & 0x0F) == 0x0F) && (param & 0xF0)) @@ -2345,7 +2345,7 @@ } break; case CMD_PANNING8: - if(m_SndFile.m_nType & MOD_TYPE_S3M) + if(m_SndFile.GetType() == MOD_TYPE_S3M) { pos = CLAMP(param, 0, 0x80); if(param == 0xA4) @@ -2373,7 +2373,7 @@ case CMD_GLOBALVOLSLIDE: case CMD_CHANNELVOLSLIDE: case CMD_PANNINGSLIDE: - if (m_SndFile.m_nType & MOD_TYPE_S3MITMPT) + if (m_SndFile.GetType() & MOD_TYPE_S3MITMPT) { if (pos < 15) param = 15-pos; else if (pos < 29) param = (29-pos) | 0xF0; else @@ -2387,7 +2387,7 @@ } break; case CMD_PANNING8: - if(m_SndFile.m_nType & MOD_TYPE_S3M) + if(m_SndFile.GetType() == MOD_TYPE_S3M) param = (pos <= 0x80) ? pos : 0xA4; break; } @@ -2398,42 +2398,58 @@ bool CModDoc::GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param) //---------------------------------------------------------------- { - CHAR s[64]; + char s[64]; + char szContinueOrIgnore[16]; + if (pszName) pszName[0] = 0; if ((!pszName) || (ndx >= MAX_FXINFO) || (!gFXInfo[ndx].pszName)) return false; wsprintf(pszName, "%s: ", gFXInfo[ndx].pszName); s[0] = 0; + // for effects that don't have effect memory in MOD format. + if(m_SndFile.GetType() == MOD_TYPE_MOD) + strcpy(szContinueOrIgnore, "ignore"); + else + strcpy(szContinueOrIgnore, "continue"); + std::string sPlusChar = "+", sMinusChar = "-"; switch(gFXInfo[ndx].dwEffect) { case CMD_ARPEGGIO: + if(m_SndFile.GetType() == MOD_TYPE_XM) // XM also ignores this! + strcpy(szContinueOrIgnore, "ignore"); + if (param) wsprintf(s, "note+%d note+%d", param >> 4, param & 0x0F); else - strcpy(s, "continue"); + strcpy(s, szContinueOrIgnore); break; case CMD_PORTAMENTOUP: - if (param) - wsprintf(s, "+%d", param); - else - strcpy(s, "continue"); - break; - case CMD_PORTAMENTODOWN: - if (param) - wsprintf(s, "-%d", param); + if(param) + { + char sign[2]; + strcpy(sign, (gFXInfo[ndx].dwEffect == CMD_PORTAMENTOUP) ? "+" : "-"); + if((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xF0)) + wsprintf(s, "fine %s%d", sign, (param & 0x0F)); + else if((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xE0)) + wsprintf(s, "extra fine %s%d", sign, (param & 0x0F)); + else + wsprintf(s, "%s%d", sign, param); + } else - strcpy(s, "continue"); + { + strcpy(s, szContinueOrIgnore); + } break; case CMD_TONEPORTAMENTO: if (param) wsprintf(s, "speed %d", param); else - strcpy(s, "continue"); + strcpy(s, szContinueOrIgnore); break; case CMD_VIBRATO: @@ -2443,7 +2459,7 @@ if (param) wsprintf(s, "speed=%d depth=%d", param >> 4, param & 0x0F); else - strcpy(s, "continue"); + strcpy(s, szContinueOrIgnore); break; case CMD_SPEED: @@ -2500,7 +2516,7 @@ case CMD_PANNINGSLIDE: if(gFXInfo[ndx].dwEffect == CMD_PANNINGSLIDE) { - if(m_SndFile.m_nType & MOD_TYPE_XM) + if(m_SndFile.GetType() == MOD_TYPE_XM) { sPlusChar = "-> "; sMinusChar = "<- "; @@ -2516,11 +2532,11 @@ { wsprintf(s, "continue"); } else - if ((m_SndFile.m_nType & MOD_TYPE_S3MITMPT) && ((param & 0x0F) == 0x0F) && (param & 0xF0)) + if ((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0x0F) == 0x0F) && (param & 0xF0)) { wsprintf(s, "fine %s%d", sPlusChar.c_str(), param >> 4); } else - if ((m_SndFile.m_nType & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xF0) && (param & 0x0F)) + if ((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xF0) && (param & 0x0F)) { wsprintf(s, "fine %s%d", sMinusChar.c_str(), param & 0x0F); } else @@ -2706,8 +2722,9 @@ strcat(s, " rows"); break; case 0xF0: // macro - if(m_SndFile.m_nType & MOD_TYPE_MOD) - wsprintf(s, "SF%X", param & 0x0F); break; + if(m_SndFile.GetType() != MOD_TYPE_MOD) + wsprintf(s, "SF%X", param & 0x0F); + break; default: break; } @@ -2754,7 +2771,7 @@ strcat(s, " rows"); break; case 0xF0: - if(m_SndFile.m_nType & MOD_TYPE_MOD) // invert loop + if(m_SndFile.GetType() == MOD_TYPE_MOD) // invert loop { if((param & 0x0F) == 0) strcpy(s, "Stop"); @@ -3514,4 +3531,4 @@ displayName.Format(TEXT("%s (%s)"), (LPCTSTR)instrumentName, (LPCTSTR)pluginName); } return displayName; -} +} \ No newline at end of file Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-17 23:18:14 UTC (rev 534) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-19 18:43:47 UTC (rev 535) @@ -13,7 +13,7 @@ #endif #include "resource.h" // main symbols -#include "sndfile.h" +#include "../soundlib/Sndfile.h" #include <windows.h> #ifdef UPDATECHECKENABLED This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-26 17:14:28
|
Revision: 552 http://modplug.svn.sourceforge.net/modplug/?rev=552&view=rev Author: saga-games Date: 2010-03-26 17:14:18 +0000 (Fri, 26 Mar 2010) Log Message: ----------- [Imp] In the cleanup dialog, mutually exclusive items are now automatically unchecked, to avoid confusion. [Imp] Treeview: Improved order dragging; It is now also possible to drag an order into a non-MPT module. In that case, the old orderlist will be replaced. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/CleanupSong.h trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-26 13:23:03 UTC (rev 551) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-26 17:14:18 UTC (rev 552) @@ -44,6 +44,25 @@ IDC_CHK_RESET_VARIABLES, }; +// Options that are mutually exclusive to each other +ENUM_CLEANUP_OPTIONS const CModCleanupDlg::m_nMutuallyExclusive[CU_MAX_CLEANUP_OPTIONS] = +{ + // patterns + CU_REMOVE_PATTERNS, CU_CLEANUP_PATTERNS, CU_REMOVE_PATTERNS, + // orders + CU_REMOVE_ORDERS, CU_MERGE_SEQUENCES, + // samples + CU_REMOVE_SAMPLES, CU_CLEANUP_SAMPLES, CU_REMOVE_SAMPLES, + CU_REMOVE_SAMPLES, + // instruments + CU_REMOVE_INSTRUMENTS, CU_CLEANUP_INSTRUMENTS, + // plugins + CU_REMOVE_PLUGINS, CU_CLEANUP_PLUGINS, + // misc + CU_NONE, + +}; + /////////////////////////////////////////////////////////////////////// // CModCleanupDlg @@ -52,6 +71,21 @@ ON_COMMAND(IDC_BTN_CLEANUP_SONG, OnPresetCleanupSong) ON_COMMAND(IDC_BTN_COMPO_CLEANUP, OnPresetCompoCleanup) + ON_COMMAND(IDC_CHK_CLEANUP_PATTERNS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REMOVE_PATTERNS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REARRANGE_PATTERNS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_MERGE_SEQUENCES, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REMOVE_ORDERS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_CLEANUP_SAMPLES, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REMOVE_SAMPLES, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REARRANGE_SAMPLES, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_OPTIMIZE_SAMPLES, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_CLEANUP_INSTRUMENTS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REMOVE_INSTRUMENTS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_CLEANUP_PLUGINS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_REMOVE_PLUGINS, OnVerifyMutualExclusive) + ON_COMMAND(IDC_CHK_RESET_VARIABLES, OnVerifyMutualExclusive) + ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CModCleanupDlg::OnToolTipNotify) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CModCleanupDlg::OnToolTipNotify) //}}AFX_MSG_MAP @@ -139,7 +173,34 @@ } +void CModCleanupDlg::OnVerifyMutualExclusive() +//-------------------------------------------- +{ + HWND hFocus = GetFocus()->m_hWnd; + for(int i = 0; i < CU_MAX_CLEANUP_OPTIONS; i++) + { + // if this item is focussed, we have just (un)checked it. + if(hFocus == GetDlgItem(m_nCleanupIDtoDlgID[i])->m_hWnd) + { + // if we just unchecked it, there's nothing to verify. + if(IsDlgButtonChecked(m_nCleanupIDtoDlgID[i]) == FALSE) + return; + // now we can disable all elements that are mutually exclusive. + if(m_nMutuallyExclusive[i] != CU_NONE) + CheckDlgButton(m_nCleanupIDtoDlgID[m_nMutuallyExclusive[i]], MF_UNCHECKED); + // find other elements which are mutually exclusive with the selected element. + for(int j = 0; j < CU_MAX_CLEANUP_OPTIONS; j++) + { + if(m_nMutuallyExclusive[j] == i) + CheckDlgButton(m_nCleanupIDtoDlgID[j], MF_UNCHECKED); + } + return; + } + } +} + + void CModCleanupDlg::OnPresetCleanupSong() //---------------------------------------- { Modified: trunk/OpenMPT/mptrack/CleanupSong.h =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.h 2010-03-26 13:23:03 UTC (rev 551) +++ trunk/OpenMPT/mptrack/CleanupSong.h 2010-03-26 17:14:18 UTC (rev 552) @@ -31,7 +31,8 @@ // misc CU_RESET_VARIABLES, - CU_MAX_CLEANUP_OPTIONS + CU_NONE, + CU_MAX_CLEANUP_OPTIONS = CU_NONE }; //================================== @@ -43,6 +44,7 @@ CWnd *m_wParent; static bool m_bCheckBoxes[CU_MAX_CLEANUP_OPTIONS]; // Checkbox state static const WORD m_nCleanupIDtoDlgID[CU_MAX_CLEANUP_OPTIONS]; // Checkbox -> Control ID LUT + static const ENUM_CLEANUP_OPTIONS m_nMutuallyExclusive[CU_MAX_CLEANUP_OPTIONS]; // Options that are mutually exclusive to each other. // Actual cleanup implementations: // Patterns @@ -80,6 +82,7 @@ //{{AFX_MSG(CModCleanupDlg) afx_msg void OnPresetCleanupSong(); afx_msg void OnPresetCompoCleanup(); + afx_msg void OnVerifyMutualExclusive(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; \ No newline at end of file Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-26 13:23:03 UTC (rev 551) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-26 17:14:18 UTC (rev 552) @@ -2052,7 +2052,7 @@ case MODITEM_HDR_ORDERS: // Drop your sequences here. // At the moment, only dropping sequences into another module is possible. - if((modItemDragType == MODITEM_SEQUENCE || modItemDragType == MODITEM_HDR_ORDERS) && pSndFile && pSndFile->GetType() == MOD_TYPE_MPT && pInfoDrag && pModDoc != pInfoDrag->pModDoc) + if((modItemDragType == MODITEM_SEQUENCE || modItemDragType == MODITEM_HDR_ORDERS) && pSndFile && pInfoDrag && pModDoc != pInfoDrag->pModDoc) { if(bDoDrop) { @@ -2065,12 +2065,31 @@ const ModSequence *pOrigSeq = &(pDragSndFile->Order.GetSequence(nOrigSeq)); if(pOrigSeq == nullptr) return false; - pSndFile->Order.AddSequence(false); - pSndFile->Order.resize(pOrigSeq->GetLength(), pSndFile->Order.GetInvalidPatIndex()); - for(ORDERINDEX nOrd = 0; nOrd < pOrigSeq->GetLengthTailTrimmed(); nOrd++) + if(pSndFile->GetType() == MOD_TYPE_MPT) { - pSndFile->Order[nOrd] = pDragSndFile->Order.GetSequence(nOrigSeq)[nOrd]; + pSndFile->Order.AddSequence(false); } + else + { + if(::MessageBox(0, _T("Replace the current orderlist?"), _T("Sequence import"), MB_YESNO|MB_ICONQUESTION) == IDNO) + return false; + } + pSndFile->Order.resize(min(pSndFile->GetModSpecifications().ordersMax, pOrigSeq->GetLength()), pSndFile->Order.GetInvalidPatIndex()); + for(ORDERINDEX nOrd = 0; nOrd < min(pSndFile->GetModSpecifications().ordersMax,pOrigSeq->GetLengthTailTrimmed()); nOrd++) + { + PATTERNINDEX nOrigPat = pDragSndFile->Order.GetSequence(nOrigSeq)[nOrd]; + // translate pattern index + if(nOrigPat == pDragSndFile->Order.GetInvalidPatIndex()) + pSndFile->Order[nOrd] = pSndFile->Order.GetInvalidPatIndex(); + else if(nOrigPat == pDragSndFile->Order.GetIgnoreIndex() && pSndFile->GetModSpecifications().hasIgnoreIndex) + pSndFile->Order[nOrd] = pSndFile->Order.GetIgnoreIndex(); + else if(nOrigPat == pDragSndFile->Order.GetIgnoreIndex() && !pSndFile->GetModSpecifications().hasIgnoreIndex) + pSndFile->Order[nOrd] = pSndFile->Order.GetInvalidPatIndex(); + else if(nOrigPat >= pSndFile->GetModSpecifications().patternsMax) + pSndFile->Order[nOrd] = pSndFile->Order.GetInvalidPatIndex(); + else + pSndFile->Order[nOrd] = nOrigPat; + } pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL); pModDoc->SetModified(); } @@ -2240,7 +2259,7 @@ { CModDoc *pModDoc = DocInfo[m_nDragDocNdx]->pModDoc; CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; - if(pSndFile && pSndFile->GetType() == MOD_TYPE_MPT && pSndFile->Order.GetNumSequences() == 1) + if(pSndFile && pSndFile->Order.GetNumSequences() == 1) bDrag = true; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-26 19:17:33
|
Revision: 553 http://modplug.svn.sourceforge.net/modplug/?rev=553&view=rev Author: saga-games Date: 2010-03-26 19:17:27 +0000 (Fri, 26 Mar 2010) Log Message: ----------- [Fix] Many dialogs don't check if their SndFile pointer is valid, so using the global "close file" shortcut can crash them. As a lazy fix, this shortcut is now only allowed if the main window has the focus. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-26 17:14:18 UTC (rev 552) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-26 19:17:27 UTC (rev 553) @@ -3300,7 +3300,7 @@ case kcApproxRealBPM: OnApproximateBPM(); break; case kcFileSave: DoSave(m_strPathName, 0); break; case kcFileSaveAs: DoSave(NULL, 1); break; - case kcFileClose: OnFileClose(); break; + case kcFileClose: SafeFileClose(); break; case kcPlayPatternFromCursor: OnPatternPlay(); break; case kcPlayPatternFromStart: OnPatternRestart(); break; @@ -3543,4 +3543,12 @@ displayName.Format(TEXT("%s (%s)"), (LPCTSTR)instrumentName, (LPCTSTR)pluginName); } return displayName; +} + +void CModDoc::SafeFileClose() +//-------------------------- +{ + // Verify that the main window has the focus. This saves us a lot of trouble because active dialogs normally don't check if their pSndFile pointers are still valid. + if(GetActiveWindow() == CMainFrame::GetMainFrame()->m_hWnd) + OnFileClose(); } \ No newline at end of file Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-03-26 17:14:18 UTC (rev 552) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-03-26 19:17:27 UTC (rev 553) @@ -292,6 +292,8 @@ bool MergeSequences(); bool ConvertSubsongsToMultipleSequences(); + bool HasMPTHacks(bool autofix = false); + bool m_bHasValidPath; //becomes true if document is loaded or saved. // Fix: save pattern scrollbar position when switching to other tab CSize GetOldPatternScrollbarsPos() const { return m_szOldPatternScrollbarsPos; }; @@ -322,6 +324,7 @@ virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); virtual BOOL OnSaveDocument(LPCTSTR lpszPathName); virtual void OnCloseDocument(); + void SafeFileClose(); // -> CODE#0023 // -> DESC="IT project files (.itp)" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-27 20:21:51
|
Revision: 556 http://modplug.svn.sourceforge.net/modplug/?rev=556&view=rev Author: saga-games Date: 2010-03-27 20:21:45 +0000 (Sat, 27 Mar 2010) Log Message: ----------- [Fix] Note Properties: Vibrato and Tremolo were erroneously marked as commands with no effect memory. [New] Pattern Editor: When the PT1x mode or the S3M "Amiga" flag are enabled, dodgy notes (i.e lower than C-4 or higher than B-6) are marked red. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-03-26 23:11:20 UTC (rev 555) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-03-27 20:21:45 UTC (rev 556) @@ -131,6 +131,7 @@ b = hilightcolor(GetBValue(CMainFrame::rgbCustomColors[MODCOLOR_BACKHILIGHT]), GetBValue(CMainFrame::rgbCustomColors[MODCOLOR_BACKNORMAL])); m_Dib.SetColor(MODCOLOR_2NDHIGHLIGHT, RGB(r,g,b)); + m_Dib.SetColor(MODCOLOR_DODGY_COMMANDS, RGB(255, 0, 0)); m_Dib.SetBlendColor(CMainFrame::rgbCustomColors[MODCOLOR_BLENDCOLOR]); } @@ -845,6 +846,9 @@ if ((CMainFrame::m_dwPatternSetup & PATTERN_EFFECTHILIGHT) && (m->note) && (m->note <= NOTE_MAX)) { tx_col = MODCOLOR_NOTE; + // Highlight notes that are not supported by the Amiga + if((pSndFile->m_dwSongFlags & (SONG_PT1XMODE|SONG_AMIGALIMITS)) && (m->note < NOTE_MIDDLEC - 12 || m->note >= NOTE_MIDDLEC + 2 * 12)) + tx_col = MODCOLOR_DODGY_COMMANDS; } if (col_sel & 0x01) { Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-26 23:11:20 UTC (rev 555) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-27 20:21:45 UTC (rev 556) @@ -156,6 +156,7 @@ MAX_MODCOLORS, // Internal color codes MODCOLOR_2NDHIGHLIGHT, + MODCOLOR_DODGY_COMMANDS, MAX_MODPALETTECOLORS }; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-26 23:11:20 UTC (rev 555) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-27 20:21:45 UTC (rev 556) @@ -2461,7 +2461,7 @@ if (param) wsprintf(s, "speed %d", param); else - strcpy(s, szContinueOrIgnore); + strcpy(s, "continue"); break; case CMD_VIBRATO: @@ -2471,7 +2471,7 @@ if (param) wsprintf(s, "speed=%d depth=%d", param >> 4, param & 0x0F); else - strcpy(s, szContinueOrIgnore); + strcpy(s, "continue"); break; case CMD_SPEED: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-28 00:09:47
|
Revision: 557 http://modplug.svn.sourceforge.net/modplug/?rev=557&view=rev Author: saga-games Date: 2010-03-28 00:09:41 +0000 (Sun, 28 Mar 2010) Log Message: ----------- [Fix] Song Cleanup: "Remove unused samples" was broken in the last revision (strangely, no debug assertions appeared in the IDE...) [Fix] Sample Editor: When applying time stretch / pitch shift to an 8-bit sample and selecting the sample partly lead to partial upsampling, instead of upsampling the whole sample. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-27 20:21:45 UTC (rev 556) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-28 00:09:41 UTC (rev 557) @@ -515,13 +515,14 @@ vector<bool> bIns; int nExt = 0; int nRemoved = 0; - bIns.resize(pSndFile->GetNumSamples(), false); + bIns.resize(pSndFile->GetNumSamples() + 1, false); BeginWaitCursor(); for (SAMPLEINDEX nSmp = pSndFile->m_nSamples; nSmp >= 1; nSmp--) if (pSndFile->Samples[nSmp].pSample) { if (!pSndFile->IsSampleUsed(nSmp)) { + m_pModDoc->GetSampleUndo()->PrepareUndo(nSmp, sundo_delete); BEGIN_CRITICAL(); pSndFile->DestroySample(nSmp); if ((nSmp == pSndFile->m_nSamples) && (nSmp > 1)) pSndFile->m_nSamples--; @@ -531,12 +532,12 @@ } if (pSndFile->m_nInstruments) { - for (UINT ipat=0; ipat<pSndFile->Patterns.Size(); ipat++) + for (PATTERNINDEX nPat = 0; nPat < pSndFile->GetNumPatterns(); nPat++) { - MODCOMMAND *p = pSndFile->Patterns[ipat]; + MODCOMMAND *p = pSndFile->Patterns[nPat]; if (p) { - UINT jmax = pSndFile->PatternSize[ipat] * pSndFile->m_nChannels; + UINT jmax = pSndFile->PatternSize[nPat] * pSndFile->m_nChannels; for (UINT j=0; j<jmax; j++, p++) { if ((p->note) && (p->note <= NOTE_MAX)) @@ -581,9 +582,9 @@ { if ((!bIns[nSmp]) && (pSndFile->Samples[nSmp].pSample)) { + m_pModDoc->GetSampleUndo()->PrepareUndo(nSmp, sundo_delete); BEGIN_CRITICAL(); pSndFile->DestroySample(nSmp); - m_pModDoc->GetSampleUndo()->PrepareUndo(nSmp, sundo_delete); if ((nSmp == pSndFile->m_nSamples) && (nSmp > 1)) pSndFile->m_nSamples--; END_CRITICAL(); nRemoved++; Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-27 20:21:45 UTC (rev 556) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-28 00:09:41 UTC (rev 557) @@ -1489,13 +1489,7 @@ m_pModDoc->AdjustEndOfSample(m_nSample); if (selection.bSelected == true) { - SAMPLEVIEWSTATE viewstate; - memset(&viewstate, 0, sizeof(viewstate)); - SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&viewstate); - - viewstate.dwBeginSel = dwStart; - viewstate.dwEndSel = dwEnd + (dwEnd-dwStart); - SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate); + SetSelectionPoints(dwStart, dwEnd + (dwEnd - dwStart)); } m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); m_pModDoc->SetModified(); @@ -1623,13 +1617,7 @@ m_pModDoc->AdjustEndOfSample(m_nSample); if (selection.bSelected == true) { - SAMPLEVIEWSTATE viewstate; - memset(&viewstate, 0, sizeof(viewstate)); - SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&viewstate); - - viewstate.dwBeginSel = dwStart; - viewstate.dwEndSel = dwStart + dwRemove; - SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate); + SetSelectionPoints(dwStart, dwStart + dwRemove); } m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); m_pModDoc->SetModified(); @@ -1727,7 +1715,8 @@ if(!pSmp || pSmp->nLength == 0) goto error; // Time stretching - if(IsDlgButtonChecked(IDC_CHECK3)){ + if(IsDlgButtonChecked(IDC_CHECK3)) + { UpdateData(TRUE); //Ensure m_dTimeStretchRatio is up-to-date with textbox content errorcode = TimeStretch((float)(m_dTimeStretchRatio / 100.0)); @@ -1742,7 +1731,8 @@ } // Pitch shifting - else{ + else + { // Get selected pitch modifier [-12,+12] CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO4); float pm = float(combo->GetCurSel()) - 12.0f; @@ -1761,27 +1751,29 @@ // Error management error: - if(errorcode > 0){ - CHAR str[64]; - switch(errorcode & 0xff){ - case 1 : wsprintf(str,"Pitch %s...",(errorcode>>8) == 1 ? "< 0.5" : "> 2.0"); + if(errorcode > 0) + { + TCHAR str[64]; + switch(errorcode & 0xff) + { + case 1 : wsprintf(str, _T("Pitch %s..."), (errorcode >> 8) == 1 ? _T("< 0.5") : _T("> 2.0")); break; - case 2 : wsprintf(str,"Stretch ratio is too %s. Must be between 50% and 200%.",(errorcode>>8) == 1 ? "low" : "high"); + case 2 : wsprintf(str, _T("Stretch ratio is too %s. Must be between 50% and 200%."), (errorcode >> 8) == 1 ? _T("low") : _T("high")); break; - case 3 : wsprintf(str,"Not enough memory..."); + case 3 : wsprintf(str, _T("Not enough memory...")); break; - case 5 : wsprintf(str, "Too low sample rate"); + case 5 : wsprintf(str, _T("Too low sample rate")); break; - case 6 : wsprintf(str, "Too short sample"); + case 6 : wsprintf(str, _T("Too short sample")); break; - default: wsprintf(str,"Unknown Error..."); + default: wsprintf(str, _T("Unknown Error...")); break; } AfxMessageBox(str, MB_ICONERROR); } // Update sample view - m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); // !!!! see CODE#0006, update#3 + m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); m_pModDoc->SetModified(); } @@ -1828,13 +1820,14 @@ } // Get number of channels & sample size - BYTE smpsize = pSmp->GetElementarySampleSize(); - const UINT nChn = pSmp->GetNumChannels(); + uint8 smpsize = pSmp->GetElementarySampleSize(); + const uint8 nChn = pSmp->GetNumChannels(); // Stretching is implemented only for 16-bit samples. if(smpsize != 2) { // This has to be converted to 16-bit first. + SetSelectionPoints(0, 0); // avoid partial upsampling. OnUpsample(); smpsize = pSmp->GetElementarySampleSize(); } @@ -2033,6 +2026,7 @@ if(smpsize != 2) { // This has to be converted to 16-bit first. + SetSelectionPoints(0, 0); // avoid partial upsampling. OnUpsample(); smpsize = pSmp->GetElementarySampleSize(); } @@ -3032,3 +3026,19 @@ return points; } +// Set the currently select part of the sample. +// To reset the selection, use nStart = nEnd = 0. +void CCtrlSamples::SetSelectionPoints(UINT nStart, UINT nEnd) +//----------------------------------------------------------- +{ + nStart = CLAMP(nStart, 0, m_pSndFile->Samples[m_nSample].nLength); + nEnd = CLAMP(nEnd, 0, m_pSndFile->Samples[m_nSample].nLength); + + SAMPLEVIEWSTATE viewstate; + memset(&viewstate, 0, sizeof(viewstate)); + SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&viewstate); + + viewstate.dwBeginSel = nStart; + viewstate.dwEndSel = nEnd; + SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate); +} Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-27 20:21:45 UTC (rev 556) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-28 00:09:41 UTC (rev 557) @@ -44,7 +44,9 @@ // Applies amplification to sample. Negative values // can be used to invert phase. void ApplyAmplify(LONG nAmp, bool bFadeIn = false, bool bFadeOut = false); + SELECTIONPOINTS GetSelectionPoints(); + void SetSelectionPoints(UINT nStart, UINT nEnd); public: CCtrlSamples(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-28 19:32:00
|
Revision: 560 http://modplug.svn.sourceforge.net/modplug/?rev=560&view=rev Author: saga-games Date: 2010-03-28 19:31:53 +0000 (Sun, 28 Mar 2010) Log Message: ----------- [Ref] Rewrote nonsensical mod effect -> colour translation code in the pattern editor; also using a nice lookup table for the volume column now. [Mod] Replaced default VU-meter colours for the MPT scheme by more pleasant colours that were already used for the other themes. [Imp] INI File: Autosave / Soundfont sections are now also using relative paths. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-03-28 17:21:44 UTC (rev 559) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-03-28 19:31:53 UTC (rev 560) @@ -897,34 +897,10 @@ tx_col = MODCOLOR_TEXTSELECTED; bk_col = MODCOLOR_BACKSELECTED; } else - if ((!m->IsPcNote()) && (m->volcmd) && (CMainFrame::m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) + if ((!m->IsPcNote()) && (m->volcmd) && (m->volcmd < MAX_VOLCMDS) && (CMainFrame::m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { - switch(m->volcmd) - { - case VOLCMD_VOLUME: - case VOLCMD_VOLSLIDEUP: - case VOLCMD_VOLSLIDEDOWN: - case VOLCMD_FINEVOLUP: - case VOLCMD_FINEVOLDOWN: - tx_col = MODCOLOR_VOLUME; - break; - case VOLCMD_PANNING: - case VOLCMD_PANSLIDELEFT: - case VOLCMD_PANSLIDERIGHT: - tx_col = MODCOLOR_PANNING; - break; - case VOLCMD_VIBRATOSPEED: - case VOLCMD_VIBRATODEPTH: - case VOLCMD_TONEPORTAMENTO: - case VOLCMD_PORTAUP: - case VOLCMD_PORTADOWN: - tx_col = MODCOLOR_PITCH; - break; - case VOLCMD_VELOCITY: //rewbs.velocity - case VOLCMD_OFFSET: //rewbs.volOff - // default color - break; - } + if(gVolEffectColors[m->volcmd] != 0) + tx_col = gVolEffectColors[m->volcmd]; } // Drawing Volume m_Dib.SetTextColor(tx_col, bk_col); @@ -941,21 +917,8 @@ fx_col = row_col; if (!isPCnote && (m->command) && (m->command < MAX_EFFECTS) && (CMainFrame::m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { - switch(gEffectColors[m->command]) - { - case MODCOLOR_VOLUME: - fx_col = MODCOLOR_VOLUME; - break; - case MODCOLOR_PANNING: - fx_col = MODCOLOR_PANNING; - break; - case MODCOLOR_PITCH: - fx_col = MODCOLOR_PITCH; - break; - case MODCOLOR_GLOBALS: - fx_col = MODCOLOR_GLOBALS; - break; - } + if(gEffectColors[m->command] != 0) + fx_col = gEffectColors[m->command]; } if (!(dwSpeedUpMask & 0x08)) { Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-28 17:21:44 UTC (rev 559) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-28 19:31:53 UTC (rev 560) @@ -251,12 +251,12 @@ HPEN CMainFrame::gpenVuMeter[NUM_VUMETER_PENS*2]; COLORREF CMainFrame::rgbCustomColors[MAX_MODCOLORS] = { - 0xFFFFFF, 0x000000, 0xC0C0C0, 0x000000, 0x000000, 0xFFFFFF, 0x0000FF, - 0x80FFFF, 0x000000, 0xE0E8E0, + RGB(0xFF, 0xFF, 0xFF), RGB(0x00, 0x00, 0x00), RGB(0xC0, 0xC0, 0xC0), RGB(0x00, 0x00, 0x00), RGB(0x00, 0x00, 0x00), RGB(0xFF, 0xFF, 0xFF), 0x0000FF, + RGB(0xFF, 0xFF, 0x80), RGB(0x00, 0x00, 0x00), RGB(0xE0, 0xE8, 0xE0), // Effect Colors - 0x800000, 0x808000, 0x008000, 0x808000, 0x008080, 0x000080, 0xFF0000, + RGB(0x00, 0x00, 0x80), RGB(0x00, 0x80, 0x80), RGB(0x00, 0x80, 0x00), RGB(0x00, 0x80, 0x80), RGB(0x80, 0x80, 0x00), RGB(0x80, 0x00, 0x00), RGB(0x00, 0x00, 0xFF), // VU-Meters - 0x00FF00, 0x00FFFF, 0x0000FF, + RGB(0x00, 0xC8, 0x00), RGB(0xFF, 0xC8, 0x00), RGB(0xE1, 0x00, 0x00), // Channel separators GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_BTNHIGHLIGHT), // Blend colour @@ -274,9 +274,9 @@ }; -CInputHandler *CMainFrame::m_InputHandler = NULL; //rewbs.customKeys -CAutoSaver *CMainFrame::m_pAutoSaver = NULL; //rewbs.autosave -CPerformanceCounter *CMainFrame::m_pPerfCounter = NULL; +CInputHandler *CMainFrame::m_InputHandler = nullptr; //rewbs.customKeys +CAutoSaver *CMainFrame::m_pAutoSaver = nullptr; //rewbs.autosave +CPerformanceCounter *CMainFrame::m_pPerfCounter = nullptr; static UINT indicators[] = { @@ -295,15 +295,15 @@ //---------------------- { m_bModTreeHasFocus = false; //rewbs.customKeys - m_pNoteMapHasFocus = NULL; //rewbs.customKeys + m_pNoteMapHasFocus = nullptr; //rewbs.customKeys m_pOrderlistHasFocus = nullptr; m_bOptionsLocked = false; //rewbs.customKeys - m_pJustModifiedDoc = NULL; - m_pModPlaying = NULL; + m_pJustModifiedDoc = nullptr; + m_pModPlaying = nullptr; m_hFollowSong = NULL; m_hWndMidi = NULL; - m_pSndFile = NULL; + m_pSndFile = nullptr; m_dwStatus = 0; m_dwElapsedTime = 0; m_dwTimeSec = 0; @@ -360,11 +360,10 @@ CString storedVersion = GetPrivateProfileCString("Version", "Version", "", theApp.GetConfigFileName()); //If version number stored in INI is 1.17.02.40 or later, load setting from INI file. //Else load settings from Registry - if (storedVersion >= "1.17.02.40") { + if (storedVersion >= "1.17.02.40") LoadIniSettings(); - } else { + else LoadRegistrySettings(); - } m_InputHandler = new CInputHandler(this); //rewbs.customKeys m_pPerfCounter= new CPerformanceCounter(); @@ -488,7 +487,9 @@ m_pAutoSaver->SetSaveInterval(GetPrivateProfileLong("AutoSave", "IntervalMinutes", 10, iniFile)); m_pAutoSaver->SetHistoryDepth(GetPrivateProfileLong("AutoSave", "BackupHistory", 3, iniFile)); m_pAutoSaver->SetUseOriginalPath(GetPrivateProfileLong("AutoSave", "UseOriginalPath", true, iniFile) != 0); - m_pAutoSaver->SetPath(GetPrivateProfileCString("AutoSave", "Path", "", iniFile)); + GetPrivateProfileString("AutoSave", "Path", "", szPath, INIBUFFERSIZE, iniFile); + RelativePathToAbsolute(szPath); + m_pAutoSaver->SetPath(szPath); m_pAutoSaver->SetFilenameTemplate(GetPrivateProfileCString("AutoSave", "FileNameTemplate", "", iniFile)); } @@ -1024,7 +1025,12 @@ WritePrivateProfileLong("AutoSave", "IntervalMinutes", m_pAutoSaver->GetSaveInterval(), iniFile); WritePrivateProfileLong("AutoSave", "BackupHistory", m_pAutoSaver->GetHistoryDepth(), iniFile); WritePrivateProfileLong("AutoSave", "UseOriginalPath", m_pAutoSaver->GetUseOriginalPath(), iniFile); - WritePrivateProfileString("AutoSave", "Path", m_pAutoSaver->GetPath(), iniFile); + _tcscpy(szPath, m_pAutoSaver->GetPath()); + if(bConvertPaths) + { + AbsolutePathToRelative(szPath); + } + WritePrivateProfileString("AutoSave", "Path", szPath, iniFile); WritePrivateProfileString("AutoSave", "FileNameTemplate", m_pAutoSaver->GetFilenameTemplate(), iniFile); theApp.SaveChords(Chords); Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2010-03-28 17:21:44 UTC (rev 559) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2010-03-28 19:31:53 UTC (rev 560) @@ -408,9 +408,9 @@ CustomColors[MODCOLOR_PANNING] = RGB(0x00, 0x80, 0x80); CustomColors[MODCOLOR_PITCH] = RGB(0x80, 0x80, 0x00); CustomColors[MODCOLOR_GLOBALS] = RGB(0x80, 0x00, 0x00); - CustomColors[MODCOLOR_VUMETER_LO] = RGB(0x00, 0xFF, 0x00); - CustomColors[MODCOLOR_VUMETER_MED] = RGB(0xFF, 0xFF, 0x00); - CustomColors[MODCOLOR_VUMETER_HI] = RGB(0xFF, 0x00, 0x00); + CustomColors[MODCOLOR_VUMETER_LO] = RGB(0x00, 0xC8, 0x00); + CustomColors[MODCOLOR_VUMETER_MED] = RGB(0xFF, 0xC8, 0x00); + CustomColors[MODCOLOR_VUMETER_HI] = RGB(0xE1, 0x00, 0x00); CustomColors[MODCOLOR_SEPSHADOW] = GetSysColor(COLOR_BTNSHADOW); CustomColors[MODCOLOR_SEPFACE] = GetSysColor(COLOR_BTNFACE); CustomColors[MODCOLOR_SEPHILITE] = GetSysColor(COLOR_BTNHIGHLIGHT); Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-28 17:21:44 UTC (rev 559) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-28 19:31:53 UTC (rev 560) @@ -221,9 +221,18 @@ 0, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_GLOBALS, MODCOLOR_GLOBALS, 0, MODCOLOR_PITCH, MODCOLOR_PANNING, MODCOLOR_PITCH, MODCOLOR_PANNING, 0, 0, - //0,/*rewbs.smoothVST*/ ,0/*rewbs.velocity*/, + 0, 0, 0, MODCOLOR_PITCH, + MODCOLOR_PITCH, }; +const BYTE gVolEffectColors[MAX_VOLCMDS] = +{ + 0, MODCOLOR_VOLUME, MODCOLOR_PANNING, MODCOLOR_VOLUME, + MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_PITCH, + MODCOLOR_PITCH, MODCOLOR_PANNING, MODCOLOR_PANNING, MODCOLOR_PITCH, + MODCOLOR_PITCH, MODCOLOR_PITCH, 0, 0, +}; + static void ShowChangesDialog() //----------------------------- { @@ -447,15 +456,19 @@ CString storedVersion = CMainFrame::GetPrivateProfileCString("Version", "Version", "", theApp.GetConfigFileName()); //If version number stored in INI is 1.17.02.40 or later, load DLS from INI file. //Else load DLS from Registry - if (storedVersion >= "1.17.02.40") { + if (storedVersion >= "1.17.02.40") + { CHAR s[MAX_PATH]; UINT numBanks = CMainFrame::GetPrivateProfileLong("DLS Banks", "NumBanks", 0, theApp.GetConfigFileName()); for (UINT i=0; i<numBanks; i++) { - wsprintf(s, "Bank%d", i+1); - CString dlsFileName = CMainFrame::GetPrivateProfileCString("DLS Banks", s, "", theApp.GetConfigFileName()); - AddDLSBank(dlsFileName); + wsprintf(s, _T("Bank%d"), i+1); + TCHAR szPath[_MAX_PATH]; + GetPrivateProfileString("DLS Banks", s, "", szPath, INIBUFFERSIZE, theApp.GetConfigFileName()); + CMainFrame::RelativePathToAbsolute(szPath); + AddDLSBank(szPath); } - } else { + } else + { LoadRegistryDLS(); } @@ -520,21 +533,22 @@ BOOL CTrackApp::SaveDefaultDLSBanks() //----------------------------------- { - CHAR s[64]; + TCHAR s[64]; + TCHAR szPath[_MAX_PATH]; DWORD nBanks = 0; for (UINT i=0; i<MAX_DLS_BANKS; i++) { - if (!gpDLSBanks[i]) { + if (!gpDLSBanks[i] || !gpDLSBanks[i]->GetFileName() || !gpDLSBanks[i]->GetFileName()[0]) continue; - } - LPCSTR pszBankName = gpDLSBanks[i]->GetFileName(); - if (!(pszBankName) || !(pszBankName[0])) { - continue; + _tcsncpy(szPath, gpDLSBanks[i]->GetFileName(), ARRAYELEMCOUNT(szPath) - 1); + if(IsPortableMode()) + { + CMainFrame::AbsolutePathToRelative(szPath); } - wsprintf(s, "Bank%d", nBanks+1); - WritePrivateProfileString("DLS Banks", s, pszBankName, theApp.GetConfigFileName()); + wsprintf(s, _T("Bank%d"), nBanks+1); + WritePrivateProfileString("DLS Banks", s, szPath, theApp.GetConfigFileName()); nBanks++; } @@ -1496,7 +1510,7 @@ GetModuleFileName(AfxGetInstanceHandle(), s, sizeof(s)); GetShortPathName(s, exename, sizeof(exename)); if (RegCreateKey(HKEY_CLASSES_ROOT, - "ModPlugPlayer\\shell\\Edit\\command", + "OpenMPTFile\\shell\\Edit\\command", &key) == ERROR_SUCCESS) { strcpy(s, exename); @@ -1505,7 +1519,7 @@ RegCloseKey(key); } if (RegCreateKey(HKEY_CLASSES_ROOT, - "ModPlugPlayer\\shell\\Edit\\ddeexec", + "OpenMPTFile\\shell\\Edit\\ddeexec", &key) == ERROR_SUCCESS) { strcpy(s, "[Edit(\"%1\")]"); @@ -1876,7 +1890,7 @@ "coda for sample drawing code|" "http://coda.s3m.us/|" "Storlek for all the IT compatibility hints and testcases|" - "as well as the IMF loader|" + "as well as the IMF and ULT loaders|" "http://schismtracker.org/|" "kode54 for the PSM and J2B loaders|" "http://kode54.foobar2000.org/|" Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-28 17:21:44 UTC (rev 559) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-28 19:31:53 UTC (rev 560) @@ -427,6 +427,7 @@ // Tables extern const BYTE gEffectColors[MAX_EFFECTS]; +extern const BYTE gVolEffectColors[MAX_VOLCMDS]; extern const LPCSTR szNoteNames[12]; extern const LPCTSTR szDefaultNoteNames[NOTE_MAX]; //const LPCTSTR szSpecialNoteNames[NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1] = {TEXT("PCs"), TEXT("PC"), TEXT("~~"), TEXT("^^"), TEXT("==")}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-29 14:19:42
|
Revision: 562 http://modplug.svn.sourceforge.net/modplug/?rev=562&view=rev Author: saga-games Date: 2010-03-29 14:19:36 +0000 (Mon, 29 Mar 2010) Log Message: ----------- [Imp] Midi Library also makes use of relative paths now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-28 22:53:43 UTC (rev 561) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-29 14:19:36 UTC (rev 562) @@ -250,7 +250,7 @@ "[New] MIDI mapping: Editing a plug param in its editor while holding shift key will now open MIDI mapping dialog.\n" "[New] MIDI mapping: Can now record MIDI mapping changes to pattern.\n" "[Imp] MOD/S3M/XM/IT: Numerous improvements to load, save and playback compatibility.\n" - "[New] Input: Can import J2B (RIFF AM / RIFF AMFF), PSM16, IMF, GDM and SCL files. Improved PSM import.\n" + "[New] Input: Can import J2B (RIFF AM / RIFF AMFF), PSM16, IMF, GDM and SCL files. Improved PSM and ULT import.\n" "[New] Setup: New default directories: plugins and plugin presets, sharable colour schemes\n" "[New] Cleanup: New option compo cleanup, rearrange samples is back, can merge sequences.\n" "[Mod] Misc: Program settings are now by default stored in %APPDATA%\\OpenMPT\n" @@ -272,7 +272,7 @@ //================================================ { public: - BOOL m_bNoAcm, m_bNoDls, m_bNoMp3, m_bSafeMode, m_bWavEx, m_bNoPlugins, m_bDebug, + bool m_bNoAcm, m_bNoDls, m_bNoMp3, m_bSafeMode, m_bWavEx, m_bNoPlugins, m_bDebug, m_bNoSettingsOnNewVersion; CString m_csExtension; @@ -280,7 +280,7 @@ public: CMPTCommandLineInfo() { m_bNoAcm = m_bNoDls = m_bNoMp3 = m_bSafeMode = m_bWavEx = - m_bNoPlugins = m_bDebug = m_bNoSettingsOnNewVersion = FALSE; + m_bNoPlugins = m_bDebug = m_bNoSettingsOnNewVersion = false; m_csExtension = ""; } virtual void ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast); @@ -293,13 +293,13 @@ if ((lpszParam) && (bFlag)) { if (!lstrcmpi(lpszParam, "nologo")) { m_bShowSplash = FALSE; return; } else - if (!lstrcmpi(lpszParam, "nodls")) { m_bNoDls = TRUE; return; } else - if (!lstrcmpi(lpszParam, "noacm")) { m_bNoAcm = TRUE; return; } else - if (!lstrcmpi(lpszParam, "nomp3")) { m_bNoMp3 = TRUE; return; } else - if (!lstrcmpi(lpszParam, "wavex")) { m_bWavEx = TRUE; } else - if (!lstrcmpi(lpszParam, "noplugs")) { m_bNoPlugins = TRUE; } else - if (!lstrcmpi(lpszParam, "debug")) { m_bDebug = TRUE; } else - if (!lstrcmpi(lpszParam, "noSettingsOnNewVersion")) { m_bNoSettingsOnNewVersion = TRUE; } + if (!lstrcmpi(lpszParam, "nodls")) { m_bNoDls = true; return; } else + if (!lstrcmpi(lpszParam, "noacm")) { m_bNoAcm = true; return; } else + if (!lstrcmpi(lpszParam, "nomp3")) { m_bNoMp3 = true; return; } else + if (!lstrcmpi(lpszParam, "wavex")) { m_bWavEx = true; } else + if (!lstrcmpi(lpszParam, "noplugs")) { m_bNoPlugins = true; } else + if (!lstrcmpi(lpszParam, "debug")) { m_bDebug = true; } else + if (!lstrcmpi(lpszParam, "noSettingsOnNewVersion")) { m_bNoSettingsOnNewVersion = true; } } CCommandLineInfo::ParseParam(lpszParam, bFlag, bLast); } @@ -313,7 +313,7 @@ BOOL CTrackApp::ImportMidiConfig(LPCSTR lpszConfigFile, BOOL bNoWarn) //------------------------------------------------------------------- { - CHAR szFileName[_MAX_PATH], s[_MAX_PATH], szUltraSndPath[_MAX_PATH]; + TCHAR szFileName[_MAX_PATH], s[_MAX_PATH], szUltraSndPath[_MAX_PATH]; if ((!lpszConfigFile) || (!lpszConfigFile[0])) return FALSE; if (!glpMidiLibrary) @@ -356,23 +356,23 @@ } return TRUE; } - GetPrivateProfileString("Ultrasound", "PatchDir", "", szUltraSndPath, sizeof(szUltraSndPath), lpszConfigFile); - if (!strcmp(szUltraSndPath, ".\\")) szUltraSndPath[0] = 0; + GetPrivateProfileString(_T("Ultrasound"), _T("PatchDir"), _T(""), szUltraSndPath, sizeof(szUltraSndPath), lpszConfigFile); + if (!strcmp(szUltraSndPath, _T(".\\"))) szUltraSndPath[0] = 0; if (!szUltraSndPath[0]) GetCurrentDirectory(sizeof(szUltraSndPath), szUltraSndPath); for (UINT iMidi=0; iMidi<256; iMidi++) { szFileName[0] = 0; - wsprintf(s, (iMidi < 128) ? "Midi%d" : "Perc%d", iMidi & 0x7f); - GetPrivateProfileString("Midi Library", s, "", szFileName, sizeof(szFileName), lpszConfigFile); + wsprintf(s, (iMidi < 128) ? _T("Midi%d") : _T("Perc%d"), iMidi & 0x7f); + GetPrivateProfileString(_T("Midi Library"), s, _T(""), szFileName, sizeof(szFileName), lpszConfigFile); // Check for ULTRASND.INI if (!szFileName[0]) { - LPCSTR pszSection = (iMidi < 128) ? "Melodic Patches" : "Drum Patches"; - wsprintf(s, "%d", iMidi & 0x7f); - GetPrivateProfileString(pszSection, s, "", szFileName, sizeof(szFileName), lpszConfigFile); + LPCSTR pszSection = (iMidi < 128) ? _T("Melodic Patches") : _T("Drum Patches"); + wsprintf(s, _T("%d"), iMidi & 0x7f); + GetPrivateProfileString(pszSection, s, _T(""), szFileName, sizeof(szFileName), lpszConfigFile); if (!szFileName[0]) { - pszSection = (iMidi < 128) ? "Melodic Bank 0" : "Drum Bank 0"; + pszSection = (iMidi < 128) ? _T("Melodic Bank 0") : _T("Drum Bank 0"); GetPrivateProfileString(pszSection, s, "", szFileName, sizeof(szFileName), lpszConfigFile); } if (szFileName[0]) @@ -382,7 +382,7 @@ { strcpy(s, szUltraSndPath); int len = strlen(s)-1; - if ((len) && (s[len-1] != '\\')) strcat(s, "\\"); + if ((len) && (s[len-1] != '\\')) strcat(s, _T("\\")); } strncat(s, szFileName, sizeof(s)); strncat(s, ".pat", sizeof(s)); @@ -393,17 +393,9 @@ { if (!glpMidiLibrary->MidiMap[iMidi]) { - if ((glpMidiLibrary->MidiMap[iMidi] = new CHAR[_MAX_PATH]) == NULL) return FALSE; + if ((glpMidiLibrary->MidiMap[iMidi] = new TCHAR[_MAX_PATH]) == nullptr) return FALSE; } - if ((lpszConfigFile[1] == ':') && (szFileName[1] != ':')) - { - s[0] = lpszConfigFile[0]; - s[1] = lpszConfigFile[1]; - s[2] = 0; - strncat(s, szFileName, sizeof(s)); - s[sizeof(s)-1] = 0; - strcpy(szFileName, s); - } + CMainFrame::RelativePathToAbsolute(szFileName); strcpy(glpMidiLibrary->MidiMap[iMidi], szFileName); } } @@ -414,25 +406,22 @@ BOOL CTrackApp::ExportMidiConfig(LPCSTR lpszConfigFile) //----------------------------------------------------- { - CHAR szFileName[_MAX_PATH], s[128]; + TCHAR szFileName[_MAX_PATH], s[128]; if ((!glpMidiLibrary) || (!lpszConfigFile) || (!lpszConfigFile[0])) return FALSE; for (UINT iMidi=0; iMidi<256; iMidi++) if (glpMidiLibrary->MidiMap[iMidi]) { if (iMidi < 128) - wsprintf(s, "Midi%d", iMidi); + wsprintf(s, _T("Midi%d"), iMidi); else - wsprintf(s, "Perc%d", iMidi & 0x7F); - /*if ((glpMidiLibrary->MidiMap[iMidi][1] == ':') && (lpszConfigFile[1] == ':') - && ((glpMidiLibrary->MidiMap[iMidi][0]|0x20) == (lpszConfigFile[0]|0x20))) - { - strcpy(szFileName, glpMidiLibrary->MidiMap[iMidi]+2); - } else*/ - { - strcpy(szFileName, glpMidiLibrary->MidiMap[iMidi]); - } + wsprintf(s, _T("Perc%d"), iMidi & 0x7F); + + strcpy(szFileName, glpMidiLibrary->MidiMap[iMidi]); + if (szFileName[0]) { + if(IsPortableMode()) + CMainFrame::AbsolutePathToRelative(szFileName); if (!WritePrivateProfileString("Midi Library", s, szFileName, lpszConfigFile)) break; } } @@ -962,7 +951,7 @@ // Parse command line for standard shell commands, DDE, file open CMPTCommandLineInfo cmdInfo; - if (GetDSoundVersion() >= 0x0700) cmdInfo.m_bWavEx = TRUE; + if (GetDSoundVersion() >= 0x0700) cmdInfo.m_bWavEx = true; ParseCommandLine(cmdInfo); // create main MDI Frame window @@ -993,7 +982,7 @@ if (!cmdInfo.m_bNoDls) LoadDefaultDLSBanks(); // Initialize ACM Support - if (GetProfileInt("Settings", "DisableACM", 0)) cmdInfo.m_bNoAcm = TRUE; + if (GetProfileInt("Settings", "DisableACM", 0)) cmdInfo.m_bNoAcm = true; if (!cmdInfo.m_bNoMp3) InitializeACM(cmdInfo.m_bNoAcm); // Initialize DXPlugins Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-28 22:53:43 UTC (rev 561) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-29 14:19:36 UTC (rev 562) @@ -53,7 +53,7 @@ typedef struct MIDILIBSTRUCT { - LPSTR MidiMap[128*2]; // 128 instruments + 128 percussions + LPTSTR MidiMap[128*2]; // 128 instruments + 128 percussions } MIDILIBSTRUCT, *LPMIDILIBSTRUCT; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-28 22:53:43 UTC (rev 561) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-29 14:19:36 UTC (rev 562) @@ -1346,7 +1346,7 @@ } -BOOL CModTree::SetMidiInstrument(UINT nIns, LPCSTR lpszFileName) +BOOL CModTree::SetMidiInstrument(UINT nIns, LPCTSTR lpszFileName) //-------------------------------------------------------------- { LPMIDILIBSTRUCT lpMidiLib = CTrackApp::GetMidiLibrary(); @@ -1354,7 +1354,7 @@ { if (!lpMidiLib->MidiMap[nIns]) { - if ((lpMidiLib->MidiMap[nIns] = new CHAR[_MAX_PATH]) == NULL) return FALSE; + if ((lpMidiLib->MidiMap[nIns] = new TCHAR[_MAX_PATH]) == NULL) return FALSE; } strcpy(lpMidiLib->MidiMap[nIns], lpszFileName); RefreshMidiLibrary(); @@ -1364,7 +1364,7 @@ } -BOOL CModTree::SetMidiPercussion(UINT nPerc, LPCSTR lpszFileName) +BOOL CModTree::SetMidiPercussion(UINT nPerc, LPCTSTR lpszFileName) //--------------------------------------------------------------- { LPMIDILIBSTRUCT lpMidiLib = CTrackApp::GetMidiLibrary(); @@ -1373,7 +1373,7 @@ UINT nIns = nPerc | 0x80; if (!lpMidiLib->MidiMap[nIns]) { - if ((lpMidiLib->MidiMap[nIns] = new CHAR[_MAX_PATH]) == NULL) return FALSE; + if ((lpMidiLib->MidiMap[nIns] = new TCHAR[_MAX_PATH]) == NULL) return FALSE; } strcpy(lpMidiLib->MidiMap[nIns], lpszFileName); RefreshMidiLibrary(); Modified: trunk/OpenMPT/mptrack/View_tre.h =================================================================== --- trunk/OpenMPT/mptrack/View_tre.h 2010-03-28 22:53:43 UTC (rev 561) +++ trunk/OpenMPT/mptrack/View_tre.h 2010-03-29 14:19:36 UTC (rev 562) @@ -144,8 +144,8 @@ uint64 GetModItem(HTREEITEM hItem); inline uint32 GetModItemType(const uint64 modItem) {return static_cast<uint32>(modItem & 0xFFFF);}; // return "item type" part of mod item variable ( & 0xFFFF ) inline uint32 GetModItemID(const uint64 modItem) {return static_cast<uint32>(modItem >> 16);}; // return "item ID" part of mod item variable ( >> 16 ) - BOOL SetMidiInstrument(UINT nIns, LPCSTR lpszFileName); - BOOL SetMidiPercussion(UINT nPerc, LPCSTR lpszFileName); + BOOL SetMidiInstrument(UINT nIns, LPCTSTR lpszFileName); + BOOL SetMidiPercussion(UINT nPerc, LPCTSTR lpszFileName); BOOL ExecuteItem(HTREEITEM hItem); BOOL DeleteTreeItem(HTREEITEM hItem); BOOL PlayItem(HTREEITEM hItem, UINT nParam=0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-30 19:13:18
|
Revision: 564 http://modplug.svn.sourceforge.net/modplug/?rev=564&view=rev Author: saga-games Date: 2010-03-30 19:13:11 +0000 (Tue, 30 Mar 2010) Log Message: ----------- [Fix] Pattern Editor: When using MIDI record or split keyboard settings, volume data was writting into the volume column in MOD format. [Ref] Improved TCHAR handling of the previous patch (does not really matter at the moment, but let's better fix this right now) Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-29 20:00:06 UTC (rev 563) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-30 19:13:11 UTC (rev 564) @@ -135,7 +135,7 @@ CHAR s[_MAX_PATH], *pszCmd, *pszData; int len; - lstrcpyn(s, lpszCommand, sizeof(s)); + lstrcpyn(s, lpszCommand, CountOf(s)); len = strlen(s) - 1; while ((len > 0) && (strchr("(){}[]\'\" ", s[len]))) s[len--] = 0; pszCmd = s; @@ -356,24 +356,24 @@ } return TRUE; } - GetPrivateProfileString(_T("Ultrasound"), _T("PatchDir"), _T(""), szUltraSndPath, sizeof(szUltraSndPath), lpszConfigFile); + GetPrivateProfileString(_T("Ultrasound"), _T("PatchDir"), _T(""), szUltraSndPath, CountOf(szUltraSndPath), lpszConfigFile); if (!strcmp(szUltraSndPath, _T(".\\"))) szUltraSndPath[0] = 0; - if (!szUltraSndPath[0]) GetCurrentDirectory(sizeof(szUltraSndPath), szUltraSndPath); + if (!szUltraSndPath[0]) GetCurrentDirectory(CountOf(szUltraSndPath), szUltraSndPath); for (UINT iMidi=0; iMidi<256; iMidi++) { szFileName[0] = 0; wsprintf(s, (iMidi < 128) ? _T("Midi%d") : _T("Perc%d"), iMidi & 0x7f); - GetPrivateProfileString(_T("Midi Library"), s, _T(""), szFileName, sizeof(szFileName), lpszConfigFile); + GetPrivateProfileString(_T("Midi Library"), s, _T(""), szFileName, CountOf(szFileName), lpszConfigFile); // Check for ULTRASND.INI if (!szFileName[0]) { LPCSTR pszSection = (iMidi < 128) ? _T("Melodic Patches") : _T("Drum Patches"); wsprintf(s, _T("%d"), iMidi & 0x7f); - GetPrivateProfileString(pszSection, s, _T(""), szFileName, sizeof(szFileName), lpszConfigFile); + GetPrivateProfileString(pszSection, s, _T(""), szFileName, CountOf(szFileName), lpszConfigFile); if (!szFileName[0]) { pszSection = (iMidi < 128) ? _T("Melodic Bank 0") : _T("Drum Bank 0"); - GetPrivateProfileString(pszSection, s, "", szFileName, sizeof(szFileName), lpszConfigFile); + GetPrivateProfileString(pszSection, s, "", szFileName, CountOf(szFileName), lpszConfigFile); } if (szFileName[0]) { @@ -384,9 +384,9 @@ int len = strlen(s)-1; if ((len) && (s[len-1] != '\\')) strcat(s, _T("\\")); } - strncat(s, szFileName, sizeof(s)); - strncat(s, ".pat", sizeof(s)); - strcpy(szFileName, s); + _tcsncat(s, szFileName, CountOf(s)); + _tcsncat(s, ".pat", CountOf(s)); + _tcscpy(szFileName, s); } } if (szFileName[0]) @@ -396,7 +396,7 @@ if ((glpMidiLibrary->MidiMap[iMidi] = new TCHAR[_MAX_PATH]) == nullptr) return FALSE; } CMainFrame::RelativePathToAbsolute(szFileName); - strcpy(glpMidiLibrary->MidiMap[iMidi], szFileName); + _tcscpy(glpMidiLibrary->MidiMap[iMidi], szFileName); } } return FALSE; @@ -409,7 +409,7 @@ TCHAR szFileName[_MAX_PATH], s[128]; if ((!glpMidiLibrary) || (!lpszConfigFile) || (!lpszConfigFile[0])) return FALSE; - for (UINT iMidi=0; iMidi<256; iMidi++) if (glpMidiLibrary->MidiMap[iMidi]) + for(size_t iMidi = 0; iMidi < 256; iMidi++) if (glpMidiLibrary->MidiMap[iMidi]) { if (iMidi < 128) wsprintf(s, _T("Midi%d"), iMidi); @@ -418,7 +418,7 @@ strcpy(szFileName, glpMidiLibrary->MidiMap[iMidi]); - if (szFileName[0]) + if(szFileName[0]) { if(IsPortableMode()) CMainFrame::AbsolutePathToRelative(szFileName); @@ -449,8 +449,9 @@ { CHAR s[MAX_PATH]; UINT numBanks = CMainFrame::GetPrivateProfileLong("DLS Banks", "NumBanks", 0, theApp.GetConfigFileName()); - for (UINT i=0; i<numBanks; i++) { - wsprintf(s, _T("Bank%d"), i+1); + for(size_t i = 0; i < numBanks; i++) + { + wsprintf(s, _T("Bank%d"), i + 1); TCHAR szPath[_MAX_PATH]; GetPrivateProfileString("DLS Banks", s, "", szPath, INIBUFFERSIZE, theApp.GetConfigFileName()); CMainFrame::RelativePathToAbsolute(szPath); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-29 20:00:06 UTC (rev 563) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-30 19:13:11 UTC (rev 564) @@ -4226,22 +4226,36 @@ }*/ // -- write vol data + int volWrite = -1; if (vol >= 0 && vol <= 64 && !(isSplit && pModDoc->GetSplitKeyboardSettings()->splitVolume)) //write valid volume, as long as there's no split volume override. { - p->volcmd=VOLCMD_VOLUME; - p->vol = vol; + volWrite = vol; } else if (isSplit && pModDoc->GetSplitKeyboardSettings()->splitVolume) //cater for split volume override. { if (pModDoc->GetSplitKeyboardSettings()->splitVolume > 0 && pModDoc->GetSplitKeyboardSettings()->splitVolume <= 64) { - p->volcmd=VOLCMD_VOLUME; - p->vol = pModDoc->GetSplitKeyboardSettings()->splitVolume; + volWrite = pModDoc->GetSplitKeyboardSettings()->splitVolume; } } + if(volWrite != -1) + { + if(pSndFile->GetType() == MOD_TYPE_MOD) + { + p->command = CMD_VOLUME; + p->param = (MODCOMMAND::PARAM)volWrite; + } else + { + p->volcmd = VOLCMD_VOLUME; + p->vol = (MODCOMMAND::VOL)volWrite; + } + } + // -- write sdx if playing live - if (usePlaybackPosition && nTick) { // avoid SD0 which will be mis-interpreted - if (p->command == 0) { //make sure we don't overwrite any existing commands. + if (usePlaybackPosition && nTick) // avoid SD0 which will be mis-interpreted + { + if (p->command == 0) //make sure we don't overwrite any existing commands. + { p->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; UINT maxSpeed = 0x0F; if(pSndFile->m_nMusicSpeed > 0) maxSpeed = min(0x0F, pSndFile->m_nMusicSpeed - 1); @@ -4275,14 +4289,17 @@ } //Move cursor down only if not recording live. - if ( bIsLiveRecord == false ) + if(bIsLiveRecord == false) { - if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) { + if((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) + { - if (nRow + m_nSpacing < pSndFile->PatternSize[nPat] || (CMainFrame::m_dwPatternSetup & PATTERN_CONTSCROLL)) { + if(nRow + m_nSpacing < pSndFile->PatternSize[nPat] || (CMainFrame::m_dwPatternSetup & PATTERN_CONTSCROLL)) + { SetCurrentRow(nRow + m_nSpacing, (CMainFrame::m_dwPatternSetup & PATTERN_CONTSCROLL) ? true: false); m_bLastNoteEntryBlocked=false; - } else { + } else + { m_bLastNoteEntryBlocked=true; // if the cursor is block by the end of the pattern here, } // we must remember to not step back should the next note form a chord. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-05-07 18:23:25
|
Revision: 586 http://modplug.svn.sourceforge.net/modplug/?rev=586&view=rev Author: saga-games Date: 2010-05-07 18:23:18 +0000 (Fri, 07 May 2010) Log Message: ----------- [Imp] Sample Editor: When enabling a sample loop and only parts of the sample are selected [Imp] VST Editor: Instead of just saying the user that the plugin has to be assigned to an instrument to play notes, they are queried now whether they want to automatically add an instrument. [Ref] Related code refactoring Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/AbstractVstEditor.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-05-06 22:39:17 UTC (rev 585) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-05-07 18:23:18 UTC (rev 586) @@ -326,9 +326,8 @@ m_nInstrument = GetBestInstrumentCandidate(); } - if (m_nInstrument<0 && m_pVstPlugin->CanRecieveMidiEvents()) { //only send warning if plug is able to process notes. - AfxMessageBox("You need to assign an instrument to this plugin before you can play notes from here."); - } else { + if(QueryAddInstrumentIfNeeded()) + { CModDoc* pModDoc = m_pVstPlugin->GetModDoc(); CMainFrame* pMainFrm = CMainFrame::GetMainFrame(); pModDoc->PlayNote(wParam-kcVSTGUIStartNotes+1+pMainFrm->GetBaseOctave()*12, m_nInstrument, 0, FALSE); @@ -337,12 +336,13 @@ } if (wParam>=kcVSTGUIStartNoteStops && wParam<=kcVSTGUIEndNoteStops) { - if (!CheckInstrument(m_nInstrument)) { + if (!CheckInstrument(m_nInstrument)) + { m_nInstrument = GetBestInstrumentCandidate(); } - if (m_nInstrument<0 && m_pVstPlugin->CanRecieveMidiEvents()) { //only send warning if plug is able to process notes. - AfxMessageBox("You need to assign an instrument to this plugin before you can play notes from here."); - } else { + + if(QueryAddInstrumentIfNeeded()) + { CModDoc* pModDoc = m_pVstPlugin->GetModDoc(); CMainFrame* pMainFrm = CMainFrame::GetMainFrame(); pModDoc->NoteOff(wParam-kcVSTGUIStartNoteStops+1+pMainFrm->GetBaseOctave()*12, FALSE, m_nInstrument); @@ -353,6 +353,50 @@ return NULL; } + +// Weird name! :-P +// When trying to play a note using this plugin, but no instrument is assigned to it, +// the user is asked whether a new instrument should be added. +bool CAbstractVstEditor::QueryAddInstrumentIfNeeded() +//--------------------------------------------------- +{ + //only send warning if plug is able to process notes. + if(m_nInstrument < 0 && m_pVstPlugin->CanRecieveMidiEvents()) + { + CModDoc *pModDoc = m_pVstPlugin->GetModDoc(); + if(!pModDoc || !pModDoc->GetSoundFile()) + return false; + + if(pModDoc->GetSoundFile()->GetModSpecifications().instrumentsMax == 0 || + AfxMessageBox(_T("You need to assign an instrument to this plugin before you can play notes from here.\nCreate a new instrument and assign this plugin to the instrument?"), MB_YESNO | MB_ICONQUESTION) == IDNO) + { + return false; + } else + { + // try to set up a new instrument + INSTRUMENTINDEX nIns = pModDoc->InsertInstrument(0); + if(nIns == INSTRUMENTINDEX_INVALID) + return false; + + MODINSTRUMENT *pIns = pModDoc->GetSoundFile()->Instruments[nIns]; + m_nInstrument = nIns; + + _snprintf(pIns->name, ARRAYELEMCOUNT(pIns->name) - 1, _T("%d: %s"), m_pVstPlugin->GetSlot() + 1, pModDoc->GetSoundFile()->m_MixPlugins[m_pVstPlugin->GetSlot()].Info.szName); + _snprintf(pIns->filename, ARRAYELEMCOUNT(pIns->filename) - 1, _T("FX %d"), m_pVstPlugin->GetSlot() + 1); + pIns->nMixPlug = m_pVstPlugin->GetSlot() + 1; + pIns->nMidiChannel = 1; + pIns->wMidiBank = (m_pVstPlugin->GetCurrentProgram() >> 7) + 1; + pIns->nMidiProgram = (m_pVstPlugin->GetCurrentProgram() & 0x7F) + 1; + + return true; + } + } else + { + return true; + } + +} + #define PRESETS_PER_COLUMN 32 #define PRESETS_PER_GROUP 128 Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.h =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.h 2010-05-06 22:39:17 UTC (rev 585) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.h 2010-05-07 18:23:18 UTC (rev 586) @@ -64,6 +64,7 @@ void UpdateOptionsMenu(); int GetBestInstrumentCandidate(); bool CheckInstrument(int instrument); + bool QueryAddInstrumentIfNeeded(); int m_nInstrument; int m_nLearnMacro; @@ -71,6 +72,7 @@ void OnSetInputInstrument(UINT nID); afx_msg void OnInitMenu(CMenu* pMenu); void PrepareToLearnMacro(UINT nID); + }; //end rewbs.defaultPlugGUI Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-05-06 22:39:17 UTC (rev 585) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-05-07 18:23:18 UTC (rev 586) @@ -2562,7 +2562,15 @@ // set loop points if theren't any if(wasDisabled && ((pSmp->uFlags & CHN_LOOP) != 0) && (pSmp->nLoopStart == pSmp->nLoopEnd) && (pSmp->nLoopStart == 0)) { - pSmp->nLoopEnd = pSmp->nLength; + SELECTIONPOINTS selection = GetSelectionPoints(); + if(selection.bSelected) + { + pSmp->nLoopStart = selection.nStart; + pSmp->nLoopEnd = selection.nEnd; + } else + { + pSmp->nLoopEnd = pSmp->nLength; + } m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); } m_pModDoc->AdjustEndOfSample(m_nSample); @@ -2635,7 +2643,15 @@ // set sustain loop points if theren't any if(wasDisabled && ((pSmp->uFlags & CHN_SUSTAINLOOP) != 0) && (pSmp->nSustainStart == pSmp->nSustainEnd) && (pSmp->nSustainStart == 0)) { - pSmp->nSustainEnd = pSmp->nLength; + SELECTIONPOINTS selection = GetSelectionPoints(); + if(selection.bSelected) + { + pSmp->nSustainStart = selection.nStart; + pSmp->nSustainEnd = selection.nEnd; + } else + { + pSmp->nSustainEnd = pSmp->nLength; + } m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); } m_pModDoc->SetModified(); Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-05-06 22:39:17 UTC (rev 585) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-05-07 18:23:18 UTC (rev 586) @@ -226,7 +226,7 @@ PATTERNINDEX InsertPattern(ORDERINDEX nOrd = ORDERINDEX_INVALID, ROWINDEX nRows = 64); SAMPLEINDEX InsertSample(bool bLimit = false); - INSTRUMENTINDEX InsertInstrument(LONG lSample = 0, LONG lDuplicate = 0); + INSTRUMENTINDEX InsertInstrument(SAMPLEINDEX lSample = SAMPLEINDEX_INVALID, INSTRUMENTINDEX lDuplicate = INSTRUMENTINDEX_INVALID); void InitializeInstrument(MODINSTRUMENT *pIns, UINT nsample=0); bool RemoveOrder(SEQUENCEINDEX nSeq, ORDERINDEX nOrd); bool RemovePattern(PATTERNINDEX nPat); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-05-06 22:39:17 UTC (rev 585) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-05-07 18:23:18 UTC (rev 586) @@ -732,15 +732,17 @@ } -INSTRUMENTINDEX CModDoc::InsertInstrument(LONG lSample, LONG lDuplicate) -//---------------------------------------------------------------------- +// Insert a new instrument assigned to sample nSample or duplicate instrument nDuplicate. +// If nSample is invalid, an approriate sample slot is selected. 0 means "no sample". +INSTRUMENTINDEX CModDoc::InsertInstrument(SAMPLEINDEX nSample, INSTRUMENTINDEX nDuplicate) +//---------------------------------------------------------------------------------------- { - MODINSTRUMENT *pDup = NULL; - INSTRUMENTINDEX nInstrumentMax = m_SndFile.GetModSpecifications().instrumentsMax - 1; + MODINSTRUMENT *pDup = nullptr; + const INSTRUMENTINDEX nInstrumentMax = m_SndFile.GetModSpecifications().instrumentsMax - 1; if ((m_SndFile.m_nType != MOD_TYPE_XM) && !(m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) return INSTRUMENTINDEX_INVALID; - if ((lDuplicate > 0) && (lDuplicate <= (LONG)m_SndFile.m_nInstruments)) + if ((nDuplicate > 0) && (nDuplicate <= m_SndFile.m_nInstruments)) { - pDup = m_SndFile.Instruments[lDuplicate]; + pDup = m_SndFile.Instruments[nDuplicate]; } if ((!m_SndFile.m_nInstruments) && ((m_SndFile.m_nSamples > 1) || (m_SndFile.Samples[1].pSample))) { @@ -748,9 +750,9 @@ UINT n = CMainFrame::GetMainFrame()->MessageBox("Convert existing samples to instruments first?", NULL, MB_YESNOCANCEL|MB_ICONQUESTION); if (n == IDYES) { - UINT nInstruments = m_SndFile.m_nSamples; + SAMPLEINDEX nInstruments = m_SndFile.m_nSamples; if (nInstruments > nInstrumentMax) nInstruments = nInstrumentMax; - for (UINT smp=1; smp<=nInstruments; smp++) + for (SAMPLEINDEX smp = 1; smp <= nInstruments; smp++) { m_SndFile.Samples[smp].uFlags &= ~CHN_MUTE; if (!m_SndFile.Instruments[smp]) @@ -771,7 +773,7 @@ if (n != IDNO) return INSTRUMENTINDEX_INVALID; } UINT newins = 0; - for (UINT i=1; i<=m_SndFile.m_nInstruments; i++) + for (INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++) { if (!m_SndFile.Instruments[i]) { @@ -791,10 +793,10 @@ MODINSTRUMENT *pIns = new MODINSTRUMENT; if (pIns) { - UINT newsmp = 0; - if ((lSample > 0) && (lSample < m_SndFile.GetModSpecifications().samplesMax)) + SAMPLEINDEX newsmp = 0; + if (nSample < m_SndFile.GetModSpecifications().samplesMax) { - newsmp = lSample; + newsmp = nSample; } else if (!pDup) { @@ -818,7 +820,7 @@ *pIns = *pDup; // -> CODE#0023 // -> DESC="IT project files (.itp)" - strcpy(m_SndFile.m_szInstrumentPath[newins-1],m_SndFile.m_szInstrumentPath[lDuplicate-1]); + strcpy(m_SndFile.m_szInstrumentPath[newins - 1], m_SndFile.m_szInstrumentPath[nDuplicate - 1]); m_SndFile.instrumentModified[newins-1] = FALSE; // -! NEW_FEATURE#0023 } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |