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. |