From: <sag...@us...> - 2014-03-10 18:14:06
|
Revision: 3855 http://sourceforge.net/p/modplug/code/3855 Author: saga-games Date: 2014-03-10 18:13:55 +0000 (Mon, 10 Mar 2014) Log Message: ----------- [Ref] Add sequenceMax to CModSpecifications so that we don't have to implicitely assume that only MOD_TYPE_MPT can have more than one sequence. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/mod_specifications.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-03-09 17:19:57 UTC (rev 3854) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-03-10 18:13:55 UTC (rev 3855) @@ -261,7 +261,7 @@ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), false); // Enable/disable multisequence controls according the current modtype. - BOOL isMultiSeqAvail = (m_sndFile.GetType() == MOD_TYPE_MPT) ? TRUE : FALSE; + BOOL isMultiSeqAvail = (m_sndFile.GetModSpecifications().sequencesMax > 1) ? TRUE : FALSE; GetDlgItem(IDC_STATIC_SEQUENCE_NAME)->EnableWindow(isMultiSeqAvail); GetDlgItem(IDC_EDIT_SEQUENCE_NAME)->EnableWindow(isMultiSeqAvail); GetDlgItem(IDC_EDIT_SEQNUM)->EnableWindow(isMultiSeqAvail); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-03-09 17:19:57 UTC (rev 3854) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-03-10 18:13:55 UTC (rev 3855) @@ -1004,7 +1004,7 @@ AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_PROPERTIES, "&Pattern Properties..."); } - if (sndFile.GetType() == MOD_TYPE_MPT) + if (sndFile.GetModSpecifications().sequencesMax > 1) { AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-03-09 17:19:57 UTC (rev 3854) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-03-10 18:13:55 UTC (rev 3855) @@ -2097,7 +2097,7 @@ const SEQUENCEINDEX nOrigSeq = (SEQUENCEINDEX)modItemDragID; const ModSequence &origSeq = dragSndFile.Order.GetSequence(nOrigSeq); - if(pSndFile->GetType() == MOD_TYPE_MPT) + if(pSndFile->GetModSpecifications().sequencesMax > 1) { pSndFile->Order.AddSequence(false); } @@ -2483,7 +2483,7 @@ bool isCurSeq = false; CModDoc *pModDoc = GetDocumentFromItem(hItem); CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; - if(pSndFile && (pSndFile->GetType() == MOD_TYPE_MPT)) + if(pSndFile && pSndFile->GetModSpecifications().sequencesMax > 1) { if(pSndFile->Order.GetSequence((SEQUENCEINDEX)modItemID).GetLength() == 0) { @@ -2507,7 +2507,7 @@ { CModDoc *pModDoc = GetDocumentFromItem(hItem); CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; - if(pSndFile && (pSndFile->GetType() == MOD_TYPE_MPT)) + if(pSndFile && pSndFile->GetModSpecifications().sequencesMax > 1) { AppendMenu(hMenu, MF_STRING, ID_MODTREE_INSERT, "&Insert Sequence"); if(pSndFile->Order.GetNumSequences() == 1) // this is a sequence @@ -3473,7 +3473,7 @@ break; case MODITEM_HDR_ORDERS: - if(sndFile.Order.GetNumSequences() != 1 || sndFile.GetType() != MOD_TYPE_MPT) + if(sndFile.Order.GetNumSequences() != 1 || sndFile.GetModSpecifications().sequencesMax <= 1) { break; } Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2014-03-09 17:19:57 UTC (rev 3854) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2014-03-10 18:13:55 UTC (rev 3855) @@ -267,7 +267,7 @@ // Limit number of orders to be inserted. LimitMax(nCount, ORDERINDEX(m_sndFile.GetModSpecifications().ordersMax - nPos)); // Calculate new length. - const ORDERINDEX nNewLength = MIN(nLengthTt + nCount, m_sndFile.GetModSpecifications().ordersMax); + const ORDERINDEX nNewLength = std::min<ORDERINDEX>(nLengthTt + nCount, m_sndFile.GetModSpecifications().ordersMax); // Resize if needed. if (nNewLength > GetLength()) resize(nNewLength); @@ -477,11 +477,11 @@ GetSequence(n).AdjustToNewModType(oldtype); } // Multisequences not suppported by other formats - if(oldtype != MOD_TYPE_NONE && newtype != MOD_TYPE_MPT) + if(oldtype != MOD_TYPE_NONE && m_sndFile.GetModSpecifications().sequencesMax <= 1) MergeSequences(); // Convert sequence with separator patterns into multiple sequences? - if(oldtype != MOD_TYPE_NONE && newtype == MOD_TYPE_MPT && GetNumSequences() == 1) + if(oldtype != MOD_TYPE_NONE && m_sndFile.GetModSpecifications().sequencesMax > 1 && GetNumSequences() == 1) ConvertSubsongsToMultipleSequences(); } @@ -489,6 +489,7 @@ bool ModSequenceSet::ConvertSubsongsToMultipleSequences() //------------------------------------------------------- { +#ifdef MODPLUG_TRACKER // Allow conversion only if there's only one sequence. if(GetNumSequences() != 1 || m_sndFile.GetType() != MOD_TYPE_MPT) return false; @@ -506,13 +507,8 @@ bool modified = false; if(hasSepPatterns && -#ifdef MODPLUG_TRACKER Reporting::Confirm("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", false, true) == cnfYes -#else - false -#endif - ) + "Order list conversion", false, true) == cnfYes) { SetSequence(0); @@ -573,6 +569,9 @@ SetSequence(0); } return modified; +#else + return false; +#endif // MODPLUG_TRACKER } Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.cpp 2014-03-09 17:19:57 UTC (rev 3854) +++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2014-03-10 18:13:55 UTC (rev 3855) @@ -32,6 +32,7 @@ true, // Has notefade. 4000, // Pattern max. 4000, // Order max. + MAX_SEQUENCES, // Sequences max 1, // Channel min 127, // Channel max 32, // Min tempo @@ -77,6 +78,7 @@ false, // No notefade. 128, // Pattern max. 128, // Order max. + 1, // Only one order list 4, // Channel min 99, // Channel max 32, // Min tempo @@ -120,6 +122,7 @@ false, // No notefade. 256, // Pattern max. 255, // Order max. + 1, // Only one order list 1, // Channel min 32, // Channel max 32, // Min tempo @@ -163,6 +166,7 @@ false, // No notefade. 256, // Pattern max. 255, // Order max. + 1, // Only one order list 1, // Channel min 127, // Channel max 32, // Min tempo @@ -205,6 +209,7 @@ false, // No notefade. 100, // Pattern max. 255, // Order max. + 1, // Only one order list 1, // Channel min 32, // Channel max 33, // Min tempo @@ -248,6 +253,7 @@ false, // No notefade. 100, // Pattern max. 255, // Order max. + 1, // Only one order list 1, // Channel min 32, // Channel max 33, // Min tempo @@ -290,6 +296,7 @@ true, // Has notefade. 200, // Pattern max. 256, // Order max. + 1, // Only one order list 1, // Channel min 64, // Channel max 32, // Min tempo @@ -332,6 +339,7 @@ true, // Has notefade. 240, // Pattern max. 256, // Order max. + 1, // Only one order list 1, // Channel min 127, // Channel max 32, // Min tempo Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2014-03-09 17:19:57 UTC (rev 3854) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2014-03-10 18:13:55 UTC (rev 3855) @@ -41,6 +41,7 @@ bool hasNoteFade; // True if format has notefade. PATTERNINDEX patternsMax; ORDERINDEX ordersMax; + SEQUENCEINDEX sequencesMax; CHANNELINDEX channelsMin; // Minimum number of editable channels in pattern. CHANNELINDEX channelsMax; // Maximum number of editable channels in pattern. TEMPO tempoMin; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |