You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
| 2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
| 2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
| 2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
| 2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
| 2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
| 2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
| 2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
| 2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
| 2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
| 2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
| 2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
| 2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
| 2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
| 2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
| 2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
| 2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
| 2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(203) |
Sep
(148) |
Oct
(109) |
Nov
(191) |
Dec
(209) |
| 2026 |
Jan
(127) |
Feb
(123) |
Mar
(160) |
Apr
(141) |
May
(49) |
Jun
(55) |
Jul
(91) |
Aug
(191) |
Sep
|
Oct
(68) |
Nov
|
Dec
|
|
From: <sag...@us...> - 2010-01-09 20:06:39
|
Revision: 460
http://modplug.svn.sourceforge.net/modplug/?rev=460&view=rev
Author: saga-games
Date: 2010-01-09 20:06:18 +0000 (Sat, 09 Jan 2010)
Log Message:
-----------
[Fix] Mod Loaders: Very short sample sustain loops are now also accepted (similar fix to normal loop points)
[Fix] Order list: Fixed display error when selecting multiple orders, inserting them and clicking on another order (only first order of previous selection was un-highlighted)
[Imp] VST Editor: When dealing with midi learn in vst editors (with Shift key), also accept child windows of the VST editor as valid window. This still doesn't fix the Shift+clicking sliders issue in Synth1, but might help with other plugins.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.h
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.h 2010-01-08 20:56:53 UTC (rev 459)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2010-01-09 20:06:18 UTC (rev 460)
@@ -44,7 +44,6 @@
BOOL Init(const CRect&, CCtrlPatterns *pParent, CModDoc *, HFONT hFont);
void InvalidateSelection() const;
UINT GetCurrentPattern() const;
- ORD_SELECTION GetCurSel(bool bIgnoreSelection) const;
// make the current selection the secondary selection (used for keyboard orderlist navigation)
inline void SetCurSelTo2ndSel(bool isSelectionKeyPressed)
{ if(isSelectionKeyPressed && m_nScrollPos2nd == ORDERINDEX_INVALID) m_nScrollPos2nd = m_nScrollPos;
@@ -58,6 +57,10 @@
ORDERINDEX GetOrderFromPoint(const CRect& rect, const CPoint& pt) const;
+ // Get the currently selected pattern(s).
+ // Set bIgnoreSelection to true if only the first selected point is important.
+ ORD_SELECTION GetCurSel(bool bIgnoreSelection) const;
+
// Sets target margin value and returns the effective margin value.
BYTE SetMargins(int);
@@ -83,6 +86,9 @@
// is not interpreted to be in margins regardless of the margin value.
bool IsOrderInMargins(int order, int startOrder);
+ // Ensure that a given order index is visible in the orderlist view.
+ void EnsureVisible(ORDERINDEX order);
+
// Set given sqeuence and update orderlist display.
void SelectSequence(const SEQUENCEINDEX nSeq);
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-01-08 20:56:53 UTC (rev 459)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-01-09 20:06:18 UTC (rev 460)
@@ -71,7 +71,7 @@
BYTE COrderList::s_nDefaultMargins = 0;
bool COrderList::IsOrderInMargins(int order, int startOrder)
-//-----------------------------------------------------
+//----------------------------------------------------------
{
const BYTE nMargins = GetMargins();
return ((startOrder != 0 && order - startOrder < nMargins) ||
@@ -79,6 +79,29 @@
}
+void COrderList::EnsureVisible(ORDERINDEX order)
+//----------------------------------------------
+{
+ // nothing needs to be done
+ if(!IsOrderInMargins(order, m_nXScroll) || order == ORDERINDEX_INVALID) return;
+
+ if(order < m_nXScroll)
+ {
+ if(order < GetMargins())
+ m_nXScroll = 0;
+ else
+ m_nXScroll = order - GetMargins();
+ } else
+ {
+ m_nXScroll = order + 2 * GetMargins() - 1;
+ if(m_nXScroll < GetLength())
+ m_nXScroll = 0;
+ else
+ m_nXScroll -= GetLength();
+ }
+}
+
+
COrderList::COrderList()
//----------------------
{
@@ -235,6 +258,7 @@
return result;
}
+
bool COrderList::SetCurSel(ORDERINDEX sel, bool bEdit, bool bShiftClick, bool bIgnoreCurSel)
//------------------------------------------------------------------------------------------
{
@@ -1165,6 +1189,12 @@
m_nScrollPos2nd = min(m_nScrollPos + nInsertCount, pSndFile->Order.GetLastIndex());
else
m_nScrollPos2nd = ORDERINDEX_INVALID;
+
+ InvalidateSelection();
+ EnsureVisible(m_nScrollPos2nd);
+ // first inserted order has higher priority than the last one
+ EnsureVisible(m_nScrollPos);
+
InvalidateRect(NULL, FALSE);
m_pModDoc->SetModified();
m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this);
@@ -1324,7 +1354,7 @@
BYTE COrderList::SetMargins(int i)
-//----------------------------------------------
+//--------------------------------
{
m_nOrderlistMargins = static_cast<BYTE>(i);
return GetMargins();
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-01-08 20:56:53 UTC (rev 459)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-01-09 20:06:18 UTC (rev 460)
@@ -669,7 +669,7 @@
pModDoc->RecordParamChange(pVstPlugin->GetSlot(), index);
}
- if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && (pVstPlugin->GetEditor()->m_hWnd == ::GetForegroundWindow()))
+ if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && (pVstPlugin->GetEditor()->m_hWnd == ::GetForegroundWindow() || ::IsChild(pVstPlugin->GetEditor()->m_hWnd, ::GetForegroundWindow())))
{
CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once.
CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor();
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-01-08 20:56:53 UTC (rev 459)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-01-09 20:06:18 UTC (rev 460)
@@ -667,7 +667,7 @@
pSmp->nLoopEnd = 0;
}
if (pSmp->nSustainEnd > pSmp->nLength) pSmp->nSustainEnd = pSmp->nLength;
- if (pSmp->nSustainStart + 3 >= pSmp->nSustainEnd)
+ if (pSmp->nSustainStart >= pSmp->nSustainEnd)
{
pSmp->nSustainStart = 0;
pSmp->nSustainEnd = 0;
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-08 12:50:23
|
Revision: 458
http://modplug.svn.sourceforge.net/modplug/?rev=458&view=rev
Author: saga-games
Date: 2010-01-08 12:14:54 +0000 (Fri, 08 Jan 2010)
Log Message:
-----------
[Fix] Instrument Editor: Well, apparently there WAS a reason to not use InvalidateRect (Toggling loop points did not update the toolbar)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_ins.cpp
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-08 12:01:38 UTC (rev 457)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-08 12:14:54 UTC (rev 458)
@@ -2366,7 +2366,7 @@
if(!EnvGetLoop())
EnvSetLoopStart(0);
EnvSetLoopStart(m_nDragItem - 1);
- InvalidateRect(NULL, FALSE);
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2381,7 +2381,7 @@
EnvSetLoopStart(0);
}
EnvSetLoopEnd(m_nDragItem - 1);
- InvalidateRect(NULL, FALSE);
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2393,7 +2393,7 @@
if(!EnvGetSustain())
EnvSetSustain(true);
EnvSetSustainStart(m_nDragItem - 1);
- InvalidateRect(NULL, FALSE);
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2408,7 +2408,7 @@
EnvSetSustainStart(0);
}
EnvSetSustainEnd(m_nDragItem - 1);
- InvalidateRect(NULL, FALSE);
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2419,8 +2419,9 @@
if(pEnv == nullptr || !IsDragItemEnvPoint()) return;
if(EnvToggleReleaseNode(m_nDragItem - 1))
{
- GetDocument()->SetModified();
- InvalidateRect(NULL, FALSE);
+ CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already
+ pModDoc->SetModified();
+ pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
}
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: <rel...@us...> - 2010-01-07 17:10:27
|
Revision: 456
http://modplug.svn.sourceforge.net/modplug/?rev=456&view=rev
Author: relabsoluness
Date: 2010-01-07 17:10:05 +0000 (Thu, 07 Jan 2010)
Log Message:
-----------
[New] Tuning: Can import scl-files. Upper limit for note count is 64.
[Imp] SoundTouch: Update to version 1.5.0.
[Mod] XM/MOD: Allow extended XM/MOD files to use '+++'-items again.
[Fix] Orderlist: Deleting orders didn't set document modified (appeared in rev. 406).
[Fix] GUI: Fixes to handling of 32 chars long instrument name.
[Ref/Fix/Mod] Minor tweaks and fixes (changed some "modplug tracker" strings to "OpenMPT", added a couple of utility functions, added tuning directory to existing default/working directory system...).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/Mptrack.h
trunk/OpenMPT/mptrack/TuningDialog.cpp
trunk/OpenMPT/mptrack/TuningDialog.h
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/misc_util.cpp
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/mptrack/test/test.cpp
trunk/OpenMPT/packageTemplate/SoundTouch/README.html
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/mod_specifications.h
trunk/OpenMPT/soundlib/tuningCollection.cpp
trunk/OpenMPT/soundlib/tuningbase.cpp
trunk/OpenMPT/soundlib/tuningbase.h
trunk/OpenMPT/soundlib/tuningcollection.h
trunk/OpenMPT/soundtouch/3dnow_win.cpp
trunk/OpenMPT/soundtouch/BPMDetect.cpp
trunk/OpenMPT/soundtouch/BPMDetect.h
trunk/OpenMPT/soundtouch/FIFOSampleBuffer.cpp
trunk/OpenMPT/soundtouch/FIFOSampleBuffer.h
trunk/OpenMPT/soundtouch/FIFOSamplePipe.h
trunk/OpenMPT/soundtouch/FIRFilter.cpp
trunk/OpenMPT/soundtouch/FIRFilter.h
trunk/OpenMPT/soundtouch/PeakFinder.cpp
trunk/OpenMPT/soundtouch/PeakFinder.h
trunk/OpenMPT/soundtouch/README.html
trunk/OpenMPT/soundtouch/RateTransposer.cpp
trunk/OpenMPT/soundtouch/RateTransposer.h
trunk/OpenMPT/soundtouch/STTypes.h
trunk/OpenMPT/soundtouch/SoundTouch.cpp
trunk/OpenMPT/soundtouch/SoundTouch.h
trunk/OpenMPT/soundtouch/TDStretch.cpp
trunk/OpenMPT/soundtouch/TDStretch.h
trunk/OpenMPT/soundtouch/cpu_detect_x86_win.cpp
trunk/OpenMPT/soundtouch/mmx_optimized.cpp
trunk/OpenMPT/soundtouch/sse_optimized.cpp
Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -469,7 +469,7 @@
if (nIns==0 && (inputPlugs.GetSize() || inputChannels.GetSize())) {
m_pInputMenu->AppendMenu(MF_SEPARATOR);
}
- name.Format("Ins%02d: %s", inputInstruments[nIns], pSndFile->Instruments[inputInstruments[nIns]]->name);
+ name.Format("Ins%02d: %s", inputInstruments[nIns], (LPCTSTR)pSndFile->GetInstrumentName(inputInstruments[nIns]));
if (inputInstruments[nIns] == (UINT)m_nInstrument) checked=true;
m_pInputMenu->AppendMenu(MF_STRING|(checked?MF_CHECKED:0), ID_SELECTINST+inputInstruments[nIns], name);
}
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -1192,6 +1192,7 @@
pSndFile->Order.Remove(selection.nOrdLo, selection.nOrdHi);
+ m_pModDoc->SetModified();
InvalidateRect(NULL, FALSE);
m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this);
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -310,6 +310,8 @@
for(UINT i = 0; i < NUM_DIRS; i++)
{
+ if (i == DIR_TUNING) // Hack: Tuning folder is set already so don't reset it.
+ continue;
m_szDefaultDirectory[i][0] = 0;
m_szWorkingDirectory[i][0] = 0;
}
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -372,6 +372,7 @@
DIR_PLUGINS,
DIR_PLUGINPRESETS,
DIR_EXPORT,
+ DIR_TUNING,
NUM_DIRS
};
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -3486,7 +3486,7 @@
{
const SAMPLEINDEX nSmp = m_SndFile.Instruments[nInstr]->Keyboard[60];
if (nSmp < ARRAYELEMCOUNT(m_SndFile.Samples) && m_SndFile.Samples[nSmp].pSample)
- instrumentName.Format(TEXT("s: %s"), (LPCTSTR)m_SndFile.GetSampleName(nSmp)); //60 is C-5
+ instrumentName.Format(TEXT("s: %s"), m_SndFile.GetSampleName(nSmp)); //60 is C-5
}
// Get plugin name.
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -790,12 +790,13 @@
}
// Create tunings dir
- strcpy(m_szTuningsDirectory, m_szConfigDirectory);
- strcat(m_szTuningsDirectory, "tunings\\");
+ CString sTuningPath;
+ sTuningPath.Format(TEXT("%stunings\\"), m_szConfigDirectory);
+ CMainFrame::SetDefaultDirectory(sTuningPath, DIR_TUNING);
- if(PathIsDirectory(m_szTuningsDirectory) == 0)
+ if(PathIsDirectory(CMainFrame::GetDefaultDirectory(DIR_TUNING)) == 0)
{
- CreateDirectory(m_szTuningsDirectory, 0);
+ CreateDirectory(CMainFrame::GetDefaultDirectory(DIR_TUNING), 0);
}
if(!bIsAppDir)
Modified: trunk/OpenMPT/mptrack/Mptrack.h
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/Mptrack.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -155,7 +155,6 @@
MODMIDICFG m_MidiCfg;
TCHAR m_szExePath[_MAX_PATH];
TCHAR m_szConfigDirectory[_MAX_PATH];
- TCHAR m_szTuningsDirectory[_MAX_PATH];
TCHAR m_szConfigFileName[_MAX_PATH];
TCHAR m_szPluginCacheFileName[_MAX_PATH];
TCHAR m_szStringsFileName[_MAX_PATH];
@@ -202,7 +201,6 @@
BOOL IsDebug() const { return m_bDebugMode; }
LPCSTR GetConfigFileName() const { return m_szConfigFileName; }
LPCSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; }
- LPCSTR GetTuningsPath() const { return m_szTuningsDirectory; }
LPCSTR GetConfigPath() const { return m_szConfigDirectory; }
void SetupPaths();
@@ -439,6 +437,7 @@
const LPCSTR gszModCommands = " 0123456789ABCDRFFTE???GHK?YXPLZ\\:#??"; //rewbs.smoothVST: added last \ (written as \\); rewbs.velocity: added last :
const LPCSTR gszS3mCommands = " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#??"; //rewbs.smoothVST: added last \ (written as \\); rewbs.velocity: added last :
const LPCSTR gszVolCommands = " vpcdabuhlrgfe:o"; //rewbs.velocity: added last : ; rewbs.volOff added last o
+const TCHAR gszEmpty[] = TEXT("");
// Defined in load_mid.cpp
extern const LPCSTR szMidiProgramNames[128];
Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TuningDialog.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "mptrack.h"
#include "TuningDialog.h"
+#include "MainFrm.h"
#include <algorithm>
#include "misc_util.h"
#include ".\tuningdialog.h"
@@ -627,7 +628,7 @@
FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, CTuning::s_FileExtension, "",
filter,
- theApp.GetTuningsPath());
+ CMainFrame::GetWorkingDirectory(DIR_TUNING));
if(files.abort) return;
BeginWaitCursor();
@@ -655,67 +656,141 @@
ErrorBox(IDS_ERR_EXPORT_TUNING, this);
}
+
void CTuningDialog::OnBnClickedButtonImport()
//-------------------------------------------
{
- //TODO: Ability to import ratios from text file.
- string filter = string("Tuning files (*") + CTuning::s_FileExtension + string(", *") + CTuningCollection::s_FileExtension + string(")|*") +
- CTuning::s_FileExtension + string(";*") + CTuningCollection::s_FileExtension + string("|");
+ CString sFilter;
+ sFilter.Format(TEXT("Tuning files (*%s, *%s, *.scl)|*%s;*%s;*.scl|"),
+ CTuning::s_FileExtension,
+ CTuningCollection::s_FileExtension,
+ CTuning::s_FileExtension,
+ CTuningCollection::s_FileExtension);
- FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
- filter,
- theApp.GetTuningsPath());
- if(files.abort) return;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, TEXT(""), TEXT(""),
+ (LPCTSTR)sFilter,
+ CMainFrame::GetWorkingDirectory(DIR_TUNING),
+ true);
+ if(files.abort)
+ return;
- const string ext = string(".") + files.extension;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_TUNING, true);
- bool failure = true;
+ CString sLoadReport;
- if(ext == CTuning::s_FileExtension)
+ const size_t nFiles = files.filenames.size();
+ for(size_t counter = 0; counter < nFiles; counter++)
{
- ifstream fin(files.first_file.c_str(), ios::binary);
- CTuning* pT = CTuningRTI::DeserializeOLD(fin);
- if(pT == 0) {fin.clear(); fin.seekg(0); pT = CTuningRTI::Deserialize(fin);}
- fin.close();
- if(pT)
+ TCHAR szFileName[_MAX_FNAME], szExt[_MAX_EXT];
+ _tsplitpath(files.filenames[counter].c_str(), nullptr, nullptr, szFileName, szExt);
+
+ _tcslwr(szExt); // Convert extension to lower case.
+
+ const bool bIsTun = (_tcscmp(szExt, CTuning::s_FileExtension) == 0);
+ const bool bIsScl = (_tcscmp(szExt, TEXT(".scl")) == 0);
+
+ if (bIsTun || bIsScl)
{
- failure = false;
- m_TempTunings.AddTuning(pT);
- m_pActiveTuning = pT;
+ CTuning* pT = nullptr;
- AddTreeItem(m_pActiveTuning, m_TreeItemTuningItemMap.GetMapping_21(TUNINGTREEITEM(&m_TempTunings)), NULL);
- UpdateView();
+ if (bIsTun)
+ {
+ std::ifstream fin(files.filenames[counter].c_str(), ios::binary);
+ pT = CTuningRTI::DeserializeOLD(fin);
+ if(pT == 0)
+ {fin.clear(); fin.seekg(0); pT = CTuningRTI::Deserialize(fin);}
+ fin.close();
+ if (pT)
+ {
+ if (m_TempTunings.AddTuning(pT) == true)
+ {
+ delete pT; pT = nullptr;
+ if (m_TempTunings.GetNumTunings() >= CTuningCollection::s_nMaxTuningCount)
+ {
+ CString sFormat, sMsg;
+ sFormat.LoadString(IDS_TUNING_IMPORT_LIMIT);
+ sMsg.FormatMessage(sFormat, szFileName, szExt, CTuningCollection::s_nMaxTuningCount);
+ sLoadReport += sMsg;
+ }
+ else // Case: Can't add tuning to tuning collection for unknown reason.
+ {
+ CString sMsg;
+ AfxFormatString2(sMsg, IDS_TUNING_IMPORT_UNKNOWN_FAILURE, szFileName, szExt);
+ sLoadReport += sMsg;
+ }
+ }
+ }
+ else // pT == nullptr
+ {
+ CString sMsg;
+ AfxFormatString2(sMsg, IDS_TUNING_IMPORT_UNRECOGNIZED_FILE, szFileName, szExt);
+ sLoadReport += sMsg;
+ }
+ }
+ else // scl import.
+ {
+ EnSclImport a = ImportScl(files.filenames[counter].c_str(), szFileName);
+ if (a != enSclImportOk)
+ {
+ if (a == enSclImportAddTuningFailure && m_TempTunings.GetNumTunings() >= CTuningCollection::s_nMaxTuningCount)
+ {
+ CString sFormat, sMsg;
+ sFormat.LoadString(IDS_TUNING_IMPORT_LIMIT);
+ sMsg.FormatMessage(sFormat, szFileName, szExt, CTuningCollection::s_nMaxTuningCount);
+ sLoadReport += sMsg;
+ }
+ else
+ {
+ CString sFormat, sMsg;
+ sFormat.LoadString(IDS_TUNING_IMPORT_SCL_FAILURE);
+ sMsg.FormatMessage(sFormat, szFileName, szExt, (LPCTSTR)GetSclImportFailureMsg(a));
+ sLoadReport += sMsg;
+ }
+ }
+ else // scl import successful.
+ pT = &m_TempTunings.GetTuning(m_TempTunings.GetNumTunings() - 1);
+ }
+
+ if (pT)
+ {
+ m_pActiveTuning = pT;
+ AddTreeItem(m_pActiveTuning, m_TreeItemTuningItemMap.GetMapping_21(TUNINGTREEITEM(&m_TempTunings)), NULL);
+ }
}
- }
- else
- {
- if(ext == CTuningCollection::s_FileExtension)
+ else if (_tcscmp(szExt, CTuningCollection::s_FileExtension) == 0)
{
- //For now only loading tuning collection as
- //a separate collection - no possibility to
- //directly replace some collection.
+ // For now only loading tuning collection as
+ // a separate collection - no possibility to
+ // directly replace some collection.
CTuningCollection* pNewTCol = new CTuningCollection;
- pNewTCol->SetSavefilePath(static_cast<LPCTSTR>(files.first_file.c_str()));
- failure = pNewTCol->Deserialize();
- if(failure)
+ pNewTCol->SetSavefilePath(files.filenames[counter].c_str());
+ if (pNewTCol->Deserialize())
{
delete pNewTCol; pNewTCol = 0;
+ CString sMsg;
+ AfxFormatString2(sMsg, IDS_TUNING_IMPORT_UNKNOWN_TC_FAILURE, szFileName, szExt);
+ sLoadReport += sMsg;
}
else
{
m_TuningCollections.push_back(pNewTCol);
m_DeletableTuningCollections.push_back(pNewTCol);
AddTreeItem(pNewTCol, NULL, NULL);
- UpdateView();
}
-
-
}
+ else // Case: Unknown extension (should not happen).
+ {
+ CString sMsg;
+ AfxFormatString2(sMsg, IDS_TUNING_IMPORT_UNRECOGNIZED_FILE_EXT, szFileName, szExt);
+ sLoadReport += sMsg;
+ }
}
- if(failure)
- ErrorBox(IDS_OPERATION_FAIL, this);
+ if (sLoadReport.GetLength() > 0)
+ AfxMessageBox(sLoadReport, MB_ICONINFORMATION);
+ UpdateView();
}
+
void CTuningDialog::OnEnChangeEditFinetunesteps()
//-----------------------------------------------
{
@@ -1325,3 +1400,187 @@
}
+////////////////////////////////////////////////////////
+//
+// scl import
+//
+////////////////////////////////////////////////////////
+
+typedef double SclFloat;
+
+CString CTuningDialog::GetSclImportFailureMsg(EnSclImport id)
+//----------------------------------------------------------
+{
+ CString sMsg;
+ switch(id)
+ {
+ case enSclImportFailTooManyNotes:
+ AfxFormatString1(sMsg, IDS_SCL_IMPORT_FAIL_8, Stringify(s_nSclImportMaxNoteCount).c_str());
+ return sMsg;
+
+ case enSclImportFailTooLargeNumDenomIntegers:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_1); return sMsg;
+
+ case enSclImportFailZeroDenominator:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_2); return sMsg;
+
+ case enSclImportFailNegativeRatio:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_3); return sMsg;
+
+ case enSclImportFailUnableToOpenFile:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_4); return sMsg;
+
+ case enSclImportLineCountMismatch:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_5); return sMsg;
+
+ case enSclImportTuningCreationFailure:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_6); return sMsg;
+
+ case enSclImportAddTuningFailure:
+ sMsg.LoadString(IDS_SCL_IMPORT_FAIL_7); return sMsg;
+
+ default:
+ return sMsg;
+ }
+}
+
+
+static void SkipCommentLines(std::istream& iStrm, std::string& str)
+//-----------------------------------------------------------------
+{
+ while(std::getline(iStrm, str))
+ {
+ LPCSTR psz = str.c_str();
+ for(; *psz != 0; psz++)
+ {
+ if (*psz == ' ' || *psz == '\t')
+ continue;
+ else
+ {
+ if (*psz != '!')
+ return;
+ else // Found comment line: break for loop and get another line.
+ break;
+ }
+ }
+ }
+}
+
+
+static inline SclFloat CentToRatio(const SclFloat& val)
+//-----------------------------------------------------
+{
+ return pow(2.0, val / 1200.0);
+}
+
+
+CTuningDialog::EnSclImport CTuningDialog::ImportScl(LPCTSTR pszPath, LPCTSTR pszName)
+//-----------------------------------------------------------------------------------
+{
+ CFile file;
+ if (file.Open(pszPath, CFile::modeRead) == 0)
+ return enSclImportFailUnableToOpenFile;
+
+ size_t nSize = static_cast<size_t>(file.GetLength());
+
+ std::vector<char> data(nSize + 1, 0);
+ nSize = file.Read(&data[0], nSize);
+ file.Close();
+
+ std::istrstream iStrm(&data[0], nSize);
+ return ImportScl(iStrm, pszName);
+}
+
+
+CTuningDialog::EnSclImport CTuningDialog::ImportScl(std::istream& iStrm, LPCTSTR pszName)
+//---------------------------------------------------------------------------------------
+{
+ std::string str;
+ SkipCommentLines(iStrm, str);
+ // str should now contain comment line.
+ SkipCommentLines(iStrm, str);
+ // str should now contain number of notes.
+ const size_t nNotes = 1 + ConvertStrTo<size_t>(str.c_str());
+ if (nNotes > s_nSclImportMaxNoteCount)
+ return enSclImportFailTooManyNotes;
+
+ std::vector<CTuningRTI::RATIOTYPE> fRatios;
+ fRatios.reserve(nNotes);
+ fRatios.push_back(1);
+
+ char buffer[128];
+ MemsetZero(buffer);
+
+ while (iStrm.getline(buffer, sizeof(buffer)))
+ {
+ LPSTR psz = buffer;
+ LPSTR const pEnd = psz + strlen(buffer);
+
+ // Skip tabs and spaces.
+ while(psz != pEnd && (*psz == ' ' || *psz == '\t'))
+ psz++;
+
+ // Skip empty lines, comment lines and non-text.
+ if (*psz == 0 || *psz == '!' || *psz < 32)
+ continue;
+
+ char* pNonDigit = pEnd;
+
+ // Check type of first non digit. This tells whether to read cent, ratio or plain number.
+ for (pNonDigit = psz; pNonDigit != pEnd; pNonDigit++)
+ {
+ if (isdigit(*pNonDigit) == 0)
+ break;
+ }
+
+ if (*pNonDigit == '.') // Reading cents
+ {
+ SclFloat fCent = ConvertStrTo<SclFloat>(psz);
+ fRatios.push_back(static_cast<CTuningRTI::RATIOTYPE>(CentToRatio(fCent)));
+ }
+ else if (*pNonDigit == '/') // Reading ratios
+ {
+ *pNonDigit = 0; // Replace '/' with null.
+ int64 nNum = ConvertStrTo<int64>(psz);
+ psz = pNonDigit + 1;
+ int64 nDenom = ConvertStrTo<int64>(psz);
+
+ if (nNum > int32_max || nDenom > int32_max)
+ return enSclImportFailTooLargeNumDenomIntegers;
+ if (nDenom == 0)
+ return enSclImportFailZeroDenominator;
+
+ fRatios.push_back(static_cast<CTuningRTI::RATIOTYPE>((SclFloat)nNum / (SclFloat)nDenom));
+ }
+ else // Plain numbers.
+ fRatios.push_back(static_cast<CTuningRTI::RATIOTYPE>(ConvertStrTo<int32>(psz)));
+ }
+
+ if (nNotes != fRatios.size())
+ return enSclImportLineCountMismatch;
+
+ for(size_t i = 0; i < fRatios.size(); i++)
+ {
+ if (fRatios[i] < 0)
+ return enSclImportFailNegativeRatio;
+ }
+
+ CTuning* pT = new CTuningRTI;
+ if (pT->CreateGroupGeometric(fRatios, 1, pT->GetValidityRange(), 0) != false)
+ {
+ delete pT;
+ return enSclImportTuningCreationFailure;
+ }
+
+ if (m_TempTunings.AddTuning(pT) != false)
+ {
+ delete pT;
+ return enSclImportAddTuningFailure;
+ }
+
+ pT->SetName(pszName);
+
+ return enSclImportOk;
+}
+
+
Modified: trunk/OpenMPT/mptrack/TuningDialog.h
===================================================================
--- trunk/OpenMPT/mptrack/TuningDialog.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/TuningDialog.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -187,6 +187,19 @@
friend class CTuningTreeCtrl;
+ enum EnSclImport
+ {
+ enSclImportOk,
+ enSclImportFailTooLargeNumDenomIntegers,
+ enSclImportFailZeroDenominator,
+ enSclImportFailNegativeRatio,
+ enSclImportFailUnableToOpenFile,
+ enSclImportLineCountMismatch,
+ enSclImportTuningCreationFailure,
+ enSclImportAddTuningFailure,
+ enSclImportFailTooManyNotes
+ };
+
public:
typedef vector<CTuningCollection*> TUNINGVECTOR;
@@ -233,6 +246,10 @@
//Checks whether tuning collection can be deleted.
bool IsDeletable(const CTuningCollection* const pTC) const;
+
+ // Scl-file import.
+ EnSclImport ImportScl(LPCTSTR pszPath, LPCTSTR pszName);
+ EnSclImport ImportScl(std::istream& iStrm, LPCTSTR pszName);
private:
@@ -297,6 +314,8 @@
TT_TUNING
};
+ static CString GetSclImportFailureMsg(EnSclImport);
+ static const size_t s_nSclImportMaxNoteCount = 64;
//To indicate whether to apply changes made to
//those edit boxes(they are modified by certain activities
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -965,10 +965,10 @@
// path info for ITP instruments
BOOL pathOk = pSndFile->m_szInstrumentPath[nIns-1][0] != '\0';
BOOL instOk = pSndFile->instrumentModified[nIns-1] == FALSE;
- wsprintf(s, pathOk ? (instOk ? "%3d: %s" : "%3d: * %s") : "%3d: ? %s", nIns, pSndFile->Instruments[nIns]->name);
+ wsprintf(s, pathOk ? (instOk ? "%3d: %s" : "%3d: * %s") : "%3d: ? %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns));
} else
{
- wsprintf(s, "%3d: %s", nIns, pSndFile->Instruments[nIns]->name);
+ wsprintf(s, "%3d: %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns));
}
int nImage = IMAGE_INSTRUMENTS;
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -746,7 +746,7 @@
{
if (pSndFile->m_nInstruments)
{
- wsprintf(s, "%03d:%s", n, (pSndFile->Instruments[n]) ? pSndFile->Instruments[n]->name : "");
+ wsprintf(s, "%03d:%s", n, (pSndFile->Instruments[n]) ? (LPCTSTR)pSndFile->GetInstrumentName(n) : "");
} else
{
wsprintf(s, "%03d:%s", n, pSndFile->m_szNames[n]);
@@ -2876,7 +2876,7 @@
}
if (bUsed) {
CString sampleName;
- sampleName.Format("%d: %s", i, (LPCTSTR)m_pSndFile->GetSampleName(i));
+ sampleName.Format("%d: %s", i, m_pSndFile->GetSampleName(i));
nInsertPos = m_CbnSample.AddString(sampleName);
m_CbnSample.SetItemData(nInsertPos, i);
Modified: trunk/OpenMPT/mptrack/misc_util.cpp
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/misc_util.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -29,3 +29,25 @@
return pData;
}
+
+// Returns error message corresponding to error code returned by GetLastError().
+CString GetErrorMessage(DWORD nErrorCode)
+//---------------------------------------
+{
+ const size_t nBufferSize = 256;
+ CString sMsg;
+ LPTSTR pszBuf = sMsg.GetBuffer(nBufferSize);
+
+ FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ nErrorCode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ pszBuf,
+ nBufferSize,
+ NULL );
+
+ sMsg.ReleaseBuffer();
+
+ return sMsg;
+}
+
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/misc_util.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -17,23 +17,19 @@
//Convert string to number.
template<class T>
-inline T ConvertStrTo(const char* str)
-//----------------------------------
+inline T ConvertStrTo(LPCSTR psz)
+//-------------------------------
{
- //Is implemented like this because the commented code below caused link errors.
if(std::numeric_limits<T>::is_integer)
- return static_cast<T>(atoi(str));
+ return static_cast<T>(atoi(psz));
else
- return static_cast<T>(atof(str));
-
- /*
- std::istringstream i(str);
- T t;
- i >> t;
- return t;
- */
+ return static_cast<T>(atof(psz));
}
+template<> inline uint32 ConvertStrTo(LPCSTR psz) {return strtoul(psz, nullptr, 10);}
+template<> inline int64 ConvertStrTo(LPCSTR psz) {return _strtoi64(psz, nullptr, 10);}
+template<> inline uint64 ConvertStrTo(LPCSTR psz) {return _strtoui64(psz, nullptr, 10);}
+
// Sets last character to null in given char array.
// Size of the array must be known at compile time.
template <size_t size>
@@ -45,6 +41,11 @@
}
+// Memset given object to zero.
+template <class T>
+inline void MemsetZero(T& a) {memset(&a, 0, sizeof(T));}
+
+
// Limits 'val' to given range. If 'val' is less than 'lowerLimit', 'val' is set to value 'lowerLimit'.
// Similarly if 'val' is greater than 'upperLimit', 'val' is set to value 'upperLimit'.
// If 'lowerLimit' > 'upperLimit', 'val' won't be modified.
@@ -75,6 +76,7 @@
LPCCH LoadResource(LPCTSTR lpName, LPCTSTR lpType, LPCCH& pData, size_t& nSize, HGLOBAL& hglob);
+CString GetErrorMessage(DWORD nErrorCode);
namespace utilImpl
{
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2010-01-07 17:10:05 UTC (rev 456)
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Deutsch (Deutschland) resources
+// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
@@ -142,12 +142,12 @@
END
#endif // APSTUDIO_INVOKED
-#endif // Deutsch (Deutschland) resources
+#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Englisch (USA) resources
+// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
@@ -162,7 +162,7 @@
IDD_ABOUTBOX DIALOGEX 0, 0, 267, 254
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "About ModPlug Tracker"
+CAPTION "About OpenMPT"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_BITMAP1,"Static",SS_BLACKRECT | SS_NOTIFY | SS_CENTERIMAGE,5,3,256,81,WS_EX_CLIENTEDGE
@@ -1966,7 +1966,7 @@
STRINGTABLE
BEGIN
- AFX_IDS_APP_TITLE "Modplug Tracker"
+ AFX_IDS_APP_TITLE "OpenMPT"
AFX_IDS_IDLEMESSAGE "Ready"
END
@@ -2012,8 +2012,8 @@
STRINGTABLE
BEGIN
- ID_APP_ABOUT "About ModPlug Tracker\nAbout"
- ID_APP_EXIT "Exit ModPlug Tracker\nExit"
+ ID_APP_ABOUT "About OpenMPT\nAbout"
+ ID_APP_EXIT "Exit OpenMPT\nExit"
ID_HELP_INDEX "Opens Help\nHelp Topics"
ID_HELP_FINDER "List Help topics\nHelp Topics"
ID_HELP_USING "Display instructions about how to use help\nHelp"
@@ -2286,14 +2286,36 @@
IDS_CONFIRM_SEQUENCE_DELETE "Delete sequence %1?"
IDS_PATTERN_CLEANUP_UNAVAILABLE
"Removing unused patterns is not available when using multiple sequences."
+ IDS_SCL_IMPORT_FAIL_1 "Invalid numerator or denominator"
+ IDS_SCL_IMPORT_FAIL_2 "Zero denominator"
+ IDS_SCL_IMPORT_FAIL_3 "Negative ratio"
+ IDS_SCL_IMPORT_FAIL_4 "Unable to open file"
+ IDS_SCL_IMPORT_FAIL_5 "Note count error"
+ IDS_SCL_IMPORT_FAIL_6 "Unknown tuning creation error"
+ IDS_SCL_IMPORT_FAIL_7 "Can't add tuning to tuning collection"
+ IDS_SCL_IMPORT_FAIL_8 "OpenMPT supports importing scl-files with at most %1 notes"
END
-#endif // Englisch (USA) resources
+STRINGTABLE
+BEGIN
+ IDS_TUNING_IMPORT_LIMIT "-Failed to load file %1%2: maximum number(=%3!u!) of temporary tunings is already open.\n"
+ IDS_TUNING_IMPORT_UNKNOWN_FAILURE
+ "-Unable to import file ""%1%2"": unknown reason.\n"
+ IDS_TUNING_IMPORT_UNRECOGNIZED_FILE_EXT
+ "-Unable to load ""%1%2"": unrecognized file extension.\n"
+ IDS_TUNING_IMPORT_UNKNOWN_TC_FAILURE
+ "-Unable to import tuning collection ""%1%2"": unrecognized file.\n"
+ IDS_TUNING_IMPORT_SCL_FAILURE "-Unable to import ""%1%2"": %3.\n"
+ IDS_TUNING_IMPORT_UNRECOGNIZED_FILE
+ "-Unable to import file ""%1%2"": unrecognized file.\n"
+END
+
+#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Englisch (GB) resources
+// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
@@ -2662,7 +2684,7 @@
//
IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc"
-#endif // Englisch (GB) resources
+#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/resource.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -52,6 +52,20 @@
#define IDS_CANT_OPEN_FILE_FOR_WRITING 213
#define IDS_CONFIRM_SEQUENCE_DELETE 214
#define IDS_PATTERN_CLEANUP_UNAVAILABLE 215
+#define IDS_SCL_IMPORT_FAIL_1 216
+#define IDS_SCL_IMPORT_FAIL_2 217
+#define IDS_SCL_IMPORT_FAIL_3 218
+#define IDS_SCL_IMPORT_FAIL_4 219
+#define IDS_SCL_IMPORT_FAIL_5 220
+#define IDS_SCL_IMPORT_FAIL_6 221
+#define IDS_SCL_IMPORT_FAIL_7 222
+#define IDS_SCL_IMPORT_FAIL_8 223
+#define IDS_TUNING_IMPORT_LIMIT 224
+#define IDS_TUNING_IMPORT_UNKNOWN_FAILURE 225
+#define IDS_TUNING_IMPORT_UNRECOGNIZED_FILE_EXT 226
+#define IDS_TUNING_IMPORT_UNKNOWN_TC_FAILURE 227
+#define IDS_TUNING_IMPORT_SCL_FAILURE 228
+#define IDS_TUNING_IMPORT_UNRECOGNIZED_FILE 229
#define IDB_MAINBAR 300
#define IDB_IMAGELIST 301
#define IDB_PATTERNS 302
@@ -579,9 +593,7 @@
#define IDC_SPIN_SPACING 2032
#define IDC_EDIT_SPACING 2033
#define IDC_SAMPLE_NAME 2034
-#define IDC_EDIT_SEQNUM 2034
#define IDC_SAMPLE_FILENAME 2035
-#define IDC_SPIN_SEQNUM 2035
#define IDC_SAMPLE_NEW 2036
#define IDC_SAMPLE_OPEN 2037
#define IDC_SAMPLE_SAVEAS 2038
@@ -604,6 +616,8 @@
#define IDC_SAMPLE_SILENCE 2054
#define IDC_SAMPLE_INVERT 2055
#define IDC_SAMPLE_SIGN_UNSIGN 2056
+#define IDC_EDIT_SEQNUM 2057
+#define IDC_SPIN_SEQNUM 2058
#define IDC_INSTRUMENT_NEW 2060
#define IDC_INSTRUMENT_OPEN 2061
#define IDC_INSTRUMENT_SAVEAS 2062
Modified: trunk/OpenMPT/mptrack/test/test.cpp
===================================================================
--- trunk/OpenMPT/mptrack/test/test.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/mptrack/test/test.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -65,6 +65,7 @@
void TestVersion();
void TestTypes();
void TestPCnoteSerialization();
+void TestMisc();
@@ -75,6 +76,7 @@
DO_TEST(TestVersion);
DO_TEST(TestTypes);
//DO_TEST(TestPCnoteSerialization);
+ DO_TEST(TestMisc);
Log(TEXT("Tests were run\n"));
}
@@ -169,6 +171,27 @@
}
+void TestMisc()
+//-------------
+{
+ VERIFY_EQUAL(ConvertStrTo<uint32>("586"), 586);
+ VERIFY_EQUAL(ConvertStrTo<uint32>("2147483647"), int32_max);
+ VERIFY_EQUAL(ConvertStrTo<uint32>("4294967295"), uint32_max);
+
+ VERIFY_EQUAL(ConvertStrTo<int64>("-9223372036854775808"), int64_min);
+ VERIFY_EQUAL(ConvertStrTo<int64>("-159"), -159);
+ VERIFY_EQUAL(ConvertStrTo<int64>("9223372036854775807"), int64_max);
+
+ VERIFY_EQUAL(ConvertStrTo<uint64>("85059"), 85059);
+ VERIFY_EQUAL(ConvertStrTo<uint64>("9223372036854775807"), int64_max);
+ VERIFY_EQUAL(ConvertStrTo<uint64>("18446744073709551615"), uint64_max);
+
+ VERIFY_EQUAL(ConvertStrTo<float>("-87.0"), -87.0);
+ VERIFY_EQUAL(ConvertStrTo<double>("-0.5e-6"), -0.5e-6);
+ VERIFY_EQUAL(ConvertStrTo<double>("58.65403492763"), 58.65403492763);
+}
+
+
template<class T>
T Round(double a) {return static_cast<T>(floor(a + 0.5));}
Modified: trunk/OpenMPT/packageTemplate/SoundTouch/README.html
===================================================================
--- trunk/OpenMPT/packageTemplate/SoundTouch/README.html 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/packageTemplate/SoundTouch/README.html 2010-01-07 17:10:05 UTC (rev 456)
@@ -12,9 +12,9 @@
<hr>
<font color=red><h5>Note: This readme is shortened version of the original
SoundTouch readme providing documentation for the time stretching feature.<br>
-SoundTouch WWW page: http://www.surina.net/soundtouch
+SoundTouch WWW page: <a href="http://www.surina.net/soundtouch">www.surina.net/soundtouch</a>
</h5></font>
-<h1>SoundTouch audio processing library v1.4.0
+<h1>SoundTouch audio processing library v1.5.0
</h1>
<p class="normal">SoundTouch library Copyright (c) Olli
Parviainen 2002-2009 </p>
@@ -40,11 +40,11 @@
sound the default parameter set may result into a sub-optimal
result.</p>
<p>The time-stretch algorithm default
-parameter values are set by these #defines in file "TDStretch.h":</p>
+parameter values are set by the following #defines in file "TDStretch.h":</p>
<blockquote>
<pre>#define DEFAULT_SEQUENCE_MS AUTOMATIC
#define DEFAULT_SEEKWINDOW_MS AUTOMATIC
-#define DEFAULT_OVERLAP_MS 12</pre>
+#define DEFAULT_OVERLAP_MS 8</pre>
</blockquote>
<p>These parameters affect to the time-stretch
algorithm as follows:</p>
@@ -148,6 +148,37 @@
<h2>5. Change History</h2>
<h3>5.1. SoundTouch library Change History </h3>
+<p><strong>1.5.0:</strong></p>
+<ul>
+<li>Added normalization to correlation calculation and improvement automatic seek/sequence parameter calculation to improve sound quality</li>
+
+<li>Bugfixes:
+ <ul>
+ <li>Fixed negative array indexing in quick seek algorithm</li>
+ <li>FIR autoalias filter running too far in processing buffer</li>
+ <li>Check against zero sample count in rate transposing</li>
+ <li>Fix for x86-64 support: Removed pop/push instructions from the cpu detection algorithm. </li>
+ <li>Check against empty buffers in FIFOSampleBuffer</li>
+ <li>Other minor fixes & code cleanup</li>
+ </ul>
+</li>
+
+<li>Fixes in compilation scripts for non-Intel platforms</li>
+<li>Added Dynamic-Link-Library (DLL) version of SoundTouch library build,
+ provided with Delphi/Pascal wrapper for calling the dll routines</li>
+<li>Added #define PREVENT_CLICK_AT_RATE_CROSSOVER that prevents a click artifact
+ when crossing the nominal pitch from either positive to negative side or vice
+ versa</li>
+
+</ul>
+
+<p><strong>1.4.1:</strong></p>
+<ul>
+<li>Fixed a buffer overflow bug in BPM detect algorithm routines if processing
+ more than 2048 samples at one call </li>
+
+</ul>
+
<p><strong>1.4.0:</strong></p>
<ul>
<li>Improved sound quality by automatic calculation of time stretch algorithm
@@ -237,25 +268,32 @@
<p> </p>
<hr>
<h2 >6. Acknowledgements </h2>
-<p >Kudos for these people who have submitted bugfixed since
+<p >Kudos for these people who have contributed to development or submitted
+bugfixes since
SoundTouch v1.3.1: </p>
<ul>
<li>Arthur A</li>
<li>Richard Ash</li>
<li>Stanislav Brabec</li>
+ <li>Christian Budde</li>
<li>Brian Cameron</li>
+ <li>Jason Champion</li>
+ <li>Patrick Colis</li>
<li>Justin Frankel</li>
<li>Jason Garland</li>
<li>Takashi Iwai</li>
+ <li>Paulo Pizarro</li>
+ <li>RJ Ryan</li>
+ <li>John Sheehy</li>
</ul>
-<p >Moral greetings to all other contributors as well!</p>
+<p >Moral greetings to all other contributors and users also!</p>
<hr>
<h2 >7. LICENSE </h2>
<p>SoundTouch audio processing library<br>
Copyright (c) Olli Parviainen</p>
<p>This library is free software; you can
redistribute it and/or modify it under the terms of the GNU
-Lesser General Public License vesrion 2.1 as published by the Free Software
+Lesser General Public License version 2.1 as published by the Free Software
Foundation.</p>
<p>This library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -1404,13 +1404,13 @@
}
-CString CSoundFile::GetSampleName(UINT nSample) const
-//--------------------------------------------------------
+LPCTSTR CSoundFile::GetSampleName(UINT nSample) const
+//---------------------------------------------------
{
if (nSample<MAX_SAMPLES) {
return m_szNames[nSample];
} else {
- return "";
+ return gszEmpty;
}
}
@@ -2875,7 +2875,9 @@
}
// Load local tunings.
- s_pTuningsSharedLocal->SetSavefilePath(std::string(std::string(theApp.GetTuningsPath()) + "local_tunings" + CTuningCollection::s_FileExtension.c_str()));
+ CString sPath;
+ sPath.Format(TEXT("%slocal_tunings%s"), CMainFrame::GetDefaultDirectory(DIR_TUNING), CTuningCollection::s_FileExtension);
+ s_pTuningsSharedLocal->SetSavefilePath(sPath);
s_pTuningsSharedLocal->Deserialize();
// Enabling adding/removing of tunings for standard collection
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -116,7 +116,7 @@
signed char nPPS; //Pitch to Pan Separator?
unsigned char nPPC; //Pitch Centre?
- CHAR name[32];
+ CHAR name[32]; // Note: not guaranteed to be null-terminated.
CHAR filename[32];
BYTE nMixPlug; //rewbs.instroVSTi
@@ -651,7 +651,7 @@
void SetCurrentOrder(ORDERINDEX nOrder);
void GetTitle(LPSTR s) const { lstrcpyn(s,m_szNames[0],32); }
LPCSTR GetTitle() const { return m_szNames[0]; }
- CString GetSampleName(UINT nSample) const;
+ LPCTSTR GetSampleName(UINT nSample) const;
CString GetInstrumentName(UINT nInstr) const;
UINT GetMusicSpeed() const { return m_nMusicSpeed; }
UINT GetMusicTempo() const { return m_nMusicTempo; }
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -146,7 +146,7 @@
0, //No instrument envelopes
" 0123456789ABCD?FF?E???????????????", // Supported Effects
" ???????????????", // Supported Volume Column commands
- false, // Doesn't have "+++" pattern
+ true, // Has "+++" pattern
};
const CModSpecifications xm =
@@ -209,7 +209,7 @@
12, //Envelope point count
" 0123456789ABCDRFFTE???GHK?YXPLZ\\:#", // Supported Effects
" vpcdabuhlrgfe:o", // Supported Volume Column commands
- false, // Doesn't have "+++" pattern
+ true, // Has "+++" pattern
};
const CModSpecifications s3m =
Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuningCollection.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -18,7 +18,7 @@
using namespace std;
-const string CTuningCollection::s_FileExtension = ".tc";
+const TCHAR CTuningCollection::s_FileExtension[4] = TEXT(".tc");
namespace CTuningS11n
{
@@ -277,7 +277,7 @@
bool CTuningCollection::AddTuning(CTuning* const pT)
//--------------------------------------------------
{
- if((m_EditMask & EM_ADD) == 0 || m_Tunings.size() >= 255)
+ if((m_EditMask & EM_ADD) == 0 || m_Tunings.size() >= s_nMaxTuningCount)
return true;
if(pT == NULL)
@@ -292,7 +292,7 @@
bool CTuningCollection::AddTuning(istream& inStrm, const bool ignoreEditmask)
//-------------------------------------------------
{
- if(!ignoreEditmask && (m_EditMask & EM_ADD) == 0 || m_Tunings.size() >= 255)
+ if(!ignoreEditmask && (m_EditMask & EM_ADD) == 0 || m_Tunings.size() >= s_nMaxTuningCount)
return true;
if(!inStrm.good()) return true;
Modified: trunk/OpenMPT/soundlib/tuningbase.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuningbase.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/tuningbase.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -44,7 +44,7 @@
const TYPENAME CTUNINGBASE::SERIALIZATION_RETURN_TYPE CTUNINGBASE::SERIALIZATION_FAILURE = true;
TEMPLATEDEC
-const string CTUNINGBASE::s_FileExtension = ".tun";
+const TCHAR CTUNINGBASE::s_FileExtension[5] = TEXT(".tun");
TEMPLATEDEC
const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_RATIOS = 1; //1b
@@ -290,8 +290,8 @@
if(MayEdit(EM_RATIOS) &&
(MayEdit(EM_TYPE) || GetType() == TT_GROUPGEOMETRIC))
{
- if(vr.first > vr.second) return true;
- if(ratiostartpos < vr.first || vr.second < ratiostartpos || static_cast<UNOTEINDEXTYPE>(vr.second - ratiostartpos) < static_cast<UNOTEINDEXTYPE>(v.size())) return true;
+ if(vr.first > vr.second || v.size() == 0) return true;
+ if(ratiostartpos < vr.first || vr.second < ratiostartpos || static_cast<UNOTEINDEXTYPE>(vr.second - ratiostartpos) < static_cast<UNOTEINDEXTYPE>(v.size() - 1)) return true;
if(!IsStepCountRangeSufficient(GetFineStepCount(), vr)) return true;
for(size_t i = 0; i<v.size(); i++) {if(v[i] < 0) return true;}
if(ProCreateGroupGeometric(v,r, vr, ratiostartpos))
Modified: trunk/OpenMPT/soundlib/tuningbase.h
===================================================================
--- trunk/OpenMPT/soundlib/tuningbase.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/tuningbase.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -95,7 +95,7 @@
static const SERIALIZATION_RETURN_TYPE SERIALIZATION_SUCCESS;
static const SERIALIZATION_RETURN_TYPE SERIALIZATION_FAILURE;
- static const string s_FileExtension;
+ static const TCHAR s_FileExtension[5];
static const EDITMASK EM_RATIOS;
static const EDITMASK EM_NOTENAME;
Modified: trunk/OpenMPT/soundlib/tuningcollection.h
===================================================================
--- trunk/OpenMPT/soundlib/tuningcollection.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundlib/tuningcollection.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -50,7 +50,8 @@
SERIALIZATION_FAILURE = true
};
- static const string s_FileExtension;
+ static const TCHAR s_FileExtension[4];
+ static const size_t s_nMaxTuningCount = 255;
//END PUBLIC STATIC CONSTS
@@ -84,7 +85,7 @@
const string& GetName() const {return m_Name;}
- void SetSavefilePath(const string& str) {m_SavefilePath = str;}
+ void SetSavefilePath(LPCTSTR psz) {m_SavefilePath = psz;}
const string& GetSaveFilePath() const {return m_SavefilePath;}
string GetVersionString() const {return Stringify(s_SerializationVersion);}
Modified: trunk/OpenMPT/soundtouch/3dnow_win.cpp
===================================================================
--- trunk/OpenMPT/soundtouch/3dnow_win.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/3dnow_win.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -35,10 +35,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2009-01-25 16:13:39 +0200 (Sun, 25 Jan 2009) $
+// Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $
// File revision : $Revision: 4 $
//
-// $Id: 3dnow_win.cpp 51 2009-01-25 14:13:39Z oparviai $
+// $Id: 3dnow_win.cpp 63 2009-02-21 16:00:14Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@@ -82,17 +82,13 @@
//////////////////////////////////////////////////////////////////////////////
#include "TDStretch.h"
-//#include <limits.h>
-// these are declared in 'TDStretch.cpp'
-// extern int scanOffsets[4][24];
-
// Calculates cross correlation of two buffers
double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) const
{
- uint overlapLengthLocal = overlapLength;
- float corr;
+ int overlapLengthLocal = overlapLength;
+ float corr = 0;
// Calculates the cross-correlation value between 'pV1' and 'pV2' vectors
/*
Modified: trunk/OpenMPT/soundtouch/BPMDetect.cpp
===================================================================
--- trunk/OpenMPT/soundtouch/BPMDetect.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/BPMDetect.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -26,10 +26,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2008-12-25 19:54:41 +0200 (Thu, 25 Dec 2008) $
+// Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $
// File revision : $Revision: 4 $
//
-// $Id: BPMDetect.cpp 43 2008-12-25 17:54:41Z oparviai $
+// $Id: BPMDetect.cpp 63 2009-02-21 16:00:14Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@@ -66,8 +66,6 @@
#define INPUT_BLOCK_SAMPLES 2048
#define DECIMATED_BLOCK_SAMPLES 256
-typedef unsigned short ushort;
-
/// decay constant for calculating RMS volume sliding average approximation
/// (time constant is about 10 sec)
const float avgdecay = 0.99986f;
@@ -77,19 +75,14 @@
-BPMDetect::BPMDetect(int numChannels, int sampleRate)
+BPMDetect::BPMDetect(int numChannels, int aSampleRate)
{
- xcorr = NULL;
+ this->sampleRate = aSampleRate;
+ this->channels = numChannels;
- buffer = new FIFOSampleBuffer();
-
decimateSum = 0;
decimateCount = 0;
- decimateBy = 0;
- this->sampleRate = sampleRate;
- this->channels = numChannels;
-
envelopeAccu = 0;
// Initialize RMS volume accumulator to RMS level of 3000 (out of 32768) that's
@@ -103,7 +96,26 @@
RMSVolumeAccu = (0.092f * 0.092f) / avgnorm;
#endif
- init(numChannels, sampleRate);
+ // choose decimation factor so that result is approx. 500 Hz
+ decimateBy = sampleRate / 500;
+ assert(decimateBy > 0);
+ assert(INPUT_BLOCK_SAMPLES < decimateBy * DECIMATED_BLOCK_SAMPLES);
+
+ // Calculate window length & starting item according to desired min & max bpms
+ windowLen = (60 * sampleRate) / (decimateBy * MIN_BPM);
+ windowStart = (60 * sampleRate) / (decimateBy * MAX_BPM);
+
+ assert(windowLen > windowStart);
+
+ // allocate new working objects
+ xcorr = new float[windowLen];
+ memset(xcorr, 0, windowLen * sizeof(float));
+
+ // allocate processing buffer
+ buffer = new FIFOSampleBuffer();
+ // we do processing in mono mode
+ buffer->setChannels(1);
+ buffer->clear();
}
@@ -115,7 +127,9 @@
}
-/// low-pass filter & decimate to about 500 Hz. return number of outputted samples.
+
+/// convert to mono, low-pass filter & decimate to about 500 Hz.
+/// return number of outputted samples.
///
/// Decimation is used to remove the unnecessary frequencies and thus to reduce
/// the amount of data needed to be processed as calculating autocorrelation
@@ -130,17 +144,25 @@
int count, outcount;
LONG_SAMPLETYPE out;
- assert(decimateBy != 0);
+ assert(channels > 0);
+ assert(decimateBy > 0);
outcount = 0;
for (count = 0; count < numsamples; count ++)
{
- decimateSum += src[count];
+ int j;
+ // convert to mono and accumulate
+ for (j = 0; j < channels; j ++)
+ {
+ decimateSum += src[j];
+ }
+ src += j;
+
decimateCount ++;
if (decimateCount >= decimateBy)
{
// Store every Nth sample only
- out = (LONG_SAMPLETYPE)(decimateSum / decimateBy);
+ out = (LONG_SAMPLETYPE)(decimateSum / (decimateBy * channels));
decimateSum = 0;
decimateCount = 0;
#ifdef INTEGER_SAMPLES
@@ -231,35 +253,35 @@
-void BPMDetect::inputSamples(SAMPLETYPE *samples, int numSamples)
+void BPMDetect::inputSamples(const SAMPLETYPE *samples, int numSamples)
{
SAMPLETYPE decimated[DECIMATED_BLOCK_SAMPLES];
- // convert from stereo to mono if necessary
- if (channels == 2)
+ // iterate so that max INPUT_BLOCK_SAMPLES processed per iteration
+ while (numSamples > 0)
{
- int i;
+ int block;
+ int decSamples;
- for (i = 0; i < numSamples; i ++)
- {
- samples[i] = (samples[i * 2] + samples[i * 2 + 1]) / 2;
- }
- }
-
- // decimate
- numSamples = decimate(decimated, samples, numSamples);
+ block = (numSamples > INPUT_BLOCK_SAMPLES) ? INPUT_BLOCK_SAMPLES : numSamples;
- // envelope new samples and add them to buffer
- calcEnvelope(decimated, numSamples);
- buffer->putSamples(decimated, numSamples);
+ // decimate. note that converts to mono at the same time
+ decSamples = decimate(decimated, samples, block);
+ samples += block * channels;
+ numSamples -= block;
+ // envelope new samples and add them to buffer
+ calcEnvelope(decimated, decSamples);
+ buffer->putSamples(decimated, decSamples);
+ }
+
// when the buffer has enought samples for processing...
if ((int)buffer->numSamples() > windowLen)
{
int processLength;
// how many samples are processed
- processLength = buffer->numSamples() - windowLen;
+ processLength = (int)buffer->numSamples() - windowLen;
// ... calculate autocorrelations for oldest samples...
updateXCorr(processLength);
@@ -269,32 +291,7 @@
}
-void BPMDetect::init(int numChannels, int sampleRate)
-{
- this->sampleRate = sampleRate;
- // choose decimation factor so that result is approx. 500 Hz
- decimateBy = sampleRate / 500;
- assert(decimateBy > 0);
- assert(INPUT_BLOCK_SAMPLES < decimateBy * DECIMATED_BLOCK_SAMPLES);
-
- // Calculate window length & starting item according to desired min & max bpms
- windowLen = (60 * sampleRate) / (decimateBy * MIN_BPM);
- windowStart = (60 * sampleRate) / (decimateBy * MAX_BPM);
-
- assert(windowLen > windowStart);
-
- // allocate new working objects
- xcorr = new float[windowLen];
- memset(xcorr, 0, windowLen * sizeof(float));
-
- // we do processing in mono mode
- buffer->setChannels(1);
- buffer->clear();
-}
-
-
-
float BPMDetect::getBpm()
{
double peakPos;
Modified: trunk/OpenMPT/soundtouch/BPMDetect.h
===================================================================
--- trunk/OpenMPT/soundtouch/BPMDetect.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/BPMDetect.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -26,10 +26,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2008-12-25 14:20:01 +0200 (Thu, 25 Dec 2008) $
+// Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $
// File revision : $Revision: 4 $
//
-// $Id: BPMDetect.h 33 2008-12-25 12:20:01Z oparviai $
+// $Id: BPMDetect.h 63 2009-02-21 16:00:14Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@@ -108,9 +108,6 @@
/// FIFO-buffer for decimated processing samples.
soundtouch::FIFOSampleBuffer *buffer;
- /// Initialize the class for processing.
- void init(int numChannels, int sampleRate);
-
/// Updates auto-correlation function for given number of decimated samples that
/// are read from the internal 'buffer' pipe (samples aren't removed from the pipe
/// though).
@@ -146,8 +143,8 @@
/// function.
///
/// Notice that data in 'samples' array can be disrupted in processing.
- void inputSamples(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer
- int numSamples ///< Number of samples in buffer
+ void inputSamples(const soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer
+ int numSamples ///< Number of samples in buffer
);
Modified: trunk/OpenMPT/soundtouch/FIFOSampleBuffer.cpp
===================================================================
--- trunk/OpenMPT/soundtouch/FIFOSampleBuffer.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/FIFOSampleBuffer.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -15,10 +15,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2008-02-10 18:26:55 +0200 (Sun, 10 Feb 2008) $
+// Last changed : $Date: 2009-02-27 19:24:42 +0200 (Fri, 27 Feb 2009) $
// File revision : $Revision: 4 $
//
-// $Id: FIFOSampleBuffer.cpp 11 2008-02-10 16:26:55Z oparviai $
+// $Id: FIFOSampleBuffer.cpp 68 2009-02-27 17:24:42Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@@ -63,6 +63,7 @@
samplesInBuffer = 0;
bufferPos = 0;
channels = (uint)numChannels;
+ ensureCapacity(32); // allocate initial capacity
}
@@ -151,8 +152,9 @@
// When using this function to output samples, also remember to 'remove' the
// outputted samples from the buffer by calling the
// 'receiveSamples(numSamples)' function
-SAMPLETYPE *FIFOSampleBuffer::ptrBegin() const
+SAMPLETYPE *FIFOSampleBuffer::ptrBegin()
{
+ assert(buffer);
return buffer + bufferPos * channels;
}
@@ -175,8 +177,12 @@
{
throw std::runtime_error("Couldn't allocate memory!\n");
}
+ // Align the buffer to begin at 16byte cache line boundary for optimal performance
temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
- memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE));
+ if (samplesInBuffer)
+ {
+ memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE));
+ }
delete[] bufferUnaligned;
buffer = temp;
bufferUnaligned = tempUnaligned;
Modified: trunk/OpenMPT/soundtouch/FIFOSampleBuffer.h
===================================================================
--- trunk/OpenMPT/soundtouch/FIFOSampleBuffer.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/FIFOSampleBuffer.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -15,10 +15,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2008-02-10 18:26:55 +0200 (Sun, 10 Feb 2008) $
+// Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $
// File revision : $Revision: 4 $
//
-// $Id: FIFOSampleBuffer.h 11 2008-02-10 16:26:55Z oparviai $
+// $Id: FIFOSampleBuffer.h 63 2009-02-21 16:00:14Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@@ -107,7 +107,7 @@
/// When using this function to output samples, also remember to 'remove' the
/// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
- virtual SAMPLETYPE *ptrBegin() const;
+ virtual SAMPLETYPE *ptrBegin();
/// Returns a pointer to the end of the used part of the sample buffer (i.e.
/// where the new samples are to be inserted). This function may be used for
Modified: trunk/OpenMPT/soundtouch/FIFOSamplePipe.h
===================================================================
--- trunk/OpenMPT/soundtouch/FIFOSamplePipe.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/FIFOSamplePipe.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -65,6 +65,10 @@
class SOUNDTOUCH_DLLEXPORT FIFOSamplePipe
{
public:
+ // virtual default destructor
+ virtual ~FIFOSamplePipe() {}
+
+
/// Returns a pointer to the beginning of the output samples.
/// This function is provided for accessing the output samples directly.
/// Please be careful for not to corrupt the book-keeping!
@@ -72,7 +76,7 @@
/// When using this function to output samples, also remember to 'remove' the
/// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
- virtual SAMPLETYPE *ptrBegin() const = 0;
+ virtual SAMPLETYPE *ptrBegin() = 0;
/// Adds 'numSamples' pcs of samples from the 'samples' memory position to
/// the sample buffer.
@@ -173,7 +177,7 @@
/// When using this function to output samples, also remember to 'remove' the
/// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
- virtual SAMPLETYPE *ptrBegin() const
+ virtual SAMPLETYPE *ptrBegin()
{
return output->ptrBegin();
}
Modified: trunk/OpenMPT/soundtouch/FIRFilter.cpp
===================================================================
--- trunk/OpenMPT/soundtouch/FIRFilter.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/FIRFilter.cpp 2010-01-07 17:10:05 UTC (rev 456)
@@ -1,12 +1,3 @@
-/***********************************************
- *
- * ------------- NOTE -------------
- *
- * This file is modified version of the original SoundTouch file.
- * Search for "OpenMPT_change" to see the modifications.
- *
-*/
-
////////////////////////////////////////////////////////////////////////////////
///
/// General FIR digital filter routines with MMX optimization.
@@ -20,7 +11,11 @@
///
////////////////////////////////////////////////////////////////////////////////
//
+// Last changed : $Date: 2009-02-25 19:13:51 +0200 (Wed, 25 Feb 2009) $
+// File revision : $Revision: 4 $
//
+// $Id: FIRFilter.cpp 67 2009-02-25 17:13:51Z oparviai $
+//
////////////////////////////////////////////////////////////////////////////////
//
// License :
@@ -186,10 +181,7 @@
assert(length == newLength);
resultDivFactor = uResultDivFactor;
- //OpenMPT_change-->
- //resultDivider = (SAMPLETYPE)::pow(2, resultDivFactor);
- resultDivider = (1 << resultDivFactor); // == 2^resultDivFactor
- //<--
+ resultDivider = (SAMPLETYPE)::pow(2.0, (int)resultDivFactor);
delete[] filterCoeffs;
filterCoeffs = new SAMPLETYPE[length];
Modified: trunk/OpenMPT/soundtouch/FIRFilter.h
===================================================================
--- trunk/OpenMPT/soundtouch/FIRFilter.h 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/FIRFilter.h 2010-01-07 17:10:05 UTC (rev 456)
@@ -11,10 +11,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2008-02-10 18:26:55 +0200 (Sun, 10 Feb 2008) $
+// Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $
// File revision : $Revision: 4 $
//
-// $Id: FIRFilter.h 11 2008-02-10 16:26:55Z oparviai $
+// $Id: FIRFilter.h 63 2009-02-21 16:00:14Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@@ -42,6 +42,7 @@
#ifndef FIRFilter_H
#define FIRFilter_H
+#include <stddef.h>
#include "STTypes.h"
namespace soundtouch
@@ -103,7 +104,7 @@
#ifdef ALLOW_MMX
- /// Class that implements MMX optimized functions exclusive for 16bit integer samples type.
+/// Class that implements MMX optimized functions exclusive for 16bit integer samples type.
class FIRFilterMMX : public FIRFilter
{
protected:
Modified: trunk/OpenMPT/soundtouch/PeakFinder.cpp
===================================================================
--- trunk/OpenMPT/soundtouch/PeakFinder.cpp 2010-01-04 20:01:28 UTC (rev 455)
+++ trunk/OpenMPT/soundtouch/PeakFinder.cpp 2010-01-07 17:10:05 UTC (r...
[truncated message content] |
|
From: <sag...@us...> - 2010-01-04 20:01:38
|
Revision: 455
http://modplug.svn.sourceforge.net/modplug/?rev=455&view=rev
Author: saga-games
Date: 2010-01-04 20:01:28 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
[Imp] Envelope Editor: Mark currently envelope node yellow for better visibility
[Fix] Envelope Editor: Not all keyboard actions marked the document as modified.
[Imp] Pattern Editor: Added sequence selection edit control
[Imp] Treeview: Don't show "switch to sequence" context menu item for current sequence
[Mod] Updated keymaps DE_Jojo.mkb and FR_mpt_laptop_(legovitch).mkb
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Ctrl_pat.h
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/View_ins.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb
trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-01-04 20:01:28 UTC (rev 455)
@@ -57,6 +57,7 @@
ON_EN_CHANGE(IDC_EDIT_SPACING, OnSpacingChanged)
ON_EN_CHANGE(IDC_EDIT_PATTERNNAME, OnPatternNameChanged)
ON_EN_CHANGE(IDC_EDIT_SEQUENCE_NAME, OnSequenceNameChanged)
+ ON_EN_CHANGE(IDC_EDIT_SEQNUM, OnSequenceNumChanged)
ON_EN_KILLFOCUS(IDC_EDIT_ORDERLIST_MARGINS, OnOrderListMarginsChanged)
ON_UPDATE_COMMAND_UI(IDC_PATTERN_RECORD,OnUpdateRecord)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
@@ -75,9 +76,11 @@
DDX_Control(pDX, IDC_EDIT_SPACING, m_EditSpacing);
DDX_Control(pDX, IDC_EDIT_ORDERLIST_MARGINS,m_EditOrderListMargins);
DDX_Control(pDX, IDC_EDIT_PATTERNNAME, m_EditPatName);
+ DDX_Control(pDX, IDC_EDIT_SEQNUM, m_EditSequence);
DDX_Control(pDX, IDC_SPIN_SPACING, m_SpinSpacing);
DDX_Control(pDX, IDC_SPIN_ORDERLIST_MARGINS,m_SpinOrderListMargins);
DDX_Control(pDX, IDC_SPIN_INSTRUMENT, m_SpinInstrument);
+ DDX_Control(pDX, IDC_SPIN_SEQNUM, m_SpinSequence);
DDX_Control(pDX, IDC_TOOLBAR1, m_ToolBar);
//}}AFX_DATA_MAP
}
@@ -143,6 +146,7 @@
m_ToolBar.AddButton(ID_OVERFLOWPASTE, TIMAGE_PATTERN_OVERFLOWPASTE, TBSTYLE_CHECK, ((CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED);
// Special edit controls -> tab switch to view
+ m_EditSequence.SetParent(this);
m_EditSpacing.SetParent(this);
m_EditPatName.SetParent(this);
m_EditPatName.SetLimitText(MAX_PATTERNNAME);
@@ -171,7 +175,11 @@
SetDlgItemInt(IDC_EDIT_SPACING, CMainFrame::gnPatternSpacing);
SetDlgItemInt(IDC_EDIT_ORDERLIST_MARGINS, m_OrderList.GetMargins());
CheckDlgButton(IDC_PATTERN_FOLLOWSONG, !(CMainFrame::m_dwPatternSetup & PATTERN_FOLLOWSONGOFF)); //rewbs.noFollow - set to unchecked
+
+ m_SpinSequence.SetRange(0, m_pSndFile->Order.GetNumSequences() - 1);
+ m_SpinSequence.SetPos(m_pSndFile->Order.GetCurrentSequenceIndex());
SetDlgItemText(IDC_EDIT_SEQUENCE_NAME, m_pSndFile->Order.m_sName);
+
m_OrderList.SetFocus();
UpdateView(HINT_MODTYPE|HINT_PATNAMES, NULL);
@@ -221,7 +229,14 @@
if (!m_pSndFile) return;
if (dwHintMask & HINT_MODSEQUENCE)
+ {
SetDlgItemText(IDC_EDIT_SEQUENCE_NAME, m_pSndFile->Order.m_sName);
+ }
+ if (dwHintMask & (HINT_MODSEQUENCE|HINT_MODTYPE))
+ {
+ m_SpinSequence.SetRange(0, m_pSndFile->Order.GetNumSequences() - 1);
+ m_SpinSequence.SetPos(m_pSndFile->Order.GetCurrentSequenceIndex());
+ }
//rewbs.instroVST
if (dwHintMask & (HINT_MIXPLUGINS|HINT_MODTYPE))
@@ -234,6 +249,8 @@
// 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);
// 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);
@@ -1221,3 +1238,18 @@
return FALSE;
}
+void CCtrlPatterns::OnSequenceNumChanged()
+//----------------------------------------
+{
+ if ((m_EditSequence.m_hWnd) && (m_EditSequence.GetWindowTextLength() > 0))
+ {
+ SEQUENCEINDEX newSeq = (SEQUENCEINDEX)GetDlgItemInt(IDC_EDIT_SEQNUM);
+
+ if (newSeq >= MAX_SEQUENCES)
+ {
+ newSeq = MAX_SEQUENCES - 1;
+ SetDlgItemInt(IDC_EDIT_SEQNUM, MAX_SEQUENCES - 1, FALSE);
+ }
+ m_OrderList.SelectSequence(newSeq);
+ }
+}
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.h 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2010-01-04 20:01:28 UTC (rev 455)
@@ -161,8 +161,8 @@
COrderList m_OrderList;
CButton m_BtnPrev, m_BtnNext;
CComboBox m_CbnInstrument;
- CPatEdit m_EditSpacing, m_EditPatName, m_EditOrderListMargins;
- CSpinButtonCtrl m_SpinInstrument, m_SpinSpacing, m_SpinOrderListMargins;
+ CPatEdit m_EditSpacing, m_EditPatName, m_EditOrderListMargins, m_EditSequence;
+ CSpinButtonCtrl m_SpinInstrument, m_SpinSpacing, m_SpinOrderListMargins, m_SpinSequence;
CModControlBar m_ToolBar;
INSTRUMENTINDEX m_nInstrument;
UINT m_nDetailLevel;
@@ -233,6 +233,7 @@
afx_msg void OnUpdateRecord(CCmdUI *pCmdUI);
afx_msg void TogglePluginEditor(); //rewbs.instroVST
afx_msg void OnToggleOverflowPaste();
+ afx_msg void OnSequenceNumChanged();
afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM);
//}}AFX_MSG
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-01-04 20:01:28 UTC (rev 455)
@@ -237,6 +237,7 @@
HBRUSH CMainFrame::brushHighLight = NULL;
HBRUSH CMainFrame::brushHighLightRed = NULL;
HBRUSH CMainFrame::brushWindow = NULL;
+HBRUSH CMainFrame::brushYellow = NULL;
HCURSOR CMainFrame::curDragging = NULL;
HCURSOR CMainFrame::curArrow = NULL;
HCURSOR CMainFrame::curNoDrop = NULL;
@@ -1755,6 +1756,8 @@
brushHighLight = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
if (brushHighLightRed) DeleteObject(brushHighLightRed);
brushHighLightRed = CreateSolidBrush(RGB(0xFF,0x00,0x00));
+ if (brushYellow) DeleteObject(brushYellow);
+ brushYellow = CreateSolidBrush(RGB(0xFF,0xFF,0x00));
if (brushWindow) DeleteObject(brushWindow);
brushWindow = CreateSolidBrush(crBkgnd);
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-01-04 20:01:28 UTC (rev 455)
@@ -432,7 +432,7 @@
// GDI
static HICON m_hIcon;
static HFONT m_hGUIFont, m_hFixedFont, m_hLargeFixedFont;
- static HBRUSH brushGray, brushBlack, brushWhite, brushHighLight, brushHighLightRed, brushWindow;
+ static HBRUSH brushGray, brushBlack, brushWhite, brushHighLight, brushHighLightRed, brushWindow, brushYellow;
// static CBrush *pbrushBlack, *pbrushWhite;
static HPEN penBlack, penDarkGray, penLightGray, penWhite, penHalfDarkGray, penSample, penEnvelope, penEnvelopeHighlight, penSeparator, penScratch, penGray00, penGray33, penGray40, penGray55, penGray80, penGray99, penGraycc, penGrayff;
static HCURSOR curDragging, curNoDrop, curArrow, curNoDrop2, curVSplit;
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-01-04 20:01:28 UTC (rev 455)
@@ -936,7 +936,7 @@
} else if (i == m_nDragItem - 1)
{
// currently selected env point
- m_dcMemMain.FrameRect(&rect, CBrush::FromHandle(CMainFrame::brushGray));
+ m_dcMemMain.FrameRect(&rect, CBrush::FromHandle(CMainFrame::brushYellow));
} else
{
m_dcMemMain.FrameRect(&rect, CBrush::FromHandle(CMainFrame::brushWhite));
@@ -1597,6 +1597,11 @@
{
SetCapture();
m_dwStatus |= INSSTATUS_DRAGGING;
+ // refrsh active node colour
+ if(GetDocument())
+ {
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
+ }
}
else
{
@@ -2253,7 +2258,7 @@
m_nDragItem = pEnv->nNodes;
else
m_nDragItem--;
- RedrawWindow();
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
@@ -2266,7 +2271,7 @@
m_nDragItem = 1;
else
m_nDragItem++;
- RedrawWindow();
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2278,7 +2283,10 @@
if(m_nDragItem == 1 || pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem - 2])
return;
pEnv->Ticks[m_nDragItem - 1]--;
- RedrawWindow();
+
+ 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
}
@@ -2290,7 +2298,10 @@
if(m_nDragItem == 1 || (m_nDragItem < pEnv->nNodes && pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem]))
return;
pEnv->Ticks[m_nDragItem - 1]++;
- RedrawWindow();
+
+ CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already
+ pModDoc->SetModified();
+ pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
@@ -2303,7 +2314,10 @@
pEnv->Values[m_nDragItem - 1] += stepsize;
else
pEnv->Values[m_nDragItem - 1] = 64;
- RedrawWindow();
+
+ CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already
+ pModDoc->SetModified();
+ pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
@@ -2316,7 +2330,10 @@
pEnv->Values[m_nDragItem - 1] -= stepsize;
else
pEnv->Values[m_nDragItem - 1] = 0;
- RedrawWindow();
+
+ CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already
+ pModDoc->SetModified();
+ pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
void CViewInstrument::EnvKbdInsertPoint()
@@ -2336,7 +2353,6 @@
UINT newPoint = EnvInsertPoint(newTick, newVal);
if(newPoint > 0) m_nDragItem = newPoint;
- RedrawWindow();
}
@@ -2358,7 +2374,7 @@
if(!EnvGetLoop())
EnvSetLoopStart(0);
EnvSetLoopStart(m_nDragItem - 1);
- RedrawWindow();
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2373,7 +2389,7 @@
EnvSetLoopStart(0);
}
EnvSetLoopEnd(m_nDragItem - 1);
- RedrawWindow();
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2385,8 +2401,7 @@
if(!EnvGetSustain())
EnvSetSustain(true);
EnvSetSustainStart(m_nDragItem - 1);
- RedrawWindow();
-
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2401,8 +2416,7 @@
EnvSetSustainStart(0);
}
EnvSetSustainEnd(m_nDragItem - 1);
- RedrawWindow();
-
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
@@ -2412,7 +2426,7 @@
INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr();
if(pEnv == nullptr || m_nDragItem == 0 || m_nDragItem > pEnv->nNodes) return;
EnvToggleReleaseNode(m_nDragItem - 1);
- RedrawWindow();
+ GetDocument()->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); // sanity checks are done in GetEnvelopePtr() already
}
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-01-04 20:01:28 UTC (rev 455)
@@ -2310,17 +2310,26 @@
case MODITEM_SEQUENCE:
{
+ bool isCurSeq = false;
CModDoc *pModDoc = GetDocumentFromItem(hItem);
CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr;
- if(pModDoc && pSndFile && (pModDoc->GetModType() == MOD_TYPE_MPT) && pSndFile->Order.GetSequence((SEQUENCEINDEX)modItemID).GetLength() == 0)
+ if(pModDoc && pSndFile && (pModDoc->GetModType() == MOD_TYPE_MPT))
{
- nDefault = ID_MODTREE_SWITCHTO;
+ if(pSndFile->Order.GetSequence((SEQUENCEINDEX)modItemID).GetLength() == 0)
+ {
+ nDefault = ID_MODTREE_SWITCHTO;
+ }
+ isCurSeq = (pSndFile->Order.GetCurrentSequenceIndex() == (SEQUENCEINDEX)modItemID);
}
+
+ if(!isCurSeq)
+ {
+ 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, ID_MODTREE_REMOVE, "&Delete Sequence");
}
- 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, ID_MODTREE_REMOVE, "&Delete Sequence");
break;
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-01-04 20:01:28 UTC (rev 455)
@@ -1402,11 +1402,6 @@
if (result) *result = 0;
}
-#define MAX_FILEOPEN_BUFSIZE 2048
-//Note: Above value might be the maximum size the buffer can be;
-//it might be worthwhile to check the CFileDialog documentation
-//if wanting the increase that.
-
VOID CSelectPluginDlg::OnAddPlugin()
//----------------------------------
{
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2010-01-04 20:01:28 UTC (rev 455)
@@ -450,7 +450,7 @@
PUSHBUTTON "<<",IDC_BUTTON2,3,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
PUSHBUTTON ">>",IDC_BUTTON1,15,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
LTEXT "Pattern Name",IDC_STATIC_PATTERNNAME,384,33,48,8,SS_CENTERIMAGE
- EDITTEXT IDC_EDIT_PATTERNNAME,439,31,108,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_PATTERNNAME,438,31,109,12,ES_AUTOHSCROLL
CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,2,4,370,18
CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",0x0,6,31,11,12
PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI,126,31,33,13,0,WS_EX_STATICEDGE
@@ -458,10 +458,12 @@
CONTROL "Loop Pattern",IDC_PATTERN_LOOP,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,252,33,57,8
EDITTEXT IDC_EDIT_ORDERLIST_MARGINS,3,65,28,12,ES_AUTOHSCROLL | ES_READONLY
CONTROL "",IDC_SPIN_ORDERLIST_MARGINS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,16,70,11,11
- EDITTEXT IDC_EDIT_SEQUENCE_NAME,439,8,108,12,ES_AUTOHSCROLL
- CTEXT "Sequence Name",IDC_STATIC_SEQUENCE_NAME,384,10,53,8,SS_CENTERIMAGE
+ EDITTEXT IDC_EDIT_SEQUENCE_NAME,450,8,97,12,ES_AUTOHSCROLL
+ LTEXT "Sequence",IDC_STATIC_SEQUENCE_NAME,384,10,36,8
GROUPBOX "",IDC_STATIC_SEQUENCE_NAME_FRAME,378,0,174,24
GROUPBOX "",IDC_STATIC,378,23,174,24
+ EDITTEXT IDC_EDIT_SEQNUM,420,8,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP
+ CONTROL "",IDC_SPIN_SEQNUM,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,438,6,11,11
END
IDD_CONTROL_SAMPLES DIALOGEX 0, 0, 544, 106
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/mptrack/resource.h 2010-01-04 20:01:28 UTC (rev 455)
@@ -579,7 +579,9 @@
#define IDC_SPIN_SPACING 2032
#define IDC_EDIT_SPACING 2033
#define IDC_SAMPLE_NAME 2034
+#define IDC_EDIT_SEQNUM 2034
#define IDC_SAMPLE_FILENAME 2035
+#define IDC_SPIN_SEQNUM 2035
#define IDC_SAMPLE_NEW 2036
#define IDC_SAMPLE_OPEN 2037
#define IDC_SAMPLE_SAVEAS 2038
Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb
===================================================================
--- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2010-01-04 20:01:28 UTC (rev 455)
@@ -26,6 +26,7 @@
0:1362:2:86:1 //Paste: Ctrl+V (KeyDown)
0:1363:3:86:1 //Mix Paste: Shift+Ctrl+V (KeyDown)
0:1793:1:86:1 //Paste Flood: Shift+V (KeyDown)
+0:1820:6:86:1 //Push Forward Paste: Ctrl+Alt+V (KeyDown)
0:1364:2:53:1 //SelectAll: Ctrl+5 (KeyDown)
0:1365:2:70:1 //Find: Ctrl+F (KeyDown)
0:1366:0:114:1 //Find Next: F3 (KeyDown)
@@ -34,6 +35,7 @@
0:1023:4:83:1 //View Samples: Alt+S (KeyDown)
0:1024:4:78:1 //View Instruments: Alt+N (KeyDown)
0:1025:1:120:1 //View Comments: Shift+F9 (KeyDown)
+0:1025:4:67:1 //View Comments: Alt+C (KeyDown)
0:1368:2:113:1 //Toggle Tree View: Ctrl+F2 (KeyDown)
0:1369:2:112:1 //View Options: Ctrl+F1 (KeyDown)
0:1781:2:114:1 //View MIDI mapping: Ctrl+F3 (KeyDown)
@@ -272,6 +274,21 @@
8:1790:2:68:1 //Remove DC Offset: Ctrl+D (KeyDown)
//----( Instrument Context [bottom] (9) )------------
+9:1825:1:9:5 //Select previous envelope point: Shift+TABULATOR (KeyDown|KeyHold)
+9:1826:0:9:5 //Select next envelope point: TABULATOR (KeyDown|KeyHold)
+9:1821:0:37:5 //Move envelope point left: NACH-LINKS (KeyDown|KeyHold)
+9:1822:0:39:5 //Move envelope point right: NACH-RECHTS (KeyDown|KeyHold)
+9:1823:0:38:5 //Move envelope point up: NACH-OBEN (KeyDown|KeyHold)
+9:1834:0:33:5 //Move envelope point up (big step): BILD-NACH-OBEN (KeyDown|KeyHold)
+9:1824:0:40:5 //Move envelope point down: NACH-UNTEN (KeyDown|KeyHold)
+9:1835:0:34:5 //Move envelope point down (big step): BILD-NACH-UNTEN (KeyDown|KeyHold)
+9:1827:0:45:5 //Insert envelope point: EINFG (KeyDown|KeyHold)
+9:1828:0:46:5 //Remove envelope point: ENTF (KeyDown|KeyHold)
+9:1829:0:36:1 //Set loop start: POS1 (KeyDown)
+9:1830:0:35:1 //Set loop end: ENDE (KeyDown)
+9:1831:2:36:1 //Set sustain loop start: Ctrl+POS1 (KeyDown)
+9:1832:2:35:1 //Set sustain loop end: Ctrl+ENDE (KeyDown)
+9:1833:2:82:1 //Toggle release node: Ctrl+R (KeyDown)
//----( Comments Context [bottom] (10) )------------
Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb
===================================================================
--- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb 2010-01-03 21:17:41 UTC (rev 454)
+++ trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb 2010-01-04 20:01:28 UTC (rev 455)
@@ -31,7 +31,6 @@
0:1023:0:118:1 //View Samples: F7 (KeyDown)
0:1024:0:119:1 //View Instruments: F8 (KeyDown)
0:1025:0:120:1 //View Comments: F9 (KeyDown)
-0:1769:1:121:1 //View Graph: Shift+F10 (KeyDown)
0:1367:6:87:1 //Toggle Main View: Ctrl+Alt+W (KeyDown)
0:1368:0:112:1 //Toggle Tree View: F1 (KeyDown)
0:1369:2:112:1 //View Options: Ctrl+F1 (KeyDown)
@@ -268,6 +267,23 @@
8:1790:6:68:1 //Remove DC Offset: Ctrl+Alt+D (KeyDown)
//----( Instrument Context [bottom] (9) )------------
+9:1825:1:9:5 //Select previous envelope point: Shift+TAB (KeyDown|KeyHold)
+9:1825:0:166:5 //Select previous envelope point: (KeyDown|KeyHold)
+9:1826:0:9:5 //Select next envelope point: TAB (KeyDown|KeyHold)
+9:1826:0:167:5 //Select next envelope point: (KeyDown|KeyHold)
+9:1821:0:37:5 //Move envelope point left: GAUCHE (KeyDown|KeyHold)
+9:1822:0:39:5 //Move envelope point right: DROITE (KeyDown|KeyHold)
+9:1823:0:38:5 //Move envelope point up: HAUT (KeyDown|KeyHold)
+9:1834:0:33:5 //Move envelope point up (big step): PG.PREC (KeyDown|KeyHold)
+9:1824:0:40:5 //Move envelope point down: BAS (KeyDown|KeyHold)
+9:1835:0:34:5 //Move envelope point down (big step): PG.SUIV (KeyDown|KeyHold)
+9:1827:0:45:5 //Insert envelope point: INS (KeyDown|KeyHold)
+9:1828:0:46:5 //Remove envelope point: SUPPR (KeyDown|KeyHold)
+9:1829:0:36:1 //Set loop start: ORIGINE (KeyDown)
+9:1830:0:35:1 //Set loop end: FIN (KeyDown)
+9:1831:2:36:1 //Set sustain loop start: Ctrl+ORIGINE (KeyDown)
+9:1832:2:35:1 //Set sustain loop end: Ctrl+FIN (KeyDown)
+9:1833:2:82:1 //Toggle release node: Ctrl+R (KeyDown)
//----( Comments Context [bottom] (10) )------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-01-03 21:17:55
|
Revision: 454
http://modplug.svn.sourceforge.net/modplug/?rev=454&view=rev
Author: saga-games
Date: 2010-01-03 21:17:41 +0000 (Sun, 03 Jan 2010)
Log Message:
-----------
[Imp] Pattern Cleanup does now also work with multiple sequences
[Ref] Minor changes to code (modedit/load_xm)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/soundlib/Load_xm.cpp
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-01-02 01:23:14 UTC (rev 453)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-01-03 21:17:41 UTC (rev 454)
@@ -133,7 +133,7 @@
void CModCleanupDlg::OnCancel()
-//-------------------------
+//-----------------------------
{
CDialog::OnCancel();
}
@@ -166,7 +166,7 @@
}
void CModCleanupDlg::OnPresetCompoCleanup()
-//----------------------------------------
+//-----------------------------------------
{
// patterns
CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_UNCHECKED);
@@ -191,6 +191,7 @@
}
BOOL CModCleanupDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+//----------------------------------------------------------------------------
{
UNREFERENCED_PARAMETER(id);
UNREFERENCED_PARAMETER(pResult);
@@ -255,7 +256,7 @@
break;
// misc
case IDC_CHK_SAMPLEPACK:
- strTipText = "Convert the module to .IT and reset song, sample and instrument variables";
+ strTipText = "Convert the module to .IT and reset song / sample / instrument variables";
break;
}
@@ -279,61 +280,40 @@
// Actual cleanup implementations
// Remove unused patterns / rearrange patterns
+// If argument bRemove is true, unused patterns are removed. Else, patterns are only rearranged.
bool CModCleanupDlg::RemoveUnusedPatterns(bool bRemove)
//-----------------------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return false;
- if(pSndFile->GetType() == MOD_TYPE_MPT && pSndFile->Order.GetNumSequences() > 1)
- { // Multiple sequences are not taken into account in the code below. For now just make
- // removing unused patterns disabled in this case.
- AfxMessageBox(IDS_PATTERN_CLEANUP_UNAVAILABLE, MB_ICONINFORMATION);
- return false;
- }
+ const SEQUENCEINDEX maxSeqIndex = pSndFile->Order.GetNumSequences();
const PATTERNINDEX maxPatIndex = pSndFile->Patterns.Size();
- const ORDERINDEX maxOrdIndex = pSndFile->Order.size();
vector<PATTERNINDEX> nPatMap(maxPatIndex, 0);
vector<ROWINDEX> nPatRows(maxPatIndex, 0);
vector<MODCOMMAND*> pPatterns(maxPatIndex, nullptr);
vector<bool> bPatUsed(maxPatIndex, false);
- bool bSubtunesDetected = false;
- // detect subtunes (separated by "---")
- for(SEQUENCEINDEX nSeq = 0; nSeq < pSndFile->Order.GetNumSequences(); nSeq++)
- {
- if(pSndFile->Order.GetSequence(nSeq).GetLengthFirstEmpty() != pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed())
- bSubtunesDetected = true;
- }
-
- // Flag to tell whether keeping sequence items which are after the first empty('---') order.
- bool bKeepSubSequences = false;
-
- if(bSubtunesDetected)
- { // There are used sequence items after first '---'; ask user whether to remove those.
- if (m_wParent->MessageBox(
- _TEXT("Do you want to remove sequence items which are after the first '---' item?"),
- _TEXT("Sequence Cleanup"), MB_YESNO) != IDYES
- )
- bKeepSubSequences = true;
- }
-
CHAR s[512];
- bool bEnd = false, bReordered = false;
+ bool bReordered = false;
UINT nPatRemoved = 0, nMinToRemove;
PATTERNINDEX nPats;
BeginWaitCursor();
PATTERNINDEX maxpat = 0;
- for (ORDERINDEX nOrd = 0; nOrd < maxOrdIndex; nOrd++)
+ for(SEQUENCEINDEX nSeq = 0; nSeq < maxSeqIndex; nSeq++)
{
- PATTERNINDEX n = pSndFile->Order[nOrd];
- if (n < maxPatIndex)
+ for (ORDERINDEX nOrd = 0; nOrd < pSndFile->Order.GetSequence(nSeq).GetLength(); nOrd++)
{
- if (n >= maxpat) maxpat = n + 1;
- if (!bEnd || bKeepSubSequences) bPatUsed[n] = true;
- } else if (n == pSndFile->Order.GetInvalidPatIndex()) bEnd = true;
+ PATTERNINDEX n = pSndFile->Order.GetSequence(nSeq)[nOrd];
+ if (n < maxPatIndex)
+ {
+ if (n >= maxpat) maxpat = n + 1;
+ bPatUsed[n] = true;
+ }
+ }
}
+
nMinToRemove = 0;
if (!bRemove)
{
@@ -371,33 +351,43 @@
BeginWaitCursor();
}
- for (UINT i = 0; i < maxPatIndex; i++) nPatMap[i] = PATTERNINDEX_INVALID;
- nPats = 0;
- ORDERINDEX imap = 0;
- for (imap = 0; imap < maxOrdIndex; imap++)
+ for(PATTERNINDEX i = 0; i < maxPatIndex; i++) nPatMap[i] = PATTERNINDEX_INVALID;
+
+ SEQUENCEINDEX oldSequence = pSndFile->Order.GetCurrentSequenceIndex(); // workaround, as GetSequence doesn't allow writing to sequences ATM
+
+ for(SEQUENCEINDEX nSeq = 0; nSeq < maxSeqIndex; nSeq++)
{
- PATTERNINDEX n = pSndFile->Order[imap];
- if (n < maxPatIndex)
+ pSndFile->Order.SetSequence(nSeq);
+ nPats = 0;
+ ORDERINDEX imap = 0;
+ for (imap = 0; imap < pSndFile->Order.GetSequence(nSeq).GetLength(); imap++)
{
- if (nPatMap[n] > maxPatIndex) nPatMap[n] = nPats++;
- pSndFile->Order[imap] = nPatMap[n];
- } else if (n == pSndFile->Order.GetInvalidPatIndex() && (bKeepSubSequences == false)) break;
- }
- // Add unused patterns at the end
- if ((!bRemove) || (!bWaste))
- {
- for (UINT iadd=0; iadd<maxPatIndex; iadd++)
+ PATTERNINDEX n = pSndFile->Order.GetSequence(nSeq)[imap];
+ if (n < maxPatIndex)
+ {
+ if (nPatMap[n] == PATTERNINDEX_INVALID) nPatMap[n] = nPats++;
+ pSndFile->Order[imap] = nPatMap[n];
+ }
+ }
+ // Add unused patterns at the end
+ if ((!bRemove) || (!bWaste))
{
- if ((pSndFile->Patterns[iadd]) && (nPatMap[iadd] >= maxPatIndex))
+ for(PATTERNINDEX iadd = 0; iadd < maxPatIndex; iadd++)
{
- nPatMap[iadd] = nPats++;
+ if((pSndFile->Patterns[iadd]) && (nPatMap[iadd] >= maxPatIndex))
+ {
+ nPatMap[iadd] = nPats++;
+ }
}
}
+ while (imap < pSndFile->Order.GetSequence(nSeq).GetLength())
+ {
+ pSndFile->Order[imap++] = pSndFile->Order.GetInvalidPatIndex();
+ }
}
- while (imap < maxOrdIndex)
- {
- pSndFile->Order[imap++] = pSndFile->Order.GetInvalidPatIndex();
- }
+
+ pSndFile->Order.SetSequence(oldSequence);
+
// Reorder patterns & Delete unused patterns
BEGIN_CRITICAL();
{
@@ -432,9 +422,9 @@
nPatRemoved++;
}
}
- for (PATTERNINDEX j = 0; j < maxPatIndex;j++)
+ for (PATTERNINDEX nPat = 0; nPat < maxPatIndex; nPat++)
{
- pSndFile->Patterns[j].SetData(pPatterns[j], nPatRows[j]);
+ pSndFile->Patterns[nPat].SetData(pPatterns[nPat], nPatRows[nPat]);
}
}
END_CRITICAL();
@@ -455,7 +445,7 @@
// Remove unused samples
bool CModCleanupDlg::RemoveUnusedSamples()
-//---------------------------------
+//----------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return false;
@@ -778,7 +768,7 @@
// Remove ununsed plugins
bool CModCleanupDlg::RemoveUnusedPlugins()
-//--------------------------------------
+//----------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return false;
@@ -846,7 +836,7 @@
m_pModDoc->ChangeModType(MOD_TYPE_IT);
pSndFile->m_nMixLevels = mixLevels_original;
pSndFile->m_nTempoMode = tempo_mode_classic;
- pSndFile->m_dwSongFlags = SONG_LINEARSLIDES | SONG_EXFILTERRANGE;
+ pSndFile->m_dwSongFlags = SONG_LINEARSLIDES;
// Global vars
pSndFile->m_nDefaultTempo = 125;
@@ -919,7 +909,7 @@
// Remove all samples
bool CModCleanupDlg::RemoveAllSamples()
-//------------------------------------
+//-------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return false;
@@ -985,7 +975,7 @@
// Remove all plugins
bool CModCleanupDlg::MergeSequences()
-//-------------------------------------
+//-----------------------------------
{
return m_pModDoc->MergeSequences();
}
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2010-01-02 01:23:14 UTC (rev 453)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-01-03 21:17:41 UTC (rev 454)
@@ -433,7 +433,7 @@
// Change the number of channels
BOOL CModDoc::ChangeNumChannels(UINT nNewChannels, const bool showCancelInRemoveDlg)
-//------------------------------------------------
+//----------------------------------------------------------------------------------
{
const CHANNELINDEX maxChans = m_SndFile.GetModSpecifications().channelsMax;
@@ -507,7 +507,7 @@
BOOL CModDoc::RemoveChannels(BOOL m_bChnMask[MAX_CHANNELS])
-//--------------------------------------------------------
+//---------------------------------------------------------
//To remove all channels whose index corresponds to true value at m_bChnMask[] array. Code is almost non-modified copy of
//the code which was in CModDoc::ChangeNumChannels(UINT nNewChannels) - the only differences are the lines before
//BeginWaitCursor(), few lines in the end and that nNewChannels is renamed to nRemaningChannels.
@@ -740,7 +740,7 @@
INSTRUMENTINDEX CModDoc::InsertInstrument(LONG lSample, LONG lDuplicate)
-//-----------------------------------------------------------
+//----------------------------------------------------------------------
{
MODINSTRUMENT *pDup = NULL;
INSTRUMENTINDEX nInstrumentMax = m_SndFile.GetModSpecifications().instrumentsMax - 1;
@@ -845,7 +845,7 @@
void CModDoc::InitializeInstrument(MODINSTRUMENT *pIns, UINT nsample)
-//----------------------------------------------------------------------
+//-------------------------------------------------------------------
{
memset(pIns, 0, sizeof(MODINSTRUMENT));
pIns->nFadeOut = 256;
@@ -976,7 +976,7 @@
BOOL CModDoc::ExpandPattern(PATTERNINDEX nPattern)
-//----------------------------------------
+//------------------------------------------------
{
// -> CODE#0008
// -> DESC="#define to set pattern size"
@@ -990,7 +990,7 @@
BOOL CModDoc::ShrinkPattern(PATTERNINDEX nPattern)
-//----------------------------------------
+//------------------------------------------------
{
if ((nPattern >= m_SndFile.Patterns.Size()) || (!m_SndFile.Patterns[nPattern])) return FALSE;
if(m_SndFile.Patterns[nPattern].Shrink())
@@ -1605,7 +1605,7 @@
void CModDoc::CheckUnusedChannels(BOOL mask[MAX_CHANNELS], CHANNELINDEX maxRemoveCount)
-//--------------------------------------------------------
+//-------------------------------------------------------------------------------------
{
// Checking for unused channels
for (int iRst=m_SndFile.m_nChannels-1; iRst>=0; iRst--) //rewbs.removeChanWindowCleanup
@@ -1632,7 +1632,7 @@
}
}
-// Merge multiple sequences
+// Merge multiple sequences into one sequence
bool CModDoc::MergeSequences()
//----------------------------
{
Modified: trunk/OpenMPT/soundlib/Load_xm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_xm.cpp 2010-01-02 01:23:14 UTC (rev 453)
+++ trunk/OpenMPT/soundlib/Load_xm.cpp 2010-01-03 21:17:41 UTC (rev 454)
@@ -733,7 +733,7 @@
BYTE xmph[9];
FILE *f;
int i;
- BOOL bAddChannel = false; // avoid odd channel count for FT2 compatibility
+ bool bAddChannel = false; // avoid odd channel count for FT2 compatibility
if(bCompatibilityExport) nPacking = false;
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: <rel...@us...> - 2009-12-30 21:54:27
|
Revision: 452
http://modplug.svn.sourceforge.net/modplug/?rev=452&view=rev
Author: relabsoluness
Date: 2009-12-30 21:54:16 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Imp] Pattern editor: If keyboard split is active, instrument drop list will show split instrument and split note.
[Mod] Pattern c&p: Mix paste shouldn't anymore trigger conversion on modcommands that weren't changed at all (appeared in rev. 403). Now, however, partial conversion will not be done so this still needs further fixing.
[Fix] Pattern c&p: Mix paste should behave better with parameter control notes.
[Ref/Fix] Minor tweaks and fixes (fixes to use of CStrings in wsprintf parameters, cleaned compiler warnings, small adjustment to orderlist resizing after loading module...)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Mod2wave.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/fxp.cpp
trunk/OpenMPT/mptrack/misc_util.cpp
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/mptrack/typedefs.h
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/modcommand.h
Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -175,11 +175,11 @@
if(m_pVstPlugin->GetNumPrograms() > 0 && m_pMenu->GetMenuItemCount() < 5)
{
- m_pMenu->AppendMenu(MF_BYPOSITION, ID_VSTPRESETBACKWARDJUMP, (LPCTSTR)"<<");
- m_pMenu->AppendMenu(MF_BYPOSITION, ID_PREVIOUSVSTPRESET, (LPCTSTR)"<");
- m_pMenu->AppendMenu(MF_BYPOSITION, ID_NEXTVSTPRESET, (LPCTSTR)">");
- m_pMenu->AppendMenu(MF_BYPOSITION, ID_VSTPRESETFORWARDJUMP, (LPCTSTR)">>");
- m_pMenu->AppendMenu(MF_BYPOSITION|MF_DISABLED, 0, "");
+ m_pMenu->AppendMenu(MF_BYPOSITION, ID_VSTPRESETBACKWARDJUMP, TEXT("<<"));
+ m_pMenu->AppendMenu(MF_BYPOSITION, ID_PREVIOUSVSTPRESET, TEXT("<"));
+ m_pMenu->AppendMenu(MF_BYPOSITION, ID_NEXTVSTPRESET, TEXT(">"));
+ m_pMenu->AppendMenu(MF_BYPOSITION, ID_VSTPRESETFORWARDJUMP, TEXT(">>"));
+ m_pMenu->AppendMenu(MF_BYPOSITION|MF_DISABLED, 0, TEXT(""));
}
long index = m_pVstPlugin->GetCurrentProgram();
@@ -470,7 +470,7 @@
m_pInputMenu->AppendMenu(MF_SEPARATOR);
}
name.Format("Ins%02d: %s", inputInstruments[nIns], pSndFile->Instruments[inputInstruments[nIns]]->name);
- if (inputInstruments[nIns]==m_nInstrument) checked=true;
+ if (inputInstruments[nIns] == (UINT)m_nInstrument) checked=true;
m_pInputMenu->AppendMenu(MF_STRING|(checked?MF_CHECKED:0), ID_SELECTINST+inputInstruments[nIns], name);
}
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -254,29 +254,47 @@
LockControls();
if (dwHintMask & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES))
{
+ static const TCHAR szSplitFormat[] = TEXT("%02u %s %02u: %s/%s");
UINT nPos = 0;
m_CbnInstrument.SetRedraw(FALSE);
m_CbnInstrument.ResetContent();
m_CbnInstrument.SetItemData(m_CbnInstrument.AddString(" No Instrument"), 0);
- if (m_pSndFile->m_nInstruments) {
- for (UINT i=1; i<=m_pSndFile->m_nInstruments; i++) {
+ const INSTRUMENTINDEX nSplitIns = m_pModDoc->GetSplitKeyboardSettings()->splitInstrument;
+ const MODCOMMAND::NOTE noteSplit = 1 + m_pModDoc->GetSplitKeyboardSettings()->splitNote;
+ const CString sSplitInsName = m_pModDoc->GetPatternViewInstrumentName(nSplitIns, true, false);
+ if (m_pSndFile->m_nInstruments)
+ {
+ for (UINT i=1; i<=m_pSndFile->m_nInstruments; i++)
+ {
if (m_pSndFile->Instruments[i] == NULL) {
continue;
}
- CString displayName = m_pSndFile->GetPatternViewInstrumentName(i);
- UINT n = m_CbnInstrument.AddString(displayName);
+ CString sDisplayName;
+ if (m_pModDoc->GetSplitKeyboardSettings()->IsSplitActive())
+ {
+ wsprintf(s, szSplitFormat, nSplitIns, GetNoteStr(noteSplit), i,
+ (LPCTSTR)sSplitInsName, (LPCTSTR)m_pModDoc->GetPatternViewInstrumentName(i, true, false));
+ sDisplayName = s;
+ }
+ else
+ sDisplayName = m_pModDoc->GetPatternViewInstrumentName(i);
+
+ UINT n = m_CbnInstrument.AddString(sDisplayName);
if (n == m_nInstrument) nPos = n;
m_CbnInstrument.SetItemData(n, i);
-
}
-
} else
{
UINT nmax = m_pSndFile->m_nSamples;
while ((nmax > 1) && (m_pSndFile->Samples[nmax].pSample == NULL) && (!m_pSndFile->m_szNames[nmax][0])) nmax--;
- for (UINT i=1; i<=nmax; i++) if ((m_pSndFile->m_szNames[i][0]) || (m_pSndFile->Samples[i].pSample)) {
- wsprintf(s, "%02d: %s", i, m_pSndFile->m_szNames[i]);
+ for (UINT i=1; i<=nmax; i++) if ((m_pSndFile->m_szNames[i][0]) || (m_pSndFile->Samples[i].pSample))
+ {
+ if (m_pModDoc->GetSplitKeyboardSettings()->IsSplitActive() && nSplitIns < ARRAYELEMCOUNT(m_pSndFile->m_szNames))
+ wsprintf(s, szSplitFormat, nSplitIns, GetNoteStr(noteSplit), i, m_pSndFile->m_szNames[nSplitIns], m_pSndFile->m_szNames[i]);
+ else
+ wsprintf(s, "%02u: %s", i, m_pSndFile->m_szNames[i]);
+
UINT n = m_CbnInstrument.AddString(s);
if (n == m_nInstrument) nPos = n;
m_CbnInstrument.SetItemData(n, i);
@@ -482,7 +500,7 @@
if (m_CbnInstrument.GetItemData(i) == nIns)
{
m_CbnInstrument.SetCurSel(i);
- m_nInstrument = nIns;
+ m_nInstrument = static_cast<INSTRUMENTINDEX>(nIns);
//rewbs.instroVST
if (HasValidPlug(m_nInstrument))
::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), true);
@@ -678,7 +696,7 @@
int nmax = (m_pSndFile->m_nInstruments) ? m_pSndFile->m_nInstruments : m_pSndFile->m_nSamples;
if ((n >= 0) && (n <= nmax) && (n != (int)m_nInstrument))
{
- m_nInstrument = n;
+ m_nInstrument = static_cast<INSTRUMENTINDEX>(n);
if (m_pParent) m_pParent->InstrumentChanged(m_nInstrument);
}
SwitchToView();
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -674,12 +674,13 @@
s[0] = 0;
if(CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY)
{
- wsprintf(s, "Position %02Xh of %02Xh", m_nScrollPos, pSndFile->GetNumPatterns());
+ wsprintf(s, "Position %02Xh of %02Xh", m_nScrollPos, pSndFile->Order.GetLengthFirstEmpty());
}
else
{
+ const ORDERINDEX nLength = pSndFile->Order.GetLengthFirstEmpty();
wsprintf(s, "Position %d of %d (%02Xh of %02Xh)",
- m_nScrollPos, pSndFile->GetNumPatterns(), m_nScrollPos, pSndFile->GetNumPatterns());
+ m_nScrollPos, nLength, m_nScrollPos, nLength);
}
if (m_nScrollPos < pSndFile->Order.GetLength())
Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mod2wave.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -667,7 +667,7 @@
ULONGLONG l = ((ULONGLONG)m_pSndFile->GetSongTime()) * m_pWaveFormat->nSamplesPerSec;
if (m_nMaxPatterns > 0)
{
- DWORD dwOrds = m_pSndFile->GetNumPatterns();
+ DWORD dwOrds = m_pSndFile->Order.GetLengthFirstEmpty();
if ((m_nMaxPatterns < dwOrds) && (dwOrds > 0)) l = (l*m_nMaxPatterns) / dwOrds;
}
if (l < max) max = l;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -22,12 +22,12 @@
static char THIS_FILE[] = __FILE__;
#endif
-const std::string FileFilterMOD = _T("ProTracker Modules (*.mod)|*.mod||");
-const std::string FileFilterXM = _T("FastTracker Modules (*.xm)|*.xm||");
-const std::string FileFilterS3M = _T("ScreamTracker Modules (*.s3m)|*.s3m||");
-const std::string FileFilterIT = _T("Impulse Tracker Modules (*.it)|*.it||");
-const std::string FileFilterITP = _T("Impulse Tracker Projects (*.itp)|*.itp||");
-const std::string FileFilterMPT = _T("OpenMPT Modules (*.mptm)|*.mptm||");
+const TCHAR FileFilterMOD[] = _T("ProTracker Modules (*.mod)|*.mod||");
+const TCHAR FileFilterXM[] = _T("FastTracker Modules (*.xm)|*.xm||");
+const TCHAR FileFilterS3M[] = _T("ScreamTracker Modules (*.s3m)|*.s3m||");
+const TCHAR FileFilterIT[] = _T("Impulse Tracker Modules (*.it)|*.it||");
+const TCHAR FileFilterITP[] = _T("Impulse Tracker Projects (*.itp)|*.itp||");
+const TCHAR FileFilterMPT[] = _T("OpenMPT Modules (*.mptm)|*.mptm||");
/////////////////////////////////////////////////////////////////////////////
// CModDoc
@@ -366,7 +366,7 @@
if (m_SndFile.m_dwLastSavedWithVersion > MptVersion::num) {
char s[256];
wsprintf(s, "Warning: this song was last saved with a more recent version of OpenMPT.\r\nSong saved with: v%s. Current version: v%s.\r\n",
- MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion),
+ (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion),
MptVersion::str);
::AfxMessageBox(s);
}
@@ -3467,3 +3467,50 @@
pMainFrm->ResetElapsedTime();
}
+
+CString CModDoc::GetPatternViewInstrumentName(UINT nInstr,
+ bool bEmptyInsteadOfNoName /* = false*/,
+ bool bIncludeIndex /* = true*/) const
+//-----------------------------------------------------------------------------------
+{
+ if(nInstr >= MAX_INSTRUMENTS || m_SndFile.GetNumInstruments() == 0 || m_SndFile.Instruments[nInstr] == nullptr)
+ return TEXT("");
+
+ CString displayName, instrumentName, pluginName;
+
+ // Get instrument name.
+ instrumentName = m_SndFile.GetInstrumentName(nInstr);
+
+ // If instrument name is empty, use name of the sample mapped to C-5.
+ if (instrumentName.IsEmpty())
+ {
+ const SAMPLEINDEX nSmp = m_SndFile.Instruments[nInstr]->Keyboard[60];
+ if (nSmp < ARRAYELEMCOUNT(m_SndFile.Samples) && m_SndFile.Samples[nSmp].pSample)
+ instrumentName.Format(TEXT("s: %s"), (LPCTSTR)m_SndFile.GetSampleName(nSmp)); //60 is C-5
+ }
+
+ // Get plugin name.
+ const PLUGINDEX nPlug = m_SndFile.Instruments[nInstr]->nMixPlug;
+ if (nPlug > 0 && nPlug < MAX_MIXPLUGINS)
+ pluginName = m_SndFile.m_MixPlugins[nPlug-1].GetName();
+
+ if (pluginName.IsEmpty())
+ {
+ if(bEmptyInsteadOfNoName && instrumentName.IsEmpty())
+ return TEXT("");
+ if(instrumentName.IsEmpty())
+ instrumentName = TEXT("(no name)");
+ if (bIncludeIndex)
+ displayName.Format(TEXT("%02d: %s"), nInstr, (LPCTSTR)instrumentName);
+ else
+ displayName.Format(TEXT("%s"), (LPCTSTR)instrumentName);
+ } else
+ {
+ if (bIncludeIndex)
+ displayName.Format(TEXT("%02d: %s (%s)"), nInstr, (LPCTSTR)instrumentName, (LPCTSTR)pluginName);
+ else
+ displayName.Format(TEXT("%s (%s)"), (LPCTSTR)instrumentName, (LPCTSTR)pluginName);
+ }
+ return displayName;
+}
+
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-12-30 21:54:16 UTC (rev 452)
@@ -118,9 +118,15 @@
// Split Keyboard Settings (pattern editor)
#define SPLIT_OCTAVE_RANGE 9
+
+//==========================
struct SplitKeyboardSettings
+//==========================
{
- UINT splitInstrument, splitNote, splitVolume;
+ bool IsSplitActive() {return (octaveLink && (octaveModifier != 0)) || (splitInstrument > 0) || (splitVolume != 0);}
+ MODCOMMAND::NOTE splitNote;
+ MODCOMMAND::INSTR splitInstrument;
+ MODCOMMAND::VOL splitVolume;
int octaveModifier; // determines by how many octaves the notes should be transposed up or down
bool octaveLink; // apply octaveModifier
};
@@ -291,6 +297,12 @@
void OnFileWaveConvert(ORDERINDEX nMinOrder, ORDERINDEX nMaxOrder);
+ // Returns formatted MODINSTRUMENT name.
+ // [in] bEmptyInsteadOfNoName: In case of unnamed instrument string, "(no name)" is returned unless this
+ // parameter is true is case which an empty name is returned.
+ // [in] bIncludeIndex: True to include instrument index in front of the instrument name, false otherwise.
+ CString GetPatternViewInstrumentName(UINT nInstr, bool bEmptyInsteadOfNoName = false, bool bIncludeIndex = true) const;
+
// protected members
protected:
CSize m_szOldPatternScrollbarsPos;
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -1179,9 +1179,9 @@
MODTYPE origFormat = MOD_TYPE_IT;
UINT len = 0, startLen;
- bool doOverflowPaste = (CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) && (pasteMode != pm_pasteflood) && (pasteMode != pm_pushforwardpaste);
- bool doITStyleMix = (pasteMode == pm_mixpaste_it);
- bool doMixPaste = ((pasteMode == pm_mixpaste) || doITStyleMix);
+ const bool doOverflowPaste = (CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) && (pasteMode != pm_pasteflood) && (pasteMode != pm_pushforwardpaste);
+ const bool doITStyleMix = (pasteMode == pm_mixpaste_it);
+ const bool doMixPaste = ((pasteMode == pm_mixpaste) || doITStyleMix);
ORDERINDEX oCurrentOrder; //jojo.echopaste
ROWINDEX rTemp, startRow;
@@ -1234,14 +1234,23 @@
// Paste columns
while ((p[len] == '|') && (len + 11 < dwMemSize))
{
- // ITSyle mixpaste requires that we keep a copy of the thing we are about to paste on
- // so that we can refer back to check if there was anything in e.g. the note column before we pasted.
- MODCOMMAND origModCmd = m[col];
-
LPSTR s = p+len+1;
- if (col < m_SndFile.m_nChannels)
+ // Check valid paste condition. Paste will be skipped if
+ // -col is not a valid channelindex or
+ // -doing mix paste and paste destination modcommand is a PCnote or
+ // -doing mix paste and trying to paste PCnote on non-empty modcommand.
+ const bool bSkipPaste =
+ (col >= m_SndFile.GetNumChannels()) ||
+ (doMixPaste && m[col].IsPcNote()) ||
+ (doMixPaste && s[0] == 'P' && !m[col].IsEmpty());
+
+ if (bSkipPaste == false)
{
+ // ITSyle mixpaste requires that we keep a copy of the thing we are about to paste on
+ // so that we can refer back to check if there was anything in e.g. the note column before we pasted.
+ const MODCOMMAND origModCmd = m[col];
+
// push channel data below paste point first.
if(pasteMode == pm_pushforwardpaste)
{
@@ -1294,7 +1303,7 @@
{
if (s[5] != '.')
{
- if(m[col].note == NOTE_PCS || m[col].note == NOTE_PC)
+ if(m[col].IsPcNote())
{
char val[4];
memcpy(val, s+5, 3);
@@ -1317,9 +1326,9 @@
} else m[col].volcmd = m[col].vol = 0;
}
- if(m[col].note == NOTE_PCS || m[col].note == NOTE_PC)
+ if (m[col].IsPcNote())
{
- if(s[8] != '.' && s[8] > ' ')
+ if (s[8] != '.' && s[8] > ' ')
{
char val[4];
memcpy(val, s+8, 3);
@@ -1382,9 +1391,14 @@
}
}
}
+
+ // convert some commands, if necessary. With mix paste convert only
+ // if the original modcommand was empty as otherwise the unchanged parts
+ // of the old modcommand would falsely be interpreted being of type
+ // origFormat and ConvertCommand could change them.
+ if (origFormat != m_SndFile.m_nType && (doMixPaste == false || origModCmd.IsEmpty()))
+ m_SndFile.ConvertCommand(&(m[col]), origFormat, m_SndFile.m_nType);
}
- // convert some commands, if necessary.
- if(origFormat != m_SndFile.m_nType) m_SndFile.ConvertCommand(&(m[col]), origFormat, m_SndFile.m_nType);
len += 12;
col++;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -3090,7 +3090,7 @@
// Need to convert to linear in [0;64] - see below
BYTE event = GetFromMIDIMsg_Event(dwMidiData);
- if ((event == 0x9) && !nVol) event = 0x8; //Convert event to note-off if req'd
+ if ((event == MIDIEVENT_NOTEON) && !nVol) event = MIDIEVENT_NOTEOFF; //Convert event to note-off if req'd
// Handle MIDI mapping.
@@ -3116,14 +3116,14 @@
switch(event)
{
- case 0x8: // Note Off
+ case MIDIEVENT_NOTEOFF: // Note Off
// The following method takes care of:
// . Silencing specific active notes (just setting nNote to 255 as was done before is not acceptible)
// . Entering a note off in pattern if required
TempStopNote(nNote, ((CMainFrame::m_dwMidiSetup & MIDISETUP_RECORDNOTEOFF) != 0));
break;
- case 0x9: // Note On
+ case MIDIEVENT_NOTEON: // Note On
nVol = ApplyVolumeRelatedMidiSettings(dwMidiData, midivolume);
if(nVol < 0) nVol = -1;
else nVol = (nVol + 3) / 4; //Value from [0,256] to [0,64]
@@ -3135,10 +3135,10 @@
break;
- case 0xB: //Controller change
+ case MIDIEVENT_CONTROLLERCHANGE: //Controller change
switch(nByte1)
{
- case 0x7: //Volume
+ case MIDICC_Volume_Coarse: //Volume
midivolume = nByte2;
break;
}
@@ -4934,8 +4934,10 @@
HMENU instrumentChangeMenu = ::CreatePopupMenu();
AppendMenu(hMenu, MF_POPUP|greyed, (UINT)instrumentChangeMenu, "Change Instrument\t" + ih->GetKeyTextFromCommand(kcPatternSetInstrument));
- if(pSndFile == NULL)
+ if(pSndFile == nullptr || pSndFile->GetpModDoc() == nullptr)
return false;
+
+ CModDoc* const pModDoc = pSndFile->GetpModDoc();
if(!greyed)
{
@@ -4946,8 +4948,8 @@
if (pSndFile->Instruments[i] == NULL)
continue;
- CString instString = pSndFile->GetPatternViewInstrumentName(i, true);
- if(instString.GetLength() > 0) AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+i, pSndFile->GetPatternViewInstrumentName(i));
+ CString instString = pModDoc->GetPatternViewInstrumentName(i, true);
+ if(instString.GetLength() > 0) AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+i, pModDoc->GetPatternViewInstrumentName(i));
//Adding the entry to the list only if it has some name, since if the name is empty,
//it likely is some non-used instrument.
}
@@ -5213,7 +5215,8 @@
if(pSndFile == nullptr) return;
CSplitKeyboadSettings dlg(CMainFrame::GetMainFrame(), pSndFile, pModDoc->GetSplitKeyboardSettings());
- dlg.DoModal();
+ if (dlg.DoModal() == IDOK)
+ pModDoc->UpdateAllViews(NULL, HINT_INSNAMES|HINT_SMPNAMES);
}
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -1948,7 +1948,7 @@
end=NMACROS;
}
- for (UINT m=0; m<NMACROS; m++) {
+ for (int m=0; m<NMACROS; m++) {
//SFx
s.Format("SF%X", m);
m_EditMacro[m].SetWindowText(s);
@@ -1956,7 +1956,7 @@
//Macro value:
CString macroText = &m_MidiCfg.szMidiSFXExt[m*32];
m_EditMacroValue[m].SetWindowText(macroText);
- m_EditMacroValue[m].SetBackColor(m==selectedMacro?RGB(200,200,225) : RGB(245,245,245) );
+ m_EditMacroValue[m].SetBackColor(m == selectedMacro ? RGB(200,200,225) : RGB(245,245,245) );
//Macro Type:
macroType = m_pModDoc->GetMacroType(macroText);
@@ -1977,7 +1977,7 @@
default: s = "Custom";
}
m_EditMacroType[m].SetWindowText(s);
- m_EditMacroType[m].SetBackColor(m==selectedMacro?RGB(200,200,225) : RGB(245,245,245) );
+ m_EditMacroType[m].SetBackColor(m == selectedMacro ? RGB(200,200,225) : RGB(245,245,245) );
//Param details button:
if (macroType == sfx_plug)
@@ -2698,7 +2698,7 @@
BOOL CSplitKeyboadSettings::OnInitDialog()
//----------------------------------------
{
- if(!m_pSndFile) return FALSE;
+ if(!m_pSndFile || m_pSndFile->GetpModDoc() == nullptr) return FALSE;
CDialog::OnInitDialog();
@@ -2739,7 +2739,7 @@
continue;
}
- CString displayName = m_pSndFile->GetPatternViewInstrumentName(nIns);
+ CString displayName = m_pSndFile->GetpModDoc()->GetPatternViewInstrumentName(nIns);
int n = m_CbnSplitInstrument.AddString(displayName);
m_CbnSplitInstrument.SetItemData(n, nIns);
}
@@ -2876,7 +2876,7 @@
}
if (bUsed) {
CString sampleName;
- sampleName.Format("%d: %s", i, m_pSndFile->GetSampleName(i));
+ sampleName.Format("%d: %s", i, (LPCTSTR)m_pSndFile->GetSampleName(i));
nInsertPos = m_CbnSample.AddString(sampleName);
m_CbnSample.SetItemData(nInsertPos, i);
Modified: trunk/OpenMPT/mptrack/fxp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/fxp.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/fxp.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -232,7 +232,7 @@
{
::AfxMessageBox(e->m_strFileName);
char s[256];
- wsprintf(s, "%lx: %d; %d; %s;", e, e->m_cause, e->m_lOsError, e->m_strFileName);
+ wsprintf(s, "%lx: %d; %d; %s;", e, e->m_cause, e->m_lOsError, (LPCTSTR)e->m_strFileName);
::AfxMessageBox(s);
e->Delete();
}
Modified: trunk/OpenMPT/mptrack/misc_util.cpp
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/misc_util.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -3,10 +3,10 @@
/*
* Loads resource.
- * lpName and lpType: parameters passed to FindResource().
- * pData: Pointer to loaded resource data, nullptr if load not successful.
- * nSize: Size of the data in bytes, zero if load not succesfull.
- * hglob: HGLOBAL returned by LoadResource-function.
+ * [in] lpName and lpType: parameters passed to FindResource().
+ * [out] pData: Pointer to loaded resource data, nullptr if load not successful.
+ * [out] nSize: Size of the data in bytes, zero if load not succesfull.
+ * [out] hglob: HGLOBAL returned by LoadResource-function.
* Return: pData.
*/
LPCCH LoadResource(LPCTSTR lpName, LPCTSTR lpType, LPCCH& pData, size_t& nSize, HGLOBAL& hglob)
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/misc_util.h 2009-12-30 21:54:16 UTC (rev 452)
@@ -5,11 +5,6 @@
#include <string>
#include <limits>
-#define ARRAYELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
-
-//Compile time assert.
-#define STATIC_ASSERT(expr) C_ASSERT(expr)
-
//Convert object(typically number) to string
template<class T>
inline std::string Stringify(const T& x)
Modified: trunk/OpenMPT/mptrack/typedefs.h
===================================================================
--- trunk/OpenMPT/mptrack/typedefs.h 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/mptrack/typedefs.h 2009-12-30 21:54:16 UTC (rev 452)
@@ -2,7 +2,13 @@
#define TYPEDEFS_H
#define nullptr 0
+#define ARRAYELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
+//Compile time assert.
+#define STATIC_ASSERT(expr) C_ASSERT(expr)
+#define static_assert(expr, msg) C_ASSERT(expr)
+
+
typedef __int8 int8;
typedef __int16 int16;
typedef __int32 int32;
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-12-30 21:54:16 UTC (rev 452)
@@ -786,7 +786,9 @@
if (m_nType)
{
SetModSpecsPointer(m_pModSpecs, m_nType);
- Order.resize(GetModSpecifications().ordersMax);
+ const ORDERINDEX nMinLength = (std::min)(ModSequenceSet::s_nCacheSize, GetModSpecifications().ordersMax);
+ if (Order.GetLength() < nMinLength)
+ Order.resize(nMinLength);
return TRUE;
}
@@ -1056,14 +1058,6 @@
}
-ORDERINDEX CSoundFile::GetNumPatterns() const
-//-------------------------------------
-{
- ORDERINDEX i = 0;
- while ((i < Order.size()) && (Order[i] < Order.GetInvalidPatIndex())) i++;
- return i;
-}
-
/*
UINT CSoundFile::GetNumInstruments() const
//----------------------------------------
@@ -1422,12 +1416,18 @@
CString CSoundFile::GetInstrumentName(UINT nInstr) const
-//-----------------------------------------------------------
+//------------------------------------------------------
{
- if ((nInstr >= MAX_INSTRUMENTS) || (!Instruments[nInstr])) {
- return "";
- }
- return Instruments[nInstr]->name;
+ if ((nInstr >= MAX_INSTRUMENTS) || (!Instruments[nInstr]))
+ return TEXT("");
+
+ const size_t nSize = ARRAYELEMCOUNT(Instruments[nInstr]->name);
+ CString str;
+ LPTSTR p = str.GetBuffer(nSize + 1);
+ ArrayCopy(p, Instruments[nInstr]->name, nSize);
+ p[nSize] = 0;
+ str.ReleaseBuffer();
+ return str;
}
@@ -1669,42 +1669,6 @@
}
-CString CSoundFile::GetPatternViewInstrumentName(UINT nInstr, bool returnEmptyInsteadOfNoName) const
-//-----------------------------------------------------------------
-{
- //Default: returnEmptyInsteadOfNoName = false;
- if(nInstr >= MAX_INSTRUMENTS || m_nInstruments == 0 || Instruments[nInstr] == 0) return "";
-
- CString displayName, instrumentName, pluginName = "";
-
- // Use instrument name
- instrumentName.Format("%s", Instruments[nInstr]->name);
-
- if (instrumentName == "") {
- // if there's no instrument name, use name of sample associated with C-5.
- //TODO: If there's no sample mapped to that note, we could check the other notes.
- if (Instruments[nInstr]->Keyboard[60] && Samples[Instruments[nInstr]->Keyboard[60]].pSample) {
- instrumentName.Format("s: %s", m_szNames[Instruments[nInstr]->Keyboard[60]]); //60 is C-5
- }
- }
-
- //Get plugin name:
- UINT nPlug=Instruments[nInstr]->nMixPlug;
- if (nPlug>0 && nPlug<MAX_MIXPLUGINS) {
- pluginName = m_MixPlugins[nPlug-1].Info.szName;
- }
-
- if (pluginName == "") {
- if(returnEmptyInsteadOfNoName && instrumentName == "") return "";
- if(instrumentName == "") instrumentName = "(no name)";
- displayName.Format("%02d: %s", nInstr, instrumentName);
- } else {
- displayName.Format("%02d: %s (%s)", nInstr, instrumentName, pluginName);
- }
- return displayName;
-}
-
-
#ifndef NO_PACKING
UINT CSoundFile::PackSample(int &sample, int next)
//------------------------------------------------
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-12-30 21:54:16 UTC (rev 452)
@@ -653,7 +653,6 @@
LPCSTR GetTitle() const { return m_szNames[0]; }
CString GetSampleName(UINT nSample) const;
CString GetInstrumentName(UINT nInstr) const;
- CString GetPatternViewInstrumentName(UINT nInstr, bool returnEmptyInsteadOfNoName = false) const;
UINT GetMusicSpeed() const { return m_nMusicSpeed; }
UINT GetMusicTempo() const { return m_nMusicTempo; }
@@ -746,7 +745,7 @@
void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT, BOOL bCompatibilityExport = false) const;
WORD ModSaveCommand(const MODCOMMAND *m, const bool bXM, const bool bCompatibilityExport = false) const;
- static void ConvertCommand(MODCOMMAND *m, MODTYPE nOldType, MODTYPE nNewType); // Convert a complete MODCHANNEL item from one format to another
+ static void ConvertCommand(MODCOMMAND *m, MODTYPE nOldType, MODTYPE nNewType); // Convert a complete MODCOMMAND item from one format to another
static void MODExx2S3MSxx(MODCOMMAND *m); // Convert Exx to Sxx
static void S3MSxx2MODExx(MODCOMMAND *m); // Convert Sxx to Exx
Modified: trunk/OpenMPT/soundlib/modcommand.h
===================================================================
--- trunk/OpenMPT/soundlib/modcommand.h 2009-12-28 02:57:57 UTC (rev 451)
+++ trunk/OpenMPT/soundlib/modcommand.h 2009-12-30 21:54:16 UTC (rev 452)
@@ -54,8 +54,11 @@
bool IsEmpty() const {return (*this == Empty());}
// Returns true if instrument column represents plugin index.
- bool IsInstrPlug() const {return note == NOTE_PC || note == NOTE_PCS;}
+ bool IsInstrPlug() const {return IsPcNote();}
+ // Returns true if and only if note is NOTE_PC or NOTE_PCS.
+ bool IsPcNote() const {return note == NOTE_PC || note == NOTE_PCS;}
+
public:
BYTE note;
BYTE instr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-28 02:58:06
|
Revision: 451
http://modplug.svn.sourceforge.net/modplug/?rev=451&view=rev
Author: saga-games
Date: 2009-12-28 02:57:57 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Imp] VST: Further improvement to param mapping so that the midi dialog really only pops up when the VST window has the focus
[Fix] IT Compatibility: Reset NNA actions on every note (tentative fix)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2009-12-25 12:00:26 UTC (rev 450)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2009-12-28 02:57:57 UTC (rev 451)
@@ -669,7 +669,7 @@
pModDoc->RecordParamChange(pVstPlugin->GetSlot(), index);
}
- if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && pVstPlugin->GetEditor()->m_hWnd)
+ if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && (pVstPlugin->GetEditor()->m_hWnd == ::GetForegroundWindow()))
{
CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once.
CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor();
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-25 12:00:26 UTC (rev 450)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-28 02:57:57 UTC (rev 451)
@@ -777,6 +777,7 @@
pChn->nResSwing = pChn->nCutSwing = 0;
if (pIns)
{
+ if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nNNA = pIns->nNNA;
if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) pChn->nVolEnvPosition = 0;
if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) pChn->nPanEnvPosition = 0;
if (!(pIns->PitchEnv.dwFlags & ENV_CARRY)) pChn->nPitchEnvPosition = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-25 12:00:44
|
Revision: 450
http://modplug.svn.sourceforge.net/modplug/?rev=450&view=rev
Author: saga-games
Date: 2009-12-25 12:00:26 +0000 (Fri, 25 Dec 2009)
Log Message:
-----------
[Fix] FT2 compatibility: Almost perfect arpeggio emulation (only a few notes are still wrong)
[Fix] FT2 compatibility: Rogue note delays
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-23 19:56:16 UTC (rev 449)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-25 12:00:26 UTC (rev 450)
@@ -635,7 +635,7 @@
note = pIns->NoteMap[note-1];
}
// Key Off
- if (note >= 0x80)
+ if (note > NOTE_MAX)
{
// Key Off (+ Invalid Note for XM - TODO is this correct?)
if (note == NOTE_KEYOFF || !(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)))
@@ -664,7 +664,7 @@
if(bNewTuning)
{
- if(!bPorta || pChn->nNote == 0)
+ if(!bPorta || pChn->nNote == NOTE_NONE)
pChn->nPortamentoDest = 0;
else
{
@@ -1268,6 +1268,12 @@
pChn->nVolume = 0;
note = instr = 0;
}
+
+ // XM: Rogue note delays cause retrig
+ if ((note == NOTE_NONE) && IsCompatibleMode(TRK_FASTTRACKER2) && !(m_dwSongFlags & SONG_FIRSTTICK))
+ {
+ note = pChn->nNote - pChn->nTranspose;
+ }
}
if ((!note) && (instr)) //Case: instrument with no note data.
{
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2009-12-23 19:56:16 UTC (rev 449)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2009-12-25 12:00:26 UTC (rev 450)
@@ -1227,18 +1227,17 @@
}
else if(IsCompatibleMode(TRK_FASTTRACKER2)) // FastTracker 2
{
- // Using MilkyTracker's logic - still not perfect
BYTE note = pChn->nNote;
int arpPos = 0;
if (!(m_dwSongFlags & SONG_FIRSTTICK))
{
- arpPos = ((int)m_nTickCount - (int)m_nMusicSpeed) % 3;
- if(arpPos < 0) arpPos += 3;
+ arpPos = ((int)m_nMusicSpeed - (int)m_nTickCount) % 3;
+ if((m_nMusicSpeed > 18) && (m_nMusicSpeed - m_nTickCount > 16)) arpPos = 2; // swedish tracker logic, I love it
switch(arpPos)
{
- case 1: note += (pChn->nArpeggio & 0x0F); break; // x/y are swapped!
- case 2: note += (pChn->nArpeggio >> 4); break;
+ case 1: note += (pChn->nArpeggio >> 4); break;
+ case 2: note += (pChn->nArpeggio & 0x0F); break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-23 19:56:29
|
Revision: 449
http://modplug.svn.sourceforge.net/modplug/?rev=449&view=rev
Author: saga-games
Date: 2009-12-23 19:56:16 +0000 (Wed, 23 Dec 2009)
Log Message:
-----------
[Fix] XM Compatibility: Perfect emulation of buggy Rxy behaviour. Thanks to Ian Luck for helping me with this.
[Imp] Pattern Editor: When using Find&Replace, "follow song" will be disabled, because it's pointless and unusable with "follow song" on.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-23 13:43:29 UTC (rev 448)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-23 19:56:16 UTC (rev 449)
@@ -1817,6 +1817,10 @@
nFound++;
if (bUpdPos)
{
+ // turn off "follow song"
+ m_dwStatus &= ~PATSTATUS_FOLLOWSONG;
+ SendCtrlMessage(CTRLMSG_PAT_FOLLOWSONG, 0);
+ // go to place of finding
SetCurrentPattern(nPat);
SetCurrentRow(n / pSndFile->m_nChannels);
}
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-23 13:43:29 UTC (rev 448)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-23 19:56:16 UTC (rev 449)
@@ -3165,8 +3165,8 @@
if(m_dwSongFlags & SONG_FIRSTTICK)
{
// here are some really stupid things FT2 does
+ if(pChn->nRowVolCmd == VOLCMD_VOLUME) return;
if(pChn->nRowInstr > 0 && pChn->nRowNote == NOTE_NONE) nRetrigCount = 1;
- if(pChn->nRowVolCmd == VOLCMD_VOLUME) nRetrigCount = -1; // not correct yet
if(pChn->nRowNote != NOTE_NONE && pChn->nRowNote <= GetModSpecifications().noteMax) nRetrigCount++;
}
if (nRetrigCount >= nRetrigSpeed)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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...> - 2009-12-21 18:56:42
|
Revision: 447
http://modplug.svn.sourceforge.net/modplug/?rev=447&view=rev
Author: saga-games
Date: 2009-12-21 18:56:25 +0000 (Mon, 21 Dec 2009)
Log Message:
-----------
[Fix] Sequence list: Shift+End didn't work.
[Fix] Pattern editor: When pasting only partly copied channels, push forward paste failed.
[Fix] Pattern editor: Push forward paste shortcut didn't work.
[Ref] J2B Loader: Cleaned up command code translation a bit.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/load_j2b.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-20 18:17:16 UTC (rev 446)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-21 18:56:25 UTC (rev 447)
@@ -381,7 +381,7 @@
case kcOrderlistNavigateLast:
if((m_pModDoc != nullptr) && (m_pModDoc->GetSoundFile() != nullptr))
{
- SetCurSelTo2ndSel(wParam == kcOrderlistNavigateLast);
+ SetCurSelTo2ndSel(wParam == kcOrderlistNavigateLastSelect);
ORDERINDEX nLast = m_pModDoc->GetSoundFile()->Order.GetLengthTailTrimmed();
if(nLast > 0) nLast--;
SetCurSel(nLast);
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-12-20 18:17:16 UTC (rev 446)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-12-21 18:56:25 UTC (rev 447)
@@ -1178,7 +1178,6 @@
bool bS3MCommands = false, bOk = false;
MODTYPE origFormat = MOD_TYPE_IT;
UINT len = 0, startLen;
- MODCOMMAND origModCmd;
bool doOverflowPaste = (CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) && (pasteMode != pm_pasteflood) && (pasteMode != pm_pushforwardpaste);
bool doITStyleMix = (pasteMode == pm_mixpaste_it);
@@ -1235,8 +1234,10 @@
// Paste columns
while ((p[len] == '|') && (len + 11 < dwMemSize))
{
- origModCmd = m[col]; // ITSyle mixpaste requires that we keep a copy of the thing we are about to paste on
- // so that we can refer back to check if there was anything in e.g. the note column before we pasted.
+ // ITSyle mixpaste requires that we keep a copy of the thing we are about to paste on
+ // so that we can refer back to check if there was anything in e.g. the note column before we pasted.
+ MODCOMMAND origModCmd = m[col];
+
LPSTR s = p+len+1;
if (col < m_SndFile.m_nChannels)
@@ -1248,6 +1249,7 @@
{
m[col + nPushRow * m_SndFile.m_nChannels] = m[col + (nPushRow - 1) * m_SndFile.m_nChannels];
}
+ m[col].Clear();
}
// Note
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-20 18:17:16 UTC (rev 446)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-21 18:56:25 UTC (rev 447)
@@ -3607,6 +3607,7 @@
case kcEditMixPaste: OnEditMixPaste(); return wParam;
case kcEditMixPasteITStyle: OnEditMixPasteITStyle(); return wParam;
case kcEditPasteFlood: OnEditPasteFlood(); return wParam;
+ case kcEditPushForwardPaste: OnEditPushForwardPaste(); return wParam;
case kcEditSelectAll: OnEditSelectAll(); return wParam;
case kcTogglePluginEditor: TogglePluginEditor((m_dwCursor & 0xFFFF) >> 3); return wParam;
case kcToggleFollowSong: SendCtrlMessage(CTRLMSG_PAT_FOLLOWSONG); return wParam;
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2009-12-20 18:17:16 UTC (rev 446)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2009-12-21 18:56:25 UTC (rev 447)
@@ -94,6 +94,17 @@
#pragma pack()
+static BYTE riffam_efftrans[26] =
+{
+ CMD_ARPEGGIO, CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_TONEPORTAMENTO,
+ CMD_VIBRATO, CMD_TONEPORTAVOL, CMD_VIBRATOVOL, CMD_TREMOLO,
+ CMD_PANNING8, CMD_OFFSET, CMD_VOLUMESLIDE, CMD_POSITIONJUMP,
+ CMD_VOLUME, CMD_PATTERNBREAK, CMD_MODCMDEX, CMD_TEMPO,
+ CMD_GLOBALVOLUME, CMD_GLOBALVOLSLIDE, CMD_KEYOFF, CMD_SETENVPOSITION,
+ CMD_CHANNELVOLUME, CMD_CHANNELVOLSLIDE, CMD_PANNINGSLIDE, CMD_RETRIG,
+ CMD_TREMOR, CMD_XFINEPORTAUPDOWN,
+};
+
bool CSoundFile::Convert_RIFF_AM_Pattern(PATTERNINDEX nPat, const LPCBYTE lpStream, DWORD dwMemLength, bool bIsAM)
//----------------------------------------------------------------------------------------------------------------
{
@@ -139,45 +150,53 @@
m->command = lpStream[dwMemPos + 1];
m->param = lpStream[dwMemPos];
dwMemPos += 2;
- switch(m->command)
+
+ if(m->command <= 25)
{
- case 0x00: if (m->param) m->command = CMD_ARPEGGIO; break;
- case 0x01: m->command = CMD_PORTAMENTOUP; break;
- case 0x02: m->command = CMD_PORTAMENTODOWN; break;
- case 0x03: m->command = CMD_TONEPORTAMENTO; break;
- case 0x04: m->command = CMD_VIBRATO; break;
- case 0x05: m->command = CMD_TONEPORTAVOL; if (m->param & 0xF0) m->param &= 0xF0; break;
- case 0x06: m->command = CMD_VIBRATOVOL; if (m->param & 0xF0) m->param &= 0xF0; break;
- case 0x07: m->command = CMD_TREMOLO; break;
- case 0x08: m->command = CMD_PANNING8;
- if(m->param <= 0x80) m->param = min(m->param << 1, 0xFF);
- else if(m->param == 0xA4) {m->command = CMD_S3MCMDEX; m->param = 0x91;}
+ // command translation
+ m->command = riffam_efftrans[m->command];
+
+ // handling special commands
+ switch(m->command)
+ {
+ case CMD_ARPEGGIO:
+ if(m->param == 0) m->command = CMD_NONE;
+ break;
+ case CMD_TONEPORTAVOL:
+ case CMD_VIBRATOVOL:
+ case CMD_VOLUMESLIDE:
+ case CMD_GLOBALVOLSLIDE:
+ case CMD_PANNINGSLIDE:
+ if (m->param & 0xF0) m->param &= 0xF0;
+ break;
+ case CMD_PANNING8:
+ if(m->param <= 0x80) m->param = min(m->param << 1, 0xFF);
+ else if(m->param == 0xA4) {m->command = CMD_S3MCMDEX; m->param = 0x91;}
+ break;
+ case CMD_PATTERNBREAK:
+ m->param = ((m->param >> 4) * 10) + (m->param & 0x0F);
+ break;
+ case CMD_MODCMDEX:
+ MODExx2S3MSxx(m);
+ break;
+ case CMD_TEMPO:
+ if(m->param <= 0x1F) m->command = CMD_SPEED;
+ break;
+ case CMD_XFINEPORTAUPDOWN:
+ switch(m->param & 0xF0)
+ {
+ case 0x10:
+ m->command = CMD_PORTAMENTOUP;
break;
- case 0x09: m->command = CMD_OFFSET; break;
- case 0x0A: m->command = CMD_VOLUMESLIDE; if (m->param & 0xF0) m->param &= 0xF0; break;
- case 0x0B: m->command = CMD_POSITIONJUMP; break;
- case 0x0C: m->command = CMD_VOLUME; break;
- case 0x0D: m->command = CMD_PATTERNBREAK; m->param = ((m->param >> 4) * 10) + (m->param & 0x0F); break;
- case 0x0E: m->command = CMD_MODCMDEX; MODExx2S3MSxx(m); break;
- case 0x0F: m->command = (m->param <= 0x1F) ? CMD_SPEED : CMD_TEMPO; break;
- case 'G' - 55: m->command = CMD_GLOBALVOLUME; break;
- case 'H' - 55: m->command = CMD_GLOBALVOLSLIDE; if (m->param & 0xF0) m->param &= 0xF0; break;
- case 'K' - 55: m->command = CMD_KEYOFF; break;
- case 'L' - 55: m->command = CMD_SETENVPOSITION; break;
- case 'M' - 55: m->command = CMD_CHANNELVOLUME; break;
- case 'N' - 55: m->command = CMD_CHANNELVOLSLIDE; break;
- case 'P' - 55: m->command = CMD_PANNINGSLIDE; if (m->param & 0xF0) m->param &= 0xF0; break;
- case 'R' - 55: m->command = CMD_RETRIG; break;
- case 'T' - 55: m->command = CMD_TREMOR; break;
- case 'X' - 55:
- switch(m->param & 0xF0)
- {
- case 0x10: m->command = CMD_PORTAMENTOUP; m->param = (m->param & 0x0F) | 0xE0; break;
- case 0x20: m->command = CMD_PORTAMENTODOWN; m->param = (m->param & 0x0F) | 0xE0; break;
- default: m->command = CMD_S3MCMDEX; break;
- }
+ case 0x20:
+ m->command = CMD_PORTAMENTODOWN;
break;
- default:
+ }
+ m->param = (m->param & 0x0F) | 0xE0;
+ break;
+ }
+ } else
+ {
#ifdef DEBUG
{
CHAR s[64];
@@ -186,7 +205,6 @@
}
#endif
m->command = CMD_NONE;
- break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-20 18:17:26
|
Revision: 446
http://modplug.svn.sourceforge.net/modplug/?rev=446&view=rev
Author: saga-games
Date: 2009-12-20 18:17:16 +0000 (Sun, 20 Dec 2009)
Log Message:
-----------
[Fix] The S3M format actually knows muted channels. Added this to the S3M loader/saver and MuteChannel functions.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/soundlib/Load_s3m.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-20 01:10:47 UTC (rev 445)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-20 18:17:16 UTC (rev 446)
@@ -1013,7 +1013,7 @@
bool CModDoc::MuteChannel(CHANNELINDEX nChn, bool doMute)
-//----------------------------------------------
+//-------------------------------------------------------
{
DWORD muteType = (CMainFrame::m_dwPatternSetup&PATTERN_SYNCMUTE)? CHN_SYNCMUTE:CHN_MUTE;
@@ -1057,8 +1057,8 @@
}
}
- //Mark IT as modified
- if (m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) {
+ //Mark IT/MPTM/S3M as modified
+ if (m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)) {
CMainFrame::GetMainFrame()->ThreadSafeSetModified(this);
}
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-12-20 01:10:47 UTC (rev 445)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-12-20 18:17:16 UTC (rev 446)
@@ -218,7 +218,7 @@
bool CSoundFile::ReadS3M(const BYTE *lpStream, DWORD dwMemLength)
//---------------------------------------------------------------
{
- if ((!lpStream) || (dwMemLength <= sizeof(S3MFILEHEADER)+sizeof(S3MSAMPLESTRUCT)+64)) return false;
+ if ((!lpStream) || (dwMemLength <= sizeof(S3MFILEHEADER)+64)) return false;
UINT insnum,patnum,nins,npat;
DWORD insfile[128];
@@ -282,16 +282,24 @@
m_nChannels = 4;
for (UINT ich=0; ich<32; ich++)
{
- ChnSettings[ich].nPan = 128;
ChnSettings[ich].nVolume = 64;
- ChnSettings[ich].dwFlags = CHN_MUTE;
- if (psfh.channels[ich] != 0xFF)
+ if(psfh.channels[ich] == 0xFF)
{
- m_nChannels = ich+1;
- UINT b = psfh.channels[ich] & 0x0F;
- ChnSettings[ich].nPan = (b & 8) ? 0xC0 : 0x40;
- ChnSettings[ich].dwFlags = 0;
+ ChnSettings[ich].nPan = 128;
+ ChnSettings[ich].dwFlags = CHN_MUTE;
+ } else
+ {
+ m_nChannels = ich + 1;
+ ChnSettings[ich].nPan = (psfh.channels[ich] & 8) ? 0xC0 : 0x40;
+ if (psfh.channels[ich] & 0x80)
+ {
+ ChnSettings[ich].dwFlags = CHN_MUTE;
+ /* Detect Adlib channels:
+ c = channels[ich] ^ 0x80;
+ if(c >= 16 && c < 32) adlibChannel = true;
+ */
+ }
}
}
if (m_nChannels < 1) m_nChannels = 1;
@@ -572,7 +580,9 @@
if (i < m_nChannels)
{
UINT tmp = (i & 0x0F) >> 1;
- header[0x40+i] = (i & 0x10) | ((i & 1) ? 8+tmp : tmp);
+ tmp = (i & 0x10) | ((i & 1) ? 8 + tmp : tmp);
+ if((ChnSettings[i].dwFlags & CHN_MUTE) != 0) tmp |= 0x80;
+ header[0x40+i] = tmp;
} else header[0x40+i] = 0xFF;
}
fwrite(header, 0x60, 1, f);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-20 01:10:59
|
Revision: 445
http://modplug.svn.sourceforge.net/modplug/?rev=445&view=rev
Author: saga-games
Date: 2009-12-20 01:10:47 +0000 (Sun, 20 Dec 2009)
Log Message:
-----------
[Fix] Pattern Editor: Search&Replace didn't create an undo point.
[Fix] Orderlist: Sequence sub menu (in context menu) was not destroyed properly.
[Imp] Instrument Editor: When creating a new envelope, automatically enable it as well.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Undo.cpp
trunk/OpenMPT/mptrack/View_ins.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-18 21:51:37 UTC (rev 444)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-12-20 01:10:47 UTC (rev 445)
@@ -1047,6 +1047,8 @@
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/Undo.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Undo.cpp 2009-12-18 21:51:37 UTC (rev 444)
+++ trunk/OpenMPT/mptrack/Undo.cpp 2009-12-20 01:10:47 UTC (rev 445)
@@ -35,8 +35,8 @@
// - pattern: Pattern of which an undo step should be created from.
// - x: first channel
// - y: first row
-// - cx: last channel
-// - cy: last row
+// - cx: width
+// - cy: height
bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy)
//------------------------------------------------------------------------------------
{
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2009-12-18 21:51:37 UTC (rev 444)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2009-12-20 01:10:47 UTC (rev 445)
@@ -1039,6 +1039,7 @@
envelope->Ticks[0] = 0;
envelope->Values[0] = cDefaultValue;
envelope->nNodes = 1;
+ envelope->dwFlags |= ENV_ENABLED;
}
UINT i = 0;
for (i = 0; i < envelope->nNodes; i++) if (nTick <= envelope->Ticks[i]) break;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-18 21:51:37 UTC (rev 444)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-20 01:10:47 UTC (rev 445)
@@ -1847,6 +1847,8 @@
}
if (bReplace)
{
+ pModDoc->GetPatternUndo()->PrepareUndo(nPat, n % pSndFile->m_nChannels, n / pSndFile->m_nChannels, 1, 1);
+
if ((m_dwReplaceFlags & PATSEARCH_NOTE))
{
// -1 octave
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-18 21:51:51
|
Revision: 444
http://modplug.svn.sourceforge.net/modplug/?rev=444&view=rev
Author: saga-games
Date: 2009-12-18 21:51:37 +0000 (Fri, 18 Dec 2009)
Log Message:
-----------
[Fix] When using a Load/Save dialog, MPT's key handler will be disabled so that common shortcuts like F2, Ctrl+C, Ctrl+V, Esc. etc. can still be used.
[Fix] General tab: VST Preset Load/save buttons didn't use default directories.
[Ref] Built a nice abstraction of the CFileDialog to realize the first fix. Now CFileDialog is used in only on place, and using Load/Save dialogs should be a lot easier now - especially when dealing with multiple file selections.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/KeyConfigDlg.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moptions.cpp
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/Mptrack.h
trunk/OpenMPT/mptrack/TuningDialog.cpp
trunk/OpenMPT/mptrack/View_gen.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -110,48 +110,35 @@
VOID CAbstractVstEditor::OnLoadPreset()
//-------------------------------------
{
- if (m_pVstPlugin)
- {
- CFileDialog dlg(TRUE, "fxp", NULL,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN,
- "VST Program (*.fxp)|*.fxp||", theApp.m_pMainWnd);
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
+ if(!m_pVstPlugin) return;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "fxp", "",
+ "VST Program (*.fxp)|*.fxp||",
+ CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS));
+ if(files.abort) return;
- if (!(dlg.DoModal() == IDOK)) return;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_PLUGINPRESETS, true);
- CString sFile = dlg.GetPathName();
- CMainFrame::SetWorkingDirectory(sFile, DIR_PLUGINPRESETS, true);
-
- //TODO: exception handling to distinguish errors at this level.
- if (!(m_pVstPlugin->LoadProgram(sFile)))
- ::AfxMessageBox("Error loading preset. Are you sure it is for this plugin?");
- }
+ //TODO: exception handling to distinguish errors at this level.
+ if (!(m_pVstPlugin->LoadProgram(files.first_file.c_str())))
+ ::AfxMessageBox("Error loading preset. Are you sure it is for this plugin?");
}
VOID CAbstractVstEditor::OnSavePreset()
//-------------------------------------
{
- if (m_pVstPlugin)
- {
- CFileDialog dlg(FALSE, "fxp", NULL,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN,
- "VST Program (*.fxp)|*.fxp||", theApp.m_pMainWnd);
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
- if (!(dlg.DoModal() == IDOK)) return;
+ if(!m_pVstPlugin) return;
- CString sFile = dlg.GetPathName();
- CMainFrame::SetWorkingDirectory(sFile, DIR_PLUGINPRESETS, true);
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "fxp", "",
+ "VST Program (*.fxp)|*.fxp||",
+ CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS));
+ if(files.abort) return;
- //TODO: exception handling
- if (!(m_pVstPlugin->SaveProgram(sFile)))
- ::AfxMessageBox("Error saving preset.");
- }
- return;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_PLUGINPRESETS, true);
+
+ //TODO: exception handling
+ if (!(m_pVstPlugin->SaveProgram(files.first_file.c_str())))
+ ::AfxMessageBox("Error saving preset.");
}
VOID CAbstractVstEditor::OnRandomizePreset()
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -1529,31 +1529,22 @@
void CCtrlInstruments::OnInstrumentOpen()
//---------------------------------------
{
- CFileDialog dlg(TRUE,
- NULL,
- NULL,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT,
- "All Instruments|*.xi;*.pat;*.iti;*.wav;*.aif;*.aiff|"
- "FastTracker II Instruments (*.xi)|*.xi|"
- "GF1 Patches (*.pat)|*.pat|"
- "Impulse Tracker Instruments (*.iti)|*.iti|"
- "All Files (*.*)|*.*||",
- this);
+ static int nLastIndex = 0;
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_INSTRUMENTS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
+ "All Instruments|*.xi;*.pat;*.iti;*.wav;*.aif;*.aiff|"
+ "FastTracker II Instruments (*.xi)|*.xi|"
+ "GF1 Patches (*.pat)|*.pat|"
+ "Impulse Tracker Instruments (*.iti)|*.iti|"
+ "All Files (*.*)|*.*||",
+ CMainFrame::GetWorkingDirectory(DIR_INSTRUMENTS),
+ true,
+ &nLastIndex);
+ if(files.abort) return;
- const size_t bufferSize = 2048; //Note: This is possibly the maximum buffer size.
- vector<char> filenameBuffer(bufferSize, 0);
- dlg.GetOFN().lpstrFile = &filenameBuffer[0];
- dlg.GetOFN().nMaxFile = bufferSize;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_INSTRUMENTS, true);
- if (dlg.DoModal() != IDOK) return;
-
- POSITION pos = dlg.GetStartPosition();
- size_t counter = 0;
- while(pos != NULL)
+ for(size_t counter = 0; counter < files.filenames.size(); counter++)
{
//If loading multiple instruments, advancing to next instrument and creating
//new instrument if necessary.
@@ -1568,12 +1559,10 @@
OnInstrumentNew();
}
- if(!OpenInstrument(dlg.GetNextPathName(pos)))
+ if(!OpenInstrument(files.filenames[counter].c_str()))
ErrorBox(IDS_ERR_FILEOPEN, this);
-
- counter++;
}
- filenameBuffer.clear();
+
if (m_pParent) m_pParent->InstrumentChanged(m_nInstrument);
SwitchToView();
}
@@ -1597,43 +1586,29 @@
}
SanitizeFilename(szFileName);
-// -> CODE#0019
-// -> DESC="correctly load ITI & XI instruments sample note map"
-// CFileDialog dlg(FALSE, (m_pSndFile->m_nType & MOD_TYPE_IT) ? "iti" : "xi",
-// szFileName,
-// OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
-// "FastTracker II Instruments (*.xi)|*.xi|"
-// "Impulse Tracker Instruments (*.iti)|*.iti||",
-// this);
- CFileDialog dlg(FALSE, (m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) ? "iti" : "xi",
- szFileName,
- OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- ( m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT) ? "Impulse Tracker Instruments (*.iti)|*.iti|"
- "FastTracker II Instruments (*.xi)|*.xi||"
- : "FastTracker II Instruments (*.xi)|*.xi|"
- "Impulse Tracker Instruments (*.iti)|*.iti||" ),
- this);
-// -! BUG_FIX#0019
-
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, (m_pSndFile->GetType() == MOD_TYPE_XM) ? "xi" : "iti", szFileName,
+ (m_pSndFile->GetType() == MOD_TYPE_XM) ?
+ "FastTracker II Instruments (*.xi)|*.xi|"
+ "Impulse Tracker Instruments (*.iti)|*.iti||" :
+ "Impulse Tracker Instruments (*.iti)|*.iti|"
+ "FastTracker II Instruments (*.xi)|*.xi||",
+ CMainFrame::GetWorkingDirectory(DIR_INSTRUMENTS));
+ if(files.abort) return;
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_INSTRUMENTS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
-
- if (dlg.DoModal() != IDOK) return;
BeginWaitCursor();
- _splitpath(dlg.GetPathName(), drive, path, NULL, ext);
+
+ _splitpath(files.first_file.c_str(), drive, path, NULL, ext);
BOOL bOk = FALSE;
if (!lstrcmpi(ext, ".iti"))
- bOk = m_pSndFile->SaveITIInstrument(m_nInstrument, dlg.GetPathName());
+ bOk = m_pSndFile->SaveITIInstrument(m_nInstrument, files.first_file.c_str());
else
- bOk = m_pSndFile->SaveXIInstrument(m_nInstrument, dlg.GetPathName());
+ bOk = m_pSndFile->SaveXIInstrument(m_nInstrument, files.first_file.c_str());
// -> CODE#0023
// -> DESC="IT project files (.itp)"
- int n = strlen(dlg.GetPathName());
+ int n = strlen(files.first_file.c_str());
if(n > _MAX_PATH) n = _MAX_PATH;
- strncpy(m_pSndFile->m_szInstrumentPath[m_nInstrument-1],dlg.GetPathName(),n);
+ strncpy(m_pSndFile->m_szInstrumentPath[m_nInstrument-1], files.first_file.c_str(),n);
m_pSndFile->instrumentModified[m_nInstrument-1] = FALSE;
// -! NEW_FEATURE#0023
@@ -1643,7 +1618,7 @@
strcpy(szFileName, drive);
strcat(szFileName, path);
- CMainFrame::SetWorkingDirectory(szFileName, DIR_INSTRUMENTS);
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_INSTRUMENTS);
// -> CODE#0023
// -> DESC="IT project files (.itp)"
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -902,38 +902,25 @@
//-------------------------------
{
static int nLastIndex = 0;
- CFileDialog dlg(TRUE,
- NULL,
- NULL,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT,
- "All Samples|*.wav;*.pat;*.s3i;*.smp;*.snd;*.raw;*.xi;*.aif;*.aiff;*.its;*.8sv;*.8svx;*.svx;*.pcm|"
- "Wave Files (*.wav)|*.wav|"
- "XI Samples (*.xi)|*.xi|"
- "Impulse Tracker Samples (*.its)|*.its|"
- "ScreamTracker Samples (*.s3i,*.smp)|*.s3i;*.smp|"
- "GF1 Patches (*.pat)|*.pat|"
- "AIFF Files (*.aiff;*.8svx)|*.aif;*.aiff;*.8sv;*.8svx;*.svx|"
- "Raw Samples (*.raw,*.snd,*.pcm)|*.raw;*.snd;*.pcm|"
- "All Files (*.*)|*.*||",
- this);
+
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
+ "All Samples|*.wav;*.pat;*.s3i;*.smp;*.snd;*.raw;*.xi;*.aif;*.aiff;*.its;*.8sv;*.8svx;*.svx;*.pcm|"
+ "Wave Files (*.wav)|*.wav|"
+ "XI Samples (*.xi)|*.xi|"
+ "Impulse Tracker Samples (*.its)|*.its|"
+ "ScreamTracker Samples (*.s3i,*.smp)|*.s3i;*.smp|"
+ "GF1 Patches (*.pat)|*.pat|"
+ "AIFF Files (*.aiff;*.8svx)|*.aif;*.aiff;*.8sv;*.8svx;*.svx|"
+ "Raw Samples (*.raw,*.snd,*.pcm)|*.raw;*.snd;*.pcm|"
+ "All Files (*.*)|*.*||",
+ CMainFrame::GetWorkingDirectory(DIR_SAMPLES),
+ true,
+ &nLastIndex);
+ if(files.abort) return;
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_SAMPLES);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_SAMPLES, true);
- dlg.m_ofn.nFilterIndex = nLastIndex;
- 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;
-
- if (dlg.DoModal() != IDOK) return;
-
- nLastIndex = dlg.m_ofn.nFilterIndex;
-
- POSITION pos = dlg.GetStartPosition();
- size_t counter = 0;
- while(pos != NULL)
+ for(size_t counter = 0; counter < files.filenames.size(); counter++)
{
//If loading multiple samples, advancing to next sample and creating
//new one if necessary.
@@ -944,16 +931,13 @@
else
m_nSample++;
- if(m_nSample > m_pSndFile->GetNumSamples())
+ if(m_nSample > m_pSndFile->GetNumSamples())
OnSampleNew();
}
- if(!OpenSample(dlg.GetNextPathName(pos)))
+ if(!OpenSample(files.filenames[counter].c_str()))
ErrorBox(IDS_ERR_FILEOPEN, this);
-
- counter++;
}
- filenameBuffer.clear();
SwitchToView();
}
@@ -1000,24 +984,20 @@
}
SanitizeFilename(szFileName);
- CFileDialog dlg(FALSE, "wav",
- szFileName,
- OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- "Wave File (*.wav)|*.wav|"
- "RAW Audio (*.raw)|*.raw||",
- this);
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_SAMPLES);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
- if (dlg.DoModal() != IDOK) return;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "wav", szFileName,
+ "Wave File (*.wav)|*.wav|"
+ "RAW Audio (*.raw)|*.raw||",
+ CMainFrame::GetWorkingDirectory(DIR_SAMPLES));
+ if(files.abort) return;
+
BeginWaitCursor();
TCHAR ext[_MAX_EXT];
- _splitpath(dlg.GetPathName(), NULL, NULL, NULL, ext);
+ _splitpath(files.first_file.c_str(), NULL, NULL, NULL, ext);
bool bOk = false;
UINT iMinSmp = m_nSample, iMaxSmp = m_nSample;
- CString sFilename = dlg.GetPathName(), sNumberFormat;
+ CString sFilename = files.first_file.c_str(), sNumberFormat;
if(bBatchSave)
{
iMinSmp = 1;
@@ -1040,7 +1020,7 @@
SanitizeFilename(sSampleName);
SanitizeFilename(sSampleFilename);
- sFilename = dlg.GetPathName();
+ sFilename = files.first_file.c_str();
sFilename.Replace("%sample_number%", sSampleNumber);
sFilename.Replace("%sample_filename%", sSampleFilename);
sFilename.Replace("%sample_name%", sSampleName);
@@ -1058,7 +1038,7 @@
ErrorBox(IDS_ERR_SAVESMP, this);
} else
{
- CMainFrame::SetWorkingDirectory(dlg.GetPathName(), DIR_SAMPLES, true);
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_SAMPLES, true);
}
SwitchToView();
}
Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp
===================================================================
--- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -646,37 +646,29 @@
void COptionsKeyboard::OnLoad()
{
- CFileDialog dlg(TRUE, "mkb", m_sFullPathName,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN,
- "OpenMPT Key Bindings (*.mkb)|*.mkb||", theApp.m_pMainWnd);
- if (CMainFrame::m_szKbdFile[0])
- dlg.m_ofn.lpstrInitialDir = CMainFrame::m_szKbdFile;
+ std::string filename = m_sFullPathName;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "mkb", filename,
+ "OpenMPT Key Bindings (*.mkb)|*.mkb||",
+ CMainFrame::m_szKbdFile);
+ if(files.abort) return;
- if (dlg.DoModal() == IDOK)
- {
- m_sFullPathName=dlg.GetPathName();
- plocalCmdSet->LoadFile(m_sFullPathName);
- ForceUpdateGUI();
- TentativeSetToDefaultFile(m_sFullPathName);
- }
-
+ m_sFullPathName = files.first_file.c_str();
+ plocalCmdSet->LoadFile(m_sFullPathName);
+ ForceUpdateGUI();
+ TentativeSetToDefaultFile(m_sFullPathName);
}
void COptionsKeyboard::OnSave()
{
- CFileDialog dlg(FALSE, "mkb", m_sFullPathName,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN,
- "OpenMPT Key Bindings (*.mkb)|*.mkb||", theApp.m_pMainWnd);
- if (CMainFrame::m_szKbdFile[0])
- dlg.m_ofn.lpstrInitialDir = CMainFrame::m_szKbdFile;
-
- if (dlg.DoModal() == IDOK)
- {
- m_sFullPathName=dlg.GetPathName();
- plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck());
- TentativeSetToDefaultFile(m_sFullPathName);
- }
-
+ std::string filename = m_sFullPathName;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "mkb", filename,
+ "OpenMPT Key Bindings (*.mkb)|*.mkb||",
+ CMainFrame::m_szKbdFile);
+ if(files.abort) return;
+
+ m_sFullPathName = files.first_file.c_str();
+ plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck());
+ TentativeSetToDefaultFile(m_sFullPathName);
}
bool COptionsKeyboard::TentativeSetToDefaultFile(CString m_sFullPathName)
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -132,7 +132,6 @@
BOOL CMainFrame::gbPatternVUMeters = FALSE;
BOOL CMainFrame::gbPatternPluginNames = TRUE;
DWORD CMainFrame::gdwNotificationType = MPTNOTIFY_DEFAULT;
-UINT CMainFrame::m_nFilterIndex = 0;
UINT CMainFrame::m_nLastOptionsPage = 0;
BOOL CMainFrame::gbMdiMaximize = FALSE;
bool CMainFrame::gbShowHackControls = false;
@@ -2418,45 +2417,40 @@
void CMainFrame::OnAddDlsBank()
//-----------------------------
{
- CFileDialog dlg(TRUE,
- ".dls",
- NULL,
- OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
- "All Sound Banks|*.dls;*.sbk;*.sf2;*.mss|"
- "Downloadable Sounds Banks (*.dls)|*.dls;*.mss|"
- "SoundFont 2.0 Banks (*.sf2)|*.sbk;*.sf2|"
- "All Files (*.*)|*.*||",
- this);
- if (dlg.DoModal() == IDOK)
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "dls", "",
+ "All Sound Banks|*.dls;*.sbk;*.sf2;*.mss|"
+ "Downloadable Sounds Banks (*.dls)|*.dls;*.mss|"
+ "SoundFont 2.0 Banks (*.sf2)|*.sbk;*.sf2|"
+ "All Files (*.*)|*.*||",
+ "",
+ true);
+ if(files.abort) return;
+
+ BeginWaitCursor();
+ for(size_t counter = 0; counter < files.filenames.size(); counter++)
{
- BeginWaitCursor();
- CTrackApp::AddDLSBank(dlg.GetPathName());
- m_wndTree.RefreshDlsBanks();
- EndWaitCursor();
+ CTrackApp::AddDLSBank(files.filenames[counter].c_str());
}
+ m_wndTree.RefreshDlsBanks();
+ EndWaitCursor();
}
void CMainFrame::OnImportMidiLib()
//--------------------------------
{
- CFileDialog dlg(TRUE,
- NULL,
- NULL,
- OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
- "Text and INI files (*.txt,*.ini)|*.txt;*.ini;*.dls;*.sf2;*.sbk|"
- "Downloadable Sound Banks (*.dls)|*.dls;*.mss|"
- "SoundFont 2.0 banks (*.sf2)|*.sbk;*.sf2|"
- "Gravis UltraSound (ultrasnd.ini)|ultrasnd.ini|"
- "All Files (*.*)|*.*||",
- this);
- if (dlg.DoModal() == IDOK)
- {
- BeginWaitCursor();
- CTrackApp::ImportMidiConfig(dlg.GetPathName());
- m_wndTree.RefreshMidiLibrary();
- EndWaitCursor();
- }
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
+ "Text and INI files (*.txt,*.ini)|*.txt;*.ini;*.dls;*.sf2;*.sbk|"
+ "Downloadable Sound Banks (*.dls)|*.dls;*.mss|"
+ "SoundFont 2.0 banks (*.sf2)|*.sbk;*.sf2|"
+ "Gravis UltraSound (ultrasnd.ini)|ultrasnd.ini|"
+ "All Files (*.*)|*.*||");
+ if(files.abort) return;
+
+ BeginWaitCursor();
+ CTrackApp::ImportMidiConfig(files.first_file.c_str());
+ m_wndTree.RefreshMidiLibrary();
+ EndWaitCursor();
}
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2009-12-18 21:51:37 UTC (rev 444)
@@ -368,7 +368,7 @@
CString m_csRegSettings;
CString m_csRegWindow;
// Globals
- static UINT m_nLastOptionsPage, m_nFilterIndex;
+ static UINT m_nLastOptionsPage;
static BOOL gbMdiMaximize;
static bool gbShowHackControls;
static LONG glCtrlWindowHeight, glTreeWindowWidth, glTreeSplitRatio;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -22,12 +22,12 @@
static char THIS_FILE[] = __FILE__;
#endif
-const TCHAR* const FileFilterMOD = TEXT("ProTracker Modules (*.mod)|*.mod||");
-const TCHAR* const FileFilterXM = TEXT("FastTracker Modules (*.xm)|*.xm||");
-const TCHAR* const FileFilterS3M = TEXT("ScreamTracker Modules (*.s3m)|*.s3m||");
-const TCHAR* const FileFilterIT = TEXT("Impulse Tracker Modules (*.it)|*.it||");
-const TCHAR* const FileFilterITP = TEXT("Impulse Tracker Projects (*.itp)|*.itp||");
-const TCHAR* const FileFilterMPT = TEXT("OpenMPT Modules (*.mptm)|*.mptm||");
+const std::string FileFilterMOD = _T("ProTracker Modules (*.mod)|*.mod||");
+const std::string FileFilterXM = _T("FastTracker Modules (*.xm)|*.xm||");
+const std::string FileFilterS3M = _T("ScreamTracker Modules (*.s3m)|*.s3m||");
+const std::string FileFilterIT = _T("Impulse Tracker Modules (*.it)|*.it||");
+const std::string FileFilterITP = _T("Impulse Tracker Projects (*.itp)|*.itp||");
+const std::string FileFilterMPT = _T("OpenMPT Modules (*.mptm)|*.mptm||");
/////////////////////////////////////////////////////////////////////////////
// CModDoc
@@ -489,25 +489,25 @@
CHAR s[_MAX_PATH] = "";
CHAR path[_MAX_PATH]="", drive[_MAX_DRIVE]="";
CHAR fname[_MAX_FNAME]="", fext[_MAX_EXT]="";
- LPCSTR lpszFilter = NULL, lpszDefExt = NULL;
+ std::string extFilter = "", defaultExtension = "";
switch(m_SndFile.GetType())
{
case MOD_TYPE_MOD:
MsgBoxHidable(ModCompatibilityExportTip);
- lpszDefExt = "mod";
- lpszFilter = FileFilterMOD;
+ defaultExtension = "mod";
+ extFilter = FileFilterMOD;
strcpy(fext, ".mod");
break;
case MOD_TYPE_S3M:
- lpszDefExt = "s3m";
- lpszFilter = FileFilterS3M;
+ defaultExtension = "s3m";
+ extFilter = FileFilterS3M;
strcpy(fext, ".s3m");
break;
case MOD_TYPE_XM:
MsgBoxHidable(XMCompatibilityExportTip);
- lpszDefExt = "xm";
- lpszFilter = FileFilterXM;
+ defaultExtension = "xm";
+ extFilter = FileFilterXM;
strcpy(fext, ".xm");
break;
case MOD_TYPE_IT:
@@ -517,22 +517,22 @@
// lpszFilter = "Impulse Tracker Modules (*.it)|*.it||";
// strcpy(fext, ".it");
if(m_SndFile.m_dwSongFlags & SONG_ITPROJECT){
- lpszDefExt = "itp";
- lpszFilter = FileFilterITP;
+ defaultExtension = "itp";
+ extFilter = FileFilterITP;
strcpy(fext, ".itp");
}
else
{
MsgBoxHidable(ItCompatibilityExportTip);
- lpszDefExt = "it";
- lpszFilter = FileFilterIT;
+ defaultExtension = "it";
+ extFilter = FileFilterIT;
strcpy(fext, ".it");
}
// -! NEW_FEATURE#0023
break;
case MOD_TYPE_MPT:
- lpszDefExt = "mptm";
- lpszFilter = FileFilterMPT;
+ defaultExtension = "mptm";
+ extFilter = FileFilterMPT;
strcpy(fext, ".mptm");
break;
default:
@@ -547,18 +547,15 @@
strcat(s, path);
strcat(s, fname);
strcat(s, fext);
- CFileDialog dlg(FALSE, lpszDefExt, s,
- OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- lpszFilter,
- theApp.m_pMainWnd);
+
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, defaultExtension, s,
+ extFilter,
+ CMainFrame::GetWorkingDirectory(DIR_MODS));
+ if(files.abort) return FALSE;
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_MODS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_MODS, true);
- if (dlg.DoModal() != IDOK) return FALSE;
- strcpy(s, dlg.GetPathName());
- CMainFrame::SetWorkingDirectory(s, DIR_MODS, true);
+ strcpy(s, files.first_file.c_str());
_splitpath(s, drive, path, fname, fext);
} else
{
@@ -1415,20 +1412,20 @@
if ((!pMainFrm) || (!m_SndFile.GetType())) return;
_splitpath(GetPathName(), NULL, NULL, fname, NULL);
- CFileDialog dlg(FALSE, "wav", fname,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- "Wave Files (*.wav)|*.wav||", pMainFrm);
- dlg.m_ofn.lpstrInitialDir = CMainFrame::GetWorkingDirectory(DIR_EXPORT);
CWaveConvert wsdlg(pMainFrm, nMinOrder, nMaxOrder);
if (wsdlg.DoModal() != IDOK) return;
- if (dlg.DoModal() != IDOK) return; //rewbs: made filename dialog appear after wav settings dialog
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "wav", fname,
+ "Wave Files (*.wav)|*.wav||",
+ CMainFrame::GetWorkingDirectory(DIR_EXPORT));
+ if(files.abort) return;
+
// will set default dir here because there's no setup option for export dir yet (feel free to add one...)
- pMainFrm->SetDefaultDirectory(dlg.GetPathName(), DIR_EXPORT, true);
+ CMainFrame::SetDefaultDirectory(files.workingDirectory.c_str(), DIR_EXPORT, true);
TCHAR s[_MAX_PATH];
- strcpy(s, dlg.GetPathName());
+ strcpy(s, files.first_file.c_str());
// Saving as wave file
UINT p = 0, n = 1;
@@ -1508,59 +1505,58 @@
void CModDoc::OnFileMP3Convert()
//------------------------------
{
+ int nFilterIndex = 0;
TCHAR sFName[_MAX_FNAME] = "";
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
if ((!pMainFrm) || (!m_SndFile.GetType())) return;
_splitpath(GetPathName(), NULL, NULL, sFName, NULL);
- CFileDialog dlg(FALSE, "mp3", sFName,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- "MPEG Layer III Files (*.mp3)|*.mp3|Layer3 Wave Files (*.wav)|*.wav||", pMainFrm);
- dlg.m_ofn.nFilterIndex = 0;
-
- dlg.m_ofn.lpstrInitialDir = CMainFrame::GetWorkingDirectory(DIR_EXPORT);
- if (dlg.DoModal() == IDOK)
- {
- MPEGLAYER3WAVEFORMAT wfx;
- HACMDRIVERID hadid;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "mp3", sFName,
+ "MPEG Layer III Files (*.mp3)|*.mp3|Layer3 Wave Files (*.wav)|*.wav||",
+ CMainFrame::GetWorkingDirectory(DIR_EXPORT),
+ false,
+ &nFilterIndex);
+ if(files.abort) return;
- // will set default dir here because there's no setup option for export dir yet (feel free to add one...)
- pMainFrm->SetDefaultDirectory(dlg.GetPathName(), DIR_EXPORT, true);
+ MPEGLAYER3WAVEFORMAT wfx;
+ HACMDRIVERID hadid;
- TCHAR s[_MAX_PATH], fext[_MAX_EXT];
- strcpy(s, dlg.GetPathName());
- _splitpath(s, NULL, NULL, NULL, fext);
- if (strlen(fext) <= 1)
- {
- int l = strlen(s) - 1;
- if ((l >= 0) && (s[l] == '.')) s[l] = 0;
- strcpy(fext, (dlg.m_ofn.nFilterIndex == 2) ? ".wav" : ".mp3");
- strcat(s, fext);
- }
- CLayer3Convert wsdlg(&m_SndFile, pMainFrm);
- if (m_SndFile.m_szNames[0][0]) wsdlg.m_bSaveInfoField = TRUE;
- if (wsdlg.DoModal() != IDOK) return;
- wsdlg.GetFormat(&wfx, &hadid);
- // Saving as mpeg file
- BOOL bplaying = FALSE;
- UINT pos = m_SndFile.GetCurrentPos();
- bplaying = TRUE;
- pMainFrm->PauseMod();
- m_SndFile.SetCurrentPos(0);
+ // will set default dir here because there's no setup option for export dir yet (feel free to add one...)
+ pMainFrm->SetDefaultDirectory(files.workingDirectory.c_str(), DIR_EXPORT, true);
- m_SndFile.m_dwSongFlags &= ~SONG_PATTERNLOOP;
-
- // Saving file
- CFileTagging *pTag = (wsdlg.m_bSaveInfoField) ? &wsdlg.m_FileTags : NULL;
- CDoAcmConvert dwcdlg(&m_SndFile, s, &wfx.wfx, hadid, pTag, pMainFrm);
- dwcdlg.m_dwFileLimit = wsdlg.m_dwFileLimit;
- dwcdlg.m_dwSongLimit = wsdlg.m_dwSongLimit;
- dwcdlg.DoModal();
- m_SndFile.SetCurrentPos(pos);
- m_SndFile.GetLength(TRUE);
- CMainFrame::UpdateAudioParameters(TRUE);
+ TCHAR s[_MAX_PATH], fext[_MAX_EXT];
+ strcpy(s, files.first_file.c_str());
+ _splitpath(s, NULL, NULL, NULL, fext);
+ if (strlen(fext) <= 1)
+ {
+ int l = strlen(s) - 1;
+ if ((l >= 0) && (s[l] == '.')) s[l] = 0;
+ strcpy(fext, (nFilterIndex == 2) ? ".wav" : ".mp3");
+ strcat(s, fext);
}
+ CLayer3Convert wsdlg(&m_SndFile, pMainFrm);
+ if (m_SndFile.m_szNames[0][0]) wsdlg.m_bSaveInfoField = TRUE;
+ if (wsdlg.DoModal() != IDOK) return;
+ wsdlg.GetFormat(&wfx, &hadid);
+ // Saving as mpeg file
+ BOOL bplaying = FALSE;
+ UINT pos = m_SndFile.GetCurrentPos();
+ bplaying = TRUE;
+ pMainFrm->PauseMod();
+ m_SndFile.SetCurrentPos(0);
+
+ m_SndFile.m_dwSongFlags &= ~SONG_PATTERNLOOP;
+
+ // Saving file
+ CFileTagging *pTag = (wsdlg.m_bSaveInfoField) ? &wsdlg.m_FileTags : NULL;
+ CDoAcmConvert dwcdlg(&m_SndFile, s, &wfx.wfx, hadid, pTag, pMainFrm);
+ dwcdlg.m_dwFileLimit = wsdlg.m_dwFileLimit;
+ dwcdlg.m_dwSongLimit = wsdlg.m_dwSongLimit;
+ dwcdlg.DoModal();
+ m_SndFile.SetCurrentPos(pos);
+ m_SndFile.GetLength(TRUE);
+ CMainFrame::UpdateAudioParameters(TRUE);
}
@@ -1577,19 +1573,17 @@
strcat(s, path);
strcat(s, fname);
strcat(s, ".mid");
- CFileDialog dlg(FALSE, "mid", s,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- "Midi Files (*.mid,*.rmi)|*.mid;*.rmi||", pMainFrm);
- dlg.m_ofn.nFilterIndex = 0;
- if (dlg.DoModal() == IDOK)
+
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "mid", s,
+ "Midi Files (*.mid,*.rmi)|*.mid;*.rmi||");
+ if(files.abort) return;
+
+ CModToMidi mididlg(files.first_file.c_str(), &m_SndFile, pMainFrm);
+ if (mididlg.DoModal() == IDOK)
{
- CModToMidi mididlg(dlg.GetPathName(), &m_SndFile, pMainFrm);
- if (mididlg.DoModal() == IDOK)
- {
- BeginWaitCursor();
- mididlg.DoConvert();
- EndWaitCursor();
- }
+ BeginWaitCursor();
+ mididlg.DoConvert();
+ EndWaitCursor();
}
}
@@ -1598,9 +1592,9 @@
//-------------------------------------
{
CHAR path[_MAX_PATH]="", drive[_MAX_DRIVE]="";
- CHAR s[_MAX_PATH], fname[_MAX_FNAME]="";
+ CHAR fname[_MAX_FNAME]="";
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
- CString ext, pattern;
+ std::string ext, pattern, filename;
UINT type = m_SndFile.GetType();
@@ -1639,35 +1633,30 @@
}
_splitpath(GetPathName(), drive, path, fname, NULL);
- strcpy(s, drive);
- strcat(s, path);
- strcat(s, fname);
- if (!strstr(fname, "compat")) {
- strcat(s, ".compat.");
- } else {
- strcat(s, ".");
- }
- strcat(s, ext);
- CFileDialog dlg(FALSE, ext, s,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- pattern, pMainFrm);
- dlg.m_ofn.lpstrInitialDir = CMainFrame::GetWorkingDirectory(DIR_MODS);
+ filename = drive;
+ filename += path;
+ filename += fname;
+ if (!strstr(fname, "compat"))
+ filename += ".compat.";
+ else
+ filename += ".";
+ filename += ext;
- if (dlg.DoModal() != IDOK){
- return;
- }
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, ext, filename, pattern, CMainFrame::GetWorkingDirectory(DIR_MODS));
+ if(files.abort) return;
+
switch (type)
{
case MOD_TYPE_MOD:
- m_SndFile.SaveMod(dlg.GetPathName(), 0, true);
+ m_SndFile.SaveMod(files.first_file.c_str(), 0, true);
SetModified(); // Compatibility save may adjust samples so set modified...
m_ShowSavedialog = true; // ...and force save dialog to appear when saving.
break;
case MOD_TYPE_XM:
- m_SndFile.SaveXM(dlg.GetPathName(), 0, true);
+ m_SndFile.SaveXM(files.first_file.c_str(), 0, true);
break;
case MOD_TYPE_IT:
- m_SndFile.SaveCompatIT(dlg.GetPathName());
+ m_SndFile.SaveCompatIT(files.first_file.c_str());
break;
}
}
Modified: trunk/OpenMPT/mptrack/Moptions.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moptions.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Moptions.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -514,16 +514,10 @@
void COptionsColors::OnLoadColorScheme()
//--------------------------------------
{
- CFileDialog dlg(TRUE, NULL, NULL,
- OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
- "OpenMPT Color Schemes|*.mptcolor|"
- "All Files (*.*)|*.*||",
- this);
- dlg.m_ofn.lpstrInitialDir = theApp.GetConfigPath();
- if (dlg.DoModal() != IDOK) return;
-
- TCHAR sFilename[MAX_PATH];
- strcpy(sFilename, dlg.GetPathName());
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "mptcolor", "",
+ "OpenMPT Color Schemes|*.mptcolor||",
+ theApp.GetConfigPath());
+ if(files.abort) return;
// Ensure that all colours are reset (for outdated colour schemes)
OnPresetMPT();
@@ -531,7 +525,7 @@
{
TCHAR sKeyName[16];
wsprintf(sKeyName, "Color%02d", i);
- CustomColors[i] = CMainFrame::GetPrivateProfileLong("Colors", sKeyName, CustomColors[i], sFilename);
+ CustomColors[i] = CMainFrame::GetPrivateProfileLong("Colors", sKeyName, CustomColors[i], files.first_file.c_str());
}
OnPreviewChanged();
}
@@ -539,21 +533,16 @@
void COptionsColors::OnSaveColorScheme()
//--------------------------------------
{
- CFileDialog dlg(FALSE, "mptcolor", NULL,
- OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- "OpenMPT Color Schemes|*.mptcolor|",
- this);
- dlg.m_ofn.lpstrInitialDir = theApp.GetConfigPath();
- if (dlg.DoModal() != IDOK) return;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "mptcolor", "",
+ "OpenMPT Color Schemes|*.mptcolor||",
+ theApp.GetConfigPath());
+ if(files.abort) return;
- TCHAR sFilename[MAX_PATH];
- strcpy(sFilename, dlg.GetPathName());
-
for(int i = 0; i < MAX_MODCOLORS; i++)
{
TCHAR sKeyName[16];
wsprintf(sKeyName, "Color%02d", i);
- CMainFrame::WritePrivateProfileLong("Colors", sKeyName, CustomColors[i], sFilename);
+ CMainFrame::WritePrivateProfileLong("Colors", sKeyName, CustomColors[i], files.first_file.c_str());
}
}
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -1430,63 +1430,47 @@
void CTrackApp::OnFileOpen()
//--------------------------
{
- CFileDialog dlg(TRUE,
- NULL,
- NULL,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_FORCESHOWHIDDEN | OFN_ALLOWMULTISELECT,
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- "All Modules|*.mod;*.nst;*.wow;*.s3m;*.stm;*.669;*.mtm;*.xm;*.it;*.itp;*.mptm;*.ult;*.mdz;*.s3z;*.xmz;*.itz;mod.*;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.mdr;*.med;*.ams;*.dbm;*.dsm;*.mid;*.rmi;*.smf;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.j2b"
- #ifndef NO_MO3_SUPPORT
- ";*.mo3"
- #endif
- "|"
- "Compressed Modules (*.mdz;*.s3z;*.xmz;*.itz"
- #ifndef NO_MO3_SUPPORT
- ";*.mo3"
- #endif
- ")|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha"
- #ifndef NO_MO3_SUPPORT
- ";*.mo3"
- #endif
- "|"
-// -! NEW_FEATURE#0023
- "ProTracker Modules (*.mod,*.nst)|*.mod;mod.*;*.mdz;*.nst;*.m15|"
- "ScreamTracker Modules (*.s3m,*.stm)|*.s3m;*.stm;*.s3z|"
- "FastTracker Modules (*.xm)|*.xm;*.xmz|"
- "Impulse Tracker Modules (*.it)|*.it;*.itz|"
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- "Impulse Tracker Projects (*.itp)|*.itp;*.itpz|"
-// -! NEW_FEATURE#0023
- "OpenMPT Modules (*.mptm)|*.mptm;*.mptmz|"
- "Other Modules (mtm,okt,mdl,669,far,...)|*.mtm;*.669;*.ult;*.wow;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.med;*.ams;*.dbm;*.dsm;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.j2b|"
- "Wave Files (*.wav)|*.wav|"
- "Midi Files (*.mid,*.rmi)|*.mid;*.rmi;*.smf|"
- "All Files (*.*)|*.*||",
- NULL);
- dlg.m_ofn.nFilterIndex = CMainFrame::m_nFilterIndex;
+ static int nFilterIndex = 0;
+ FileDlgResult files = ShowOpenSaveFileDialog(true, "", "",
+ "All Modules|*.mod;*.nst;*.wow;*.s3m;*.stm;*.669;*.mtm;*.xm;*.it;*.itp;*.mptm;*.ult;*.mdz;*.s3z;*.xmz;*.itz;mod.*;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.mdr;*.med;*.ams;*.dbm;*.dsm;*.mid;*.rmi;*.smf;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.j2b"
+#ifndef NO_MO3_SUPPORT
+ ";*.mo3"
+#endif
+ "|"
+ "Compressed Modules (*.mdz;*.s3z;*.xmz;*.itz"
+#ifndef NO_MO3_SUPPORT
+ ";*.mo3"
+#endif
+ ")|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha"
+#ifndef NO_MO3_SUPPORT
+ ";*.mo3"
+#endif
+ "|"
+ // -! NEW_FEATURE#0023
+ "ProTracker Modules (*.mod,*.nst)|*.mod;mod.*;*.mdz;*.nst;*.m15|"
+ "ScreamTracker Modules (*.s3m,*.stm)|*.s3m;*.stm;*.s3z|"
+ "FastTracker Modules (*.xm)|*.xm;*.xmz|"
+ "Impulse Tracker Modules (*.it)|*.it;*.itz|"
+ // -> CODE#0023
+ // -> DESC="IT project files (.itp)"
+ "Impulse Tracker Projects (*.itp)|*.itp;*.itpz|"
+ // -! NEW_FEATURE#0023
+ "OpenMPT Modules (*.mptm)|*.mptm;*.mptmz|"
+ "Other Modules (mtm,okt,mdl,669,far,...)|*.mtm;*.669;*.ult;*.wow;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.med;*.ams;*.dbm;*.dsm;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.j2b|"
+ "Wave Files (*.wav)|*.wav|"
+ "Midi Files (*.mid,*.rmi)|*.mid;*.rmi;*.smf|"
+ "All Files (*.*)|*.*||",
+ CMainFrame::GetWorkingDirectory(DIR_MODS),
+ true,
+ &nFilterIndex);
+ if(files.abort) return;
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_MODS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_MODS, true);
- 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;
- if (dlg.DoModal() == IDOK)
+ for(size_t counter = 0; counter < files.filenames.size(); counter++)
{
- POSITION pos = dlg.GetStartPosition();
- while(pos != NULL)
- {
- CString pathName = dlg.GetNextPathName(pos);
- CMainFrame::SetWorkingDirectory(pathName, DIR_MODS, true);
- CMainFrame::m_nFilterIndex = dlg.m_ofn.nFilterIndex;
- OpenDocumentFile(pathName);
- }
+ OpenDocumentFile(files.filenames[counter].c_str());
}
- filenameBuffer.clear();
}
@@ -3282,3 +3266,92 @@
return CWinApp::ProcessWndProcException(e, pMsg);
}
//end rewbs.crashHandler
+
+
+/* Open or save one or multiple files using the system's file dialog
+ * Parameter list:
+ * - load: true: load dialog. false: save dialog.
+ * - defaultExtension: dialog should use this as the default extension for the file(s)
+ * - defaultFilename: dialog should use this as the default filename
+ * - extFilter: list of possible extensions. format: "description|extensions|description|extensions|..."
+ * - workingDirectory: default directory of the dialog
+ * - allowMultiSelect: allow the user to select multiple files? (will be ignored if load == false)
+ * - filterIndex: pointer to a variable holding the index of the last extension filter used.
+ */
+FileDlgResult CTrackApp::ShowOpenSaveFileDialog(bool load, std::string defaultExtension, std::string defaultFilename, std::string extFilter, std::string workingDirectory, bool allowMultiSelect, int *filterIndex)
+//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+{
+ FileDlgResult result;
+ result.workingDirectory = workingDirectory;
+ result.first_file = "";
+ result.filenames.clear();
+ result.extension = defaultExtension;
+ result.abort = true;
+
+ // we can't save multiple files.
+ if(!load)
+ {
+ allowMultiSelect = false;
+ }
+
+ // First, set up the dialog...
+ CFileDialog dlg(load ? TRUE : FALSE,
+ defaultExtension.empty() ? NULL : defaultExtension.c_str(),
+ defaultFilename.empty() ? NULL : defaultFilename.c_str(),
+ load ? (OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | (allowMultiSelect ? OFN_ALLOWMULTISELECT : 0))
+ : (OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN),
+ extFilter.empty() ? NULL : extFilter.c_str(),
+ theApp.m_pMainWnd);
+ if(!workingDirectory.empty())
+ dlg.m_ofn.lpstrInitialDir = workingDirectory.c_str();
+ 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;*/
+
+ // Do it!
+ CMainFrame::GetInputHandler()->Bypass(true);
+ if(dlg.DoModal() != IDOK)
+ {
+ CMainFrame::GetInputHandler()->Bypass(false);
+ return result;
+ }
+ CMainFrame::GetInputHandler()->Bypass(false);
+
+ // Retrieve variables
+ if(filterIndex != nullptr)
+ *filterIndex = dlg.m_ofn.nFilterIndex;
+
+ if(allowMultiSelect)
+ {
+ // multiple files might have been selected
+ POSITION pos = dlg.GetStartPosition();
+ while(pos != NULL)
+ {
+ std::string filename = dlg.GetNextPathName(pos);
+ result.filenames.push_back(filename);
+ }
+
+ } else
+ {
+ // only one file
+ std::string filename = dlg.GetPathName();
+ result.filenames.push_back(filename);
+ }
+
+ if(!result.filenames.empty())
+ {
+ // some file has been selected.
+ result.workingDirectory = result.filenames.back();
+ result.first_file = result.filenames.front();
+ result.abort = false;
+ }
+
+ result.extension = dlg.GetFileExt();
+
+ return result;
+}
Modified: trunk/OpenMPT/mptrack/Mptrack.h
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.h 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Mptrack.h 2009-12-18 21:51:37 UTC (rev 444)
@@ -112,7 +112,20 @@
} REQUEST_CONTEXT;
#endif
+
/////////////////////////////////////////////////////////////////////////////
+// File dialog (open/save) results
+struct FileDlgResult
+{
+ std::string workingDirectory; // working directory. will include filename, so beware.
+ std::string first_file; // for some convenience, this will keep the first filename of the filenames vector.
+ std::vector <std::string> filenames; // all selected filenames in one vector.
+ std::string extension; // extension used. beware of this when multiple files can be selected!
+ bool abort; // no selection has been made.
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
// CTrackApp:
// See mptrack.cpp for the implementation of this class
//
@@ -175,6 +188,8 @@
static BOOL AddDLSBank(LPCSTR);
static BOOL OpenURL(LPCSTR lpszURL);
+ static FileDlgResult ShowOpenSaveFileDialog(bool load, std::string defaultExtension, std::string defaultFilename, std::string extFilter, std::string workingDirectory = "", bool allowMultiSelect = false, int *filterIndex = nullptr);
+
public:
CDocTemplate *GetModDocTemplate() const { return m_pModTemplate; }
CVstPluginManager *GetPluginManager() const { return m_pPluginManager; }
Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TuningDialog.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -619,24 +619,23 @@
return;
}
- string filter;
+ std::string filter;
if(pT != NULL)
filter = string("Tuning files (*") + CTuning::s_FileExtension + string(")|*") + CTuning::s_FileExtension + string("|");
if(pTC != NULL)
filter += string("Tuning collection files (") + CTuningCollection::s_FileExtension + string(")|*") + CTuningCollection::s_FileExtension + string("|");
- CFileDialog dlg(FALSE, CTuning::s_FileExtension.c_str(),
- NULL,
- OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- filter.c_str(), this);
- dlg.m_ofn.lpstrInitialDir = theApp.GetTuningsPath();
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, CTuning::s_FileExtension, "",
+ filter,
+ theApp.GetTuningsPath());
+ if(files.abort) return;
+ BeginWaitCursor();
+
bool failure = true;
- if (dlg.DoModal() != IDOK) return;
- BeginWaitCursor();
- ofstream fout(dlg.GetPathName(), ios::binary);
- const string ext = "." + dlg.GetFileExt();
+ ofstream fout(files.first_file.c_str(), ios::binary);
+ const string ext = "." + files.extension;
if(ext == CTuning::s_FileExtension)
{
@@ -663,23 +662,18 @@
string filter = string("Tuning files (*") + CTuning::s_FileExtension + string(", *") + CTuningCollection::s_FileExtension + string(")|*") +
CTuning::s_FileExtension + string(";*") + CTuningCollection::s_FileExtension + string("|");
- CFileDialog dlg(TRUE,
- NULL,
- NULL,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
- filter.c_str(),
- this);
- dlg.m_ofn.lpstrInitialDir = theApp.GetTuningsPath();
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
+ filter,
+ theApp.GetTuningsPath());
+ if(files.abort) return;
- if (dlg.DoModal() != IDOK) return;
+ const string ext = string(".") + files.extension;
- const string ext = string(".") + string(dlg.GetFileExt());
-
bool failure = true;
if(ext == CTuning::s_FileExtension)
{
- ifstream fin(dlg.GetPathName(), ios::binary);
+ ifstream fin(files.first_file.c_str(), ios::binary);
CTuning* pT = CTuningRTI::DeserializeOLD(fin);
if(pT == 0) {fin.clear(); fin.seekg(0); pT = CTuningRTI::Deserialize(fin);}
fin.close();
@@ -701,7 +695,7 @@
//a separate collection - no possibility to
//directly replace some collection.
CTuningCollection* pNewTCol = new CTuningCollection;
- pNewTCol->SetSavefilePath(static_cast<LPCTSTR>(dlg.GetPathName()));
+ pNewTCol->SetSavefilePath(static_cast<LPCTSTR>(files.first_file.c_str()));
failure = pNewTCol->Deserialize();
if(failure)
{
Modified: trunk/OpenMPT/mptrack/View_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_gen.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/View_gen.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -1019,13 +1019,13 @@
//rewbs.fxpPresets: changed Eric's code to use fxp load/save
if(pVstPlugin == NULL) return;
- CFileDialog dlg(TRUE, "fxp", NULL,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN,
- "VST FX Program (*.fxp)|*.fxp||", theApp.m_pMainWnd);
- if (!(dlg.DoModal() == IDOK)) return;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "fxp", "",
+ "VST FX Program (*.fxp)|*.fxp||",
+ CMainFrame::GetDefaultDirectory(DIR_PLUGINPRESETS));
+ if(files.abort) return;
//TODO: exception handling
- if (!(pVstPlugin->LoadProgram(dlg.GetFileName()))) {
+ if (!(pVstPlugin->LoadProgram(files.first_file.c_str()))) {
::AfxMessageBox("Error loading preset.Are you sure it is for this plugin?");
} else {
if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
@@ -1045,13 +1045,13 @@
if(pVstPlugin == NULL) return;
//rewbs.fxpPresets: changed Eric's code to use fxp load/save
- CFileDialog dlg(FALSE, "fxp", NULL,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN,
- "VST Program (*.fxp)|*.fxp||", theApp.m_pMainWnd);
- if (!(dlg.DoModal() == IDOK)) return;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "fxp", "",
+ "VST Program (*.fxp)|*.fxp||",
+ CMainFrame::GetDefaultDirectory(DIR_PLUGINPRESETS));
+ if(files.abort) return;
//TODO: exception handling
- if (!(pVstPlugin->SaveProgram(dlg.GetFileName())))
+ if (!(pVstPlugin->SaveProgram(files.first_file.c_str())))
::AfxMessageBox("Error saving preset.");
//end rewbs.fxpPresets
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -1492,24 +1492,21 @@
BOOL CModTree::OpenMidiInstrument(DWORD dwItem)
//---------------------------------------------
{
- CFileDialog dlg(TRUE,
- NULL,
- NULL,
- OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
- "All Instruments and Banks|*.xi;*.pat;*.iti;*.wav;*.aif;*.aiff;*.sf2;*.sbk;*.dls|"
- "FastTracker II Instruments (*.xi)|*.xi|"
- "GF1 Patches (*.pat)|*.pat|"
- "Wave Files (*.wav)|*.wav|"
- "Impulse Tracker Instruments (*.iti)|*.iti;*.its|"
- "SoundFont 2.0 Banks (*.sf2)|*.sf2;*.sbk|"
- "DLS Sound Banks (*.dls)|*.dls|"
- "All Files (*.*)|*.*||",
- this);
- if (dlg.DoModal() != IDOK) return FALSE;
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
+ "All Instruments and Banks|*.xi;*.pat;*.iti;*.wav;*.aif;*.aiff;*.sf2;*.sbk;*.dls|"
+ "FastTracker II Instruments (*.xi)|*.xi|"
+ "GF1 Patches (*.pat)|*.pat|"
+ "Wave Files (*.wav)|*.wav|"
+ "Impulse Tracker Instruments (*.iti)|*.iti;*.its|"
+ "SoundFont 2.0 Banks (*.sf2)|*.sf2;*.sbk|"
+ "DLS Sound Banks (*.dls)|*.dls|"
+ "All Files (*.*)|*.*||");
+ if(files.abort) return FALSE;
+
if (dwItem & 0x80)
- return SetMidiPercussion(dwItem & 0x7F, dlg.GetPathName());
+ return SetMidiPercussion(dwItem & 0x7F, files.first_file.c_str());
else
- return SetMidiInstrument(dwItem, dlg.GetPathName());
+ return SetMidiInstrument(dwItem, files.first_file.c_str());
}
@@ -2914,24 +2911,12 @@
if(pSndFile && modItemID){
- CHAR pszFileNames[_MAX_PATH];
- CFileDialog dlg(TRUE, NULL, NULL,
- OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_FORCESHOWHIDDEN,
- "All files(*.*)|*.*||",
- this);
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "", "",
+ "All files(*.*)|*.*||");
+ if(files.abort) return;
- pszFileNames[0] = 0;
- pszFileNames[1] = 0;
- dlg.m_ofn.lpstrFile = pszFileNames;
- dlg.m_ofn.nMaxFile = _MAX_PATH;
-
- if(dlg.DoModal() == IDOK){
- strcpy(pSndFile->m_szInstrumentPath[modItemID - 1], pszFileNames);
- OnRefreshTree();
- }
-
- dlg.m_ofn.lpstrFile = NULL;
- dlg.m_ofn.nMaxFile = 0;
+ strcpy(pSndFile->m_szInstrumentPath[modItemID - 1], files.first_file.c_str());
+ OnRefreshTree();
}
}
@@ -2948,26 +2933,17 @@
if(pSndFile && modItemID){
- if(pSndFile->m_szInstrumentPath[modItemID - 1][0] == '\0'){
- CHAR pszFileNames[_MAX_PATH];
+ if(pSndFile->m_szInstrumentPath[modItemID - 1][0] == '\0')
+ {
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, (pSndFile->GetType() == MOD_TYPE_XM) ? "xi" : "iti", "",
+ (pSndFile->GetType() == MOD_TYPE_XM) ?
+ "FastTracker II Instruments (*.xi)|*.xi|"
+ "Impulse Tracker Instruments (*.iti)|*.iti||" :
+ "Impulse Tracker Instruments (*.iti)|*.iti|"
+ "FastTracker II Instruments (*.xi)|*.xi||");
+ if(files.abort) return;
- CFileDialog dlg(FALSE, (pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? "iti" : "xi", NULL,
- OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- ( pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT) ? "Impulse Tracker Instruments (*.iti)|*.iti|"
- "FastTracker II Instruments (*.xi)|*.xi||"
- : "FastTracker II Instruments (*.xi)|*.xi|"
- "Impulse Tracker Instruments (*.iti)|*.iti||" ),
- this);
-
- pszFileNames[0] = 0;
- pszFileNames[1] = 0;
- dlg.m_ofn.lpstrFile = pszFileNames;
- dlg.m_ofn.nMaxFile = _MAX_PATH;
-
- if(dlg.DoModal() == IDOK) strcpy(pSndFile->m_szInstrumentPath[modItemID - 1], pszFileNames);
-
- dlg.m_ofn.lpstrFile = NULL;
- dlg.m_ofn.nMaxFile = 0;
+ strcpy(pSndFile->m_szInstrumentPath[modItemID - 1], files.first_file.c_str());
}
if(pSndFile->m_szInstrumentPath[modItemID - 1][0] != '\0'){
@@ -3009,18 +2985,12 @@
void CModTree::OnExportMidiLib()
//------------------------------
{
- CHAR szFileName[_MAX_PATH] = "mptrack.ini";
- CFileDialog dlg(FALSE,
- "ini",
- szFileName,
- OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
- "Text and INI files (*.txt,*.ini)|*.txt;*.ini|"
- "All Files (*.*)|*.*||",
- this);
- if (dlg.DoModal() == IDOK)
- {
- CTrackApp::ExportMidiConfig(dlg.GetPathName());
- }
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "ini", "mptrack.ini",
+ "Text and INI files (*.txt,*.ini)|*.txt;*.ini|"
+ "All Files (*.*)|*.*||");
+ if(files.abort) return;
+
+ CTrackApp::ExportMidiConfig(files.first_file.c_str());
}
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2009-12-17 21:42:45 UTC (rev 443)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2009-12-18 21:51:37 UTC (rev 444)
@@ -1411,54 +1411,34 @@
//----------------------------------
{
CHAR *pszFileNames;
- CFileDialog dlg(TRUE, ".dll", NULL,
- OFN_FILEMUSTEXIST|OFN_ENABLESIZING |OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_FORCESHOWHIDDEN|OFN_ALLOWMULTISELECT,
- "VST Plugins (*.dll)|*.dll||",
- this);
-
- const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_PLUGINS);
- if(pszWdir[0])
- dlg.m_ofn.lpstrInitialDir = pszWdir;
- pszFileNames = new CHAR[MAX_FILEOPEN_BUFSIZE];
- if (!pszFileNames) return;
- pszFileNames[0] = 0;
- pszFileNames[1] = 0;
- dlg.m_ofn.lpstrFile = pszFileNames;
- dlg.m_ofn.nMaxFile = MAX_FILEOPEN_BUFSIZE;
- if (dlg.DoModal() == IDOK)
+ FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "dll", "",
+ "VST Plugins (*.dll)|*.dll||",
+ CMainFrame::GetWorkingDirectory(DIR_PLUGINS),
+ true);
+ if(files.abort) return;
+
+ CMainFrame::SetWorkingDirectory(files.workingDirectory.c_str(), DIR_PLUGINS, true);
+
+ CVstPluginManager *pManager = theApp.GetPluginManager();
+ bool bOk = false;
+
+ PVSTPLUGINLIB plugLib = NULL;
+ for(size_t counter = 0; counter < files.filenames.size(); counter++)
{
- CVstPluginManager *pManager = theApp.GetPluginManager();
- pszFileNames[MAX_FILEOPEN_BUFSIZE-1] = 0;
- POSITION pos = dlg.GetStartPosition();
- BOOL bOk = FALSE;
-
- int n = 0;
- PVSTPLUGINLIB plugLib = NULL;
- while (pos != NULL) {
- CString sFilename = dlg.GetNextPathName(pos);
- if (!n) {
- CMainFrame::SetWorkingDirectory(sFilename, DIR_PLUGINS, true);
- }
- n++;
+ CString sFilename = files.filenames[counter].c_str();
- if (pManager) {
- plugLib = pManager->AddPlugin(sFilename, FALSE);
- if (plugLib) {
- bOk = TRUE;
- }
- }
+ if (pManager) {
+ plugLib = pManager->AddPlugin(sFilename, FALSE);
+ if (plugLib) bOk = true;
}
- if (bOk) {
- UpdatePluginsList(plugLib->dwPluginId2); //force selection to last added plug.
- } else {
- MessageBox("At least one selected file was not a valid VST-Plugin", NULL, MB_ICONERROR|MB_OK);
- }
}
- dlg.m_ofn.lpstrFile = NULL;
- dlg.m_ofn.nMaxFile = 0;
- delete[] pszFileNames;
+ if (bOk) {
+ UpdatePluginsList(plugLib->dwPluginId2); //force selection to last added plug.
+ } else {
+ MessageBox("At least one selected file was not a valid VST-Plugin", NULL, MB_ICONERROR|MB_OK);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-17 21:42:57
|
Revision: 443
http://modplug.svn.sourceforge.net/modplug/?rev=443&view=rev
Author: saga-games
Date: 2009-12-17 21:42:45 +0000 (Thu, 17 Dec 2009)
Log Message:
-----------
[Fix] Sample Editor: When going down close to 0 Hz in the sample editor, the sample freq wrapped around to the maximum value.
[Fix] Pattern Editor: When in sample mode, samples were never stopped when in new-style note off mode, which lead to sample jam when using long/looped samples.
[Ref] Some less important refactoring in soundlib
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-12-14 20:12:20 UTC (rev 442)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-12-17 21:42:45 UTC (rev 443)
@@ -2917,6 +2917,7 @@
{
UINT d = pSmp->nC5Speed;
if (d < 1) d = 8363;
+ if(d < m_nFinetuneStep) d = m_nFinetuneStep;
d += (pos * m_nFinetuneStep);
pSmp->nC5Speed = CLAMP(d, 1, 9999999); // 9999999 is max. in Impulse Tracker
int transp = CSoundFile::FrequencyToTranspose(pSmp->nC5Speed) >> 7;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-14 20:12:20 UTC (rev 442)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-17 21:42:45 UTC (rev 443)
@@ -3929,10 +3929,7 @@
}
else
{
- if(CMainFrame::m_dwPatternSetup & PATTERN_NOTEFADE)
- pModDoc->NoteOff(note, TRUE, ins, GetChanFromCursor(m_dwCursor));
- else
- pModDoc->NoteOff(note, FALSE, ins, GetChanFromCursor(m_dwCursor));
+ pModDoc->NoteOff(note, ((CMainFrame::m_dwPatternSetup & PATTERN_NOTEFADE) || pSndFile->GetNumInstruments() == 0) ? TRUE : FALSE, ins, GetChanFromCursor(m_dwCursor));
}
}
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-14 20:12:20 UTC (rev 442)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-17 21:42:45 UTC (rev 443)
@@ -1310,10 +1310,10 @@
// Note Cut/Off/Fade => ignore instrument
if (note >= NOTE_MIN_SPECIAL) instr = 0;
- if ((note) && (note <= 128)) pChn->nNewNote = note;
+ if ((note) && (note <= NOTE_MAX)) pChn->nNewNote = note;
// New Note Action ?
- if ((note) && (note <= 128) && (!bPorta))
+ if ((note) && (note <= NOTE_MAX) && (!bPorta))
{
CheckNNA(nChn, instr, note, FALSE);
}
@@ -2550,11 +2550,7 @@
if((m_nType & MOD_TYPE_MOD) != 0) // MOD: Invert Loop
{
pChn->nEFxSpeed = param;
- if(m_dwSongFlags & SONG_FIRSTTICK)
- {
- //if((pChn->nRowInstr != 0) && (m_nTickCount == 0)) pChn->nEFxOffset = 0; // reset offset (except when in pattern delay) TODO
- InvertLoop(pChn);
- }
+ if(m_dwSongFlags & SONG_FIRSTTICK) InvertLoop(pChn);
}
else // XM: Set Active Midi Macro
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-14 20:12:37
|
Revision: 442
http://modplug.svn.sourceforge.net/modplug/?rev=442&view=rev
Author: saga-games
Date: 2009-12-14 20:12:20 +0000 (Mon, 14 Dec 2009)
Log Message:
-----------
Added muParser (http://muparser.sourceforge.net/) to repository. To be used with upcoming new features.
Added Paths:
-----------
trunk/OpenMPT/muParser/
trunk/OpenMPT/muParser/License.txt
trunk/OpenMPT/muParser/Makefile.in
trunk/OpenMPT/muParser/build/
trunk/OpenMPT/muParser/build/autoconf/
trunk/OpenMPT/muParser/build/autoconf/aclocal.m4
trunk/OpenMPT/muParser/build/autoconf/acregen.sh
trunk/OpenMPT/muParser/build/autoconf/autoconf_inc.m4
trunk/OpenMPT/muParser/build/autoconf/bakefile-presets.m4
trunk/OpenMPT/muParser/build/autoconf/config.guess
trunk/OpenMPT/muParser/build/autoconf/config.sub
trunk/OpenMPT/muParser/build/autoconf/configure.ac
trunk/OpenMPT/muParser/build/autoconf/install-sh
trunk/OpenMPT/muParser/build/autoconf/muparser.pc.in
trunk/OpenMPT/muParser/build/makefile.bcc
trunk/OpenMPT/muParser/build/makefile.mingw
trunk/OpenMPT/muParser/build/makefile.vc
trunk/OpenMPT/muParser/build/makefile.wat
trunk/OpenMPT/muParser/build/msvc8/
trunk/OpenMPT/muParser/build/msvc8/muparser_dynamic.sln
trunk/OpenMPT/muParser/build/msvc8/muparser_example1.dsp
trunk/OpenMPT/muParser/build/msvc8/muparser_example1.vcproj
trunk/OpenMPT/muParser/build/msvc8/muparser_example3.dsp
trunk/OpenMPT/muParser/build/msvc8/muparser_example3.vcproj
trunk/OpenMPT/muParser/build/msvc8/muparser_muParser.dsp
trunk/OpenMPT/muParser/build/msvc8/muparser_muParser.vcproj
trunk/OpenMPT/muParser/build/msvc8/muparser_static.sln
trunk/OpenMPT/muParser/build/msvc9/
trunk/OpenMPT/muParser/build/msvc9/muparser_dynamic.sln
trunk/OpenMPT/muParser/build/msvc9/muparser_example1.dsp
trunk/OpenMPT/muParser/build/msvc9/muparser_example1.vcproj
trunk/OpenMPT/muParser/build/msvc9/muparser_example3.dsp
trunk/OpenMPT/muParser/build/msvc9/muparser_example3.vcproj
trunk/OpenMPT/muParser/build/msvc9/muparser_muParser.dsp
trunk/OpenMPT/muParser/build/msvc9/muparser_muParser.vcproj
trunk/OpenMPT/muParser/build/msvc9/muparser_static.sln
trunk/OpenMPT/muParser/build/obj/
trunk/OpenMPT/muParser/build/obj/Readme.txt
trunk/OpenMPT/muParser/build/obj/bcc_obj/
trunk/OpenMPT/muParser/build/obj/bcc_obj/Readme.txt
trunk/OpenMPT/muParser/configure
trunk/OpenMPT/muParser/include/
trunk/OpenMPT/muParser/include/muParser.h
trunk/OpenMPT/muParser/include/muParserBase.h
trunk/OpenMPT/muParser/include/muParserBytecode.h
trunk/OpenMPT/muParser/include/muParserCallback.h
trunk/OpenMPT/muParser/include/muParserComplex.h
trunk/OpenMPT/muParser/include/muParserDef.h
trunk/OpenMPT/muParser/include/muParserError.h
trunk/OpenMPT/muParser/include/muParserFixes.h
trunk/OpenMPT/muParser/include/muParserInt.h
trunk/OpenMPT/muParser/include/muParserStack.h
trunk/OpenMPT/muParser/include/muParserTest.h
trunk/OpenMPT/muParser/include/muParserToken.h
trunk/OpenMPT/muParser/include/muParserTokenReader.h
trunk/OpenMPT/muParser/lib/
trunk/OpenMPT/muParser/lib/Readme.txt
trunk/OpenMPT/muParser/src/
trunk/OpenMPT/muParser/src/muParser.cpp
trunk/OpenMPT/muParser/src/muParserBase.cpp
trunk/OpenMPT/muParser/src/muParserBytecode.cpp
trunk/OpenMPT/muParser/src/muParserCallback.cpp
trunk/OpenMPT/muParser/src/muParserComplex.cpp
trunk/OpenMPT/muParser/src/muParserError.cpp
trunk/OpenMPT/muParser/src/muParserInt.cpp
trunk/OpenMPT/muParser/src/muParserTest.cpp
trunk/OpenMPT/muParser/src/muParserTokenReader.cpp
Added: trunk/OpenMPT/muParser/License.txt
===================================================================
--- trunk/OpenMPT/muParser/License.txt (rev 0)
+++ trunk/OpenMPT/muParser/License.txt 2009-12-14 20:12:20 UTC (rev 442)
@@ -0,0 +1,28 @@
+
+ __________
+ _____ __ __\______ \_____ _______ ______ ____ _______
+ / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
+ | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
+ |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
+ \/ \/ \/ \/
+
+ Version 1.27
+
+ Copyright (C) 2004-2006 Ingo Berg (ingo_berg{at}gmx.de)
+
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify,
+ merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ OR OTHER DEALINGS IN THE SOFTWARE.
Added: trunk/OpenMPT/muParser/Makefile.in
===================================================================
--- trunk/OpenMPT/muParser/Makefile.in (rev 0)
+++ trunk/OpenMPT/muParser/Makefile.in 2009-12-14 20:12:20 UTC (rev 442)
@@ -0,0 +1,345 @@
+# =========================================================================
+# This makefile was generated by
+# Bakefile 0.2.1 (http://bakefile.sourceforge.net)
+# Do not modify, all changes will be overwritten!
+# =========================================================================
+
+
+@MAKE_SET@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+INSTALL = @INSTALL@
+SHARED_LD_CXX = @SHARED_LD_CXX@
+LIBEXT = @LIBEXT@
+LIBPREFIX = @LIBPREFIX@
+SO_SUFFIX = @SO_SUFFIX@
+DLLIMP_SUFFIX = @DLLIMP_SUFFIX@
+EXEEXT = @EXEEXT@
+LN_S = @LN_S@
+SETFILE = @SETFILE@
+PIC_FLAG = @PIC_FLAG@
+SONAME_FLAG = @SONAME_FLAG@
+STRIP = @STRIP@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_DIR = @INSTALL_DIR@
+BK_DEPS = @BK_DEPS@
+srcdir = @srcdir@
+top_builddir = @top_builddir@
+libdir = @libdir@
+DLLPREFIX = @DLLPREFIX@
+LIBS = @LIBS@
+AR = @AR@
+AROPTIONS = @AROPTIONS@
+RANLIB = @RANLIB@
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+
+### Variables: ###
+
+DESTDIR =
+MUPARSER_LIB_CXXFLAGS = $(____DEBUG) $(____SHARED) $(____SHARED_0) \
+ -I$(srcdir)/include $(CPPFLAGS) $(CXXFLAGS)
+MUPARSER_LIB_OBJECTS = \
+ muParser_lib_muParserBytecode.o \
+ muParser_lib_muParserTest.o \
+ muParser_lib_muParser.o \
+ muParser_lib_muParserDLL.o \
+ muParser_lib_muParserInt.o \
+ muParser_lib_muParserTokenReader.o \
+ muParser_lib_muParserError.o \
+ muParser_lib_muParserCallback.o \
+ muParser_lib_muParserBase.o
+MUPARSER_LIB_HEADERS = \
+ include/muParserError.h \
+ include/muParserFixes.h \
+ include/muParserStack.h \
+ include/muParserBytecode.h \
+ include/muParserToken.h \
+ include/muParserBase.h \
+ include/muParserTest.h \
+ include/muParserTokenReader.h \
+ include/muParserCallback.h \
+ include/muParser.h \
+ include/muParserDLL.h \
+ include/muParserDef.h \
+ include/muParserInt.h
+MUPARSER_DLL_CXXFLAGS = $(____DEBUG) $(____SHARED) $(____SHARED_0) \
+ -I$(srcdir)/include $(PIC_FLAG) $(CPPFLAGS) $(CXXFLAGS)
+MUPARSER_DLL_OBJECTS = \
+ muParser_dll_muParserBytecode.o \
+ muParser_dll_muParserTest.o \
+ muParser_dll_muParser.o \
+ muParser_dll_muParserDLL.o \
+ muParser_dll_muParserInt.o \
+ muParser_dll_muParserTokenReader.o \
+ muParser_dll_muParserError.o \
+ muParser_dll_muParserCallback.o \
+ muParser_dll_muParserBase.o
+MUPARSER_DLL_HEADERS = \
+ include/muParserError.h \
+ include/muParserFixes.h \
+ include/muParserStack.h \
+ include/muParserBytecode.h \
+ include/muParserToken.h \
+ include/muParserBase.h \
+ include/muParserTest.h \
+ include/muParserTokenReader.h \
+ include/muParserCallback.h \
+ include/muParser.h \
+ include/muParserDLL.h \
+ include/muParserDef.h \
+ include/muParserInt.h
+EXAMPLE1_CXXFLAGS = $(____DEBUG) -I$(srcdir)/include $(CPPFLAGS) $(CXXFLAGS)
+EXAMPLE1_OBJECTS = \
+ example1_Example1.o
+
+### Conditionally set variables: ###
+
+@COND_DEPS_TRACKING_0@CXXC = $(CXX)
+@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
+@COND_DEBUG_0@DEBUG_BUILD_POSTFIX =
+@COND_DEBUG_1@DEBUG_BUILD_POSTFIX = d
+@COND_SHARED_0@__muParser_lib___depname = \
+@COND_SHARED_0@ $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
+@COND_SHARED_0@__install_muParser_lib___depname = install_muParser_lib
+@COND_SHARED_0@__uninstall_muParser_lib___depname = uninstall_muParser_lib
+@COND_SHARED_0@__install_muParser_lib_headers___depname = \
+@COND_SHARED_0@ install_muParser_lib_headers
+@COND_SHARED_0@__uninstall_muParser_lib_headers___depname = \
+@COND_SHARED_0@ uninstall_muParser_lib_headers
+COND_SHARED_1___muParser_dll___depname = \
+ $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
+@COND_SHARED_1@__muParser_dll___depname = $(COND_SHARED_1___muParser_dll___depname)
+@COND_SHARED_1@__install_muParser_dll___depname = install_muParser_dll
+@COND_SHARED_1@__uninstall_muParser_dll___depname = uninstall_muParser_dll
+COND_PLATFORM_MACOSX_1___muParser_dll___macinstnamecmd = -install_name \
+ $(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2)
+@COND_PLATFORM_MACOSX_1@__muParser_dll___macinstnamecmd = $(COND_PLATFORM_MACOSX_1___muParser_dll___macinstnamecmd)
+@COND_SHARED_1@__install_muParser_dll_headers___depname = \
+@COND_SHARED_1@ install_muParser_dll_headers
+@COND_SHARED_1@__uninstall_muParser_dll_headers___depname = \
+@COND_SHARED_1@ uninstall_muParser_dll_headers
+COND_PLATFORM_OS2_1___muParser_dll___importlib = -import \
+ $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
+@COND_PLATFORM_OS2_1@__muParser_dll___importlib = $(COND_PLATFORM_OS2_1___muParser_dll___importlib)
+COND_WINDOWS_IMPLIB_1___muParser_dll___importlib = \
+ -Wl,--out-implib=$(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
+@COND_WINDOWS_IMPLIB_1@__muParser_dll___importlib = $(COND_WINDOWS_IMPLIB_1___muParser_dll___importlib)
+@COND_PLATFORM_MACOSX_0_USE_SOVERSION_1@__muParser_dll___targetsuf2 \
+@COND_PLATFORM_MACOSX_0_USE_SOVERSION_1@ = .$(SO_SUFFIX).0
+@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@__muParser_dll___targetsuf2 \
+@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@ = .0.$(SO_SUFFIX)
+@COND_USE_SOVERSION_0@__muParser_dll___targetsuf2 = .$(SO_SUFFIX)
+@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@__muParser_dll___targetsuf3 \
+@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ = \
+@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ .$(SO_SUFFIX).0.0.0
+@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@__muParser_dll___targetsuf3 \
+@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@ = .0.0.0.$(SO_SUFFIX)
+@COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1@__muParser_dll___targetsuf3 \
+@COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1@ = -0.$(SO_SUFFIX)
+@COND_USE_SOVERSION_0@__muParser_dll___targetsuf3 = .$(SO_SUFFIX)
+COND_USE_SOVERLINUX_1___muParser_dll___soname_flags = \
+ $(SONAME_FLAG)$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2)
+@COND_USE_SOVERLINUX_1@__muParser_dll___soname_flags = $(COND_USE_SOVERLINUX_1___muParser_dll___soname_flags)
+COND_USE_SOVERSOLARIS_1___muParser_dll___soname_flags = \
+ $(SONAME_FLAG)$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
+@COND_USE_SOVERSOLARIS_1@__muParser_dll___soname_flags = $(COND_USE_SOVERSOLARIS_1___muParser_dll___soname_flags)
+COND_USE_SOSYMLINKS_1___muParser_dll___so_symlinks_cmd = (cd \
+ $(top_builddir)/lib/; rm -f \
+ $(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
+ $(LN_S) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
+ $(LN_S) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2) \
+ $(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX))
+@COND_USE_SOSYMLINKS_1@__muParser_dll___so_symlinks_cmd = $(COND_USE_SOSYMLINKS_1___muParser_dll___so_symlinks_cmd)
+COND_USE_SOSYMLINKS_1___muParser_dll___so_symlinks_inst_cmd = rm -f \
+ $(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
+ $(LN_S) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
+ $(LN_S) \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2) \
+ $(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
+@COND_USE_SOSYMLINKS_1@__muParser_dll___so_symlinks_inst_cmd = $(COND_USE_SOSYMLINKS_1___muParser_dll___so_symlinks_inst_cmd)
+COND_USE_SOSYMLINKS_1___muParser_dll___so_symlinks_uninst_cmd = rm -f \
+ $(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2) \
+ $(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
+@COND_USE_SOSYMLINKS_1@__muParser_dll___so_symlinks_uninst_cmd = $(COND_USE_SOSYMLINKS_1___muParser_dll___so_symlinks_uninst_cmd)
+@COND_PLATFORM_MACOSX_1@__muParser_dll___macver = \
+@COND_PLATFORM_MACOSX_1@ -compatibility_version 1 -current_version 1
+@COND_SAMPLES_1@__example1___depname = \
+@COND_SAMPLES_1@ $(top_builddir)/samples/example1/example1$(EXEEXT)
+@COND_PLATFORM_MAC_1@__example1___mac_setfilecmd = \
+@COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL \
+@COND_PLATFORM_MAC_1@ $(top_builddir)/samples/example1/example1$(EXEEXT)
+@COND_SHARED_0@____SHARED =
+@COND_SHARED_1@____SHARED = -DMUPARSER_DLL
+@COND_SHARED_0@____SHARED_0 =
+@COND_SHARED_1@____SHARED_0 = -DMUPARSERLIB_EXPORTS
+@COND_DEBUG_0@____DEBUG = -DNDEBUG
+@COND_DEBUG_1@____DEBUG =
+
+### Targets: ###
+
+all: $(__muParser_lib___depname) $(__muParser_dll___depname) $(__example1___depname)
+
+install: all $(__install_muParser_lib___depname) $(__install_muParser_lib_headers___depname) $(__install_muParser_dll___depname) $(__install_muParser_dll_headers___depname)
+ $(INSTALL_DIR) $(libdir)/pkgconfig
+ $(INSTALL_DATA) build/autoconf/muparser.pc $(libdir)/pkgconfig
+
+uninstall: $(__uninstall_muParser_lib___depname) $(__uninstall_muParser_lib_headers___depname) $(__uninstall_muParser_dll___depname) $(__uninstall_muParser_dll_headers___depname)
+
+install-strip: install
+ $(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
+
+clean:
+ rm -rf ./.deps ./.pch
+ rm -f ./*.o
+ rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
+ rm -f $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
+ rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
+ rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2)
+ rm -f $(top_builddir)/samples/example1/example1$(EXEEXT)
+
+distclean: clean
+ rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
+ rm -f build/autoconf/muparser.pc
+
+@COND_SHARED_0@$(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT): $(MUPARSER_LIB_OBJECTS)
+@COND_SHARED_0@ rm -f $@
+@COND_SHARED_0@ $(AR) $(AROPTIONS) $@ $(MUPARSER_LIB_OBJECTS)
+@COND_SHARED_0@ $(RANLIB) $@
+
+@COND_SHARED_0@install_muParser_lib:
+@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+@COND_SHARED_0@ $(INSTALL_DATA) $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT) $(DESTDIR)$(libdir)
+
+@COND_SHARED_0@uninstall_muParser_lib:
+@COND_SHARED_0@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
+
+@COND_SHARED_0@install_muParser_lib_headers:
+@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix)
+@COND_SHARED_0@ for f in $(MUPARSER_LIB_HEADERS); do \
+@COND_SHARED_0@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \
+@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix)/`dirname $$f`; \
+@COND_SHARED_0@ fi; \
+@COND_SHARED_0@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \
+@COND_SHARED_0@ done
+
+@COND_SHARED_0@uninstall_muParser_lib_headers:
+@COND_SHARED_0@ for f in $(MUPARSER_LIB_HEADERS); do \
+@COND_SHARED_0@ rm -f $(DESTDIR)$(prefix)/$$f; \
+@COND_SHARED_0@ done
+
+@COND_SHARED_1@$(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3): $(MUPARSER_DLL_OBJECTS)
+@COND_SHARED_1@ $(SHARED_LD_CXX) $@ $(MUPARSER_DLL_OBJECTS) $(LDFLAGS) $(__muParser_dll___macinstnamecmd) $(__muParser_dll___importlib) $(__muParser_dll___soname_flags) $(__muParser_dll___macver) $(LIBS)
+@COND_SHARED_1@
+@COND_SHARED_1@ $(__muParser_dll___so_symlinks_cmd)
+
+@COND_SHARED_1@install_muParser_dll:
+@COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+@COND_SHARED_1@ $(INSTALL_DATA) $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) $(DESTDIR)$(libdir)
+@COND_SHARED_1@ $(INSTALL_PROGRAM) $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) $(DESTDIR)$(libdir)
+@COND_SHARED_1@ (cd $(DESTDIR)$(libdir) ; $(__muParser_dll___so_symlinks_inst_cmd))
+
+@COND_SHARED_1@uninstall_muParser_dll:
+@COND_SHARED_1@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
+@COND_SHARED_1@ rm -f $(DESTDIR)$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
+@COND_SHARED_1@ (cd $(DESTDIR)$(libdir) ; $(__muParser_dll___so_symlinks_uninst_cmd))
+
+@COND_SHARED_1@install_muParser_dll_headers:
+@COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(prefix)
+@COND_SHARED_1@ for f in $(MUPARSER_DLL_HEADERS); do \
+@COND_SHARED_1@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \
+@COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(prefix)/`dirname $$f`; \
+@COND_SHARED_1@ fi; \
+@COND_SHARED_1@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \
+@COND_SHARED_1@ done
+
+@COND_SHARED_1@uninstall_muParser_dll_headers:
+@COND_SHARED_1@ for f in $(MUPARSER_DLL_HEADERS); do \
+@COND_SHARED_1@ rm -f $(DESTDIR)$(prefix)/$$f; \
+@COND_SHARED_1@ done
+
+@COND_SAMPLES_1@$(top_builddir)/samples/example1/example1$(EXEEXT): $(EXAMPLE1_OBJECTS) $(__muParser_lib___depname)
+@COND_SAMPLES_1@ $(CXX) -o $@ $(EXAMPLE1_OBJECTS) -L$(top_builddir)/lib $(LDFLAGS) -L$(srcdir)/lib $(LIBS) -lmuparser$(DEBUG_BUILD_POSTFIX)
+@COND_SAMPLES_1@
+@COND_SAMPLES_1@ $(__example1___mac_setfilecmd)
+
+lib: $(__muParser_lib___depname) $(__muParser_dll___depname)
+
+samples: $(__example1___depname)
+
+documentation:
+ ( cd $(srcdir)/docs && doxygen )
+
+muParser_lib_muParserBytecode.o: $(srcdir)/src/muParserBytecode.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserBytecode.cpp
+
+muParser_lib_muParserTest.o: $(srcdir)/src/muParserTest.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserTest.cpp
+
+muParser_lib_muParser.o: $(srcdir)/src/muParser.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParser.cpp
+
+muParser_lib_muParserDLL.o: $(srcdir)/src/muParserDLL.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserDLL.cpp
+
+muParser_lib_muParserInt.o: $(srcdir)/src/muParserInt.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserInt.cpp
+
+muParser_lib_muParserTokenReader.o: $(srcdir)/src/muParserTokenReader.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserTokenReader.cpp
+
+muParser_lib_muParserError.o: $(srcdir)/src/muParserError.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserError.cpp
+
+muParser_lib_muParserCallback.o: $(srcdir)/src/muParserCallback.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserCallback.cpp
+
+muParser_lib_muParserBase.o: $(srcdir)/src/muParserBase.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserBase.cpp
+
+muParser_dll_muParserBytecode.o: $(srcdir)/src/muParserBytecode.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserBytecode.cpp
+
+muParser_dll_muParserTest.o: $(srcdir)/src/muParserTest.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserTest.cpp
+
+muParser_dll_muParser.o: $(srcdir)/src/muParser.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParser.cpp
+
+muParser_dll_muParserDLL.o: $(srcdir)/src/muParserDLL.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserDLL.cpp
+
+muParser_dll_muParserInt.o: $(srcdir)/src/muParserInt.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserInt.cpp
+
+muParser_dll_muParserTokenReader.o: $(srcdir)/src/muParserTokenReader.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserTokenReader.cpp
+
+muParser_dll_muParserError.o: $(srcdir)/src/muParserError.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserError.cpp
+
+muParser_dll_muParserCallback.o: $(srcdir)/src/muParserCallback.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserCallback.cpp
+
+muParser_dll_muParserBase.o: $(srcdir)/src/muParserBase.cpp
+ $(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserBase.cpp
+
+example1_Example1.o: $(srcdir)/samples/example1/Example1.cpp
+ $(CXXC) -c -o $@ $(EXAMPLE1_CXXFLAGS) $(srcdir)/samples/example1/Example1.cpp
+
+
+# Include dependency info, if present:
+@IF_GNU_MAKE@-include .deps/*.d
+
+.PHONY: all install uninstall clean distclean install_muParser_lib uninstall_muParser_lib install_muParser_lib_headers uninstall_muParser_lib_headers install_muParser_dll uninstall_muParser_dll install_muParser_dll_headers uninstall_muParser_dll_headers lib samples
Added: trunk/OpenMPT/muParser/build/autoconf/aclocal.m4
===================================================================
--- trunk/OpenMPT/muParser/build/autoconf/aclocal.m4 (rev 0)
+++ trunk/OpenMPT/muParser/build/autoconf/aclocal.m4 2009-12-14 20:12:20 UTC (rev 442)
@@ -0,0 +1,1593 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+dnl ---------------------------------------------------------------------------
+dnl Support macros for makefiles generated by BAKEFILE.
+dnl ---------------------------------------------------------------------------
+
+dnl Lots of compiler & linker detection code contained here was taken from
+dnl wxWindows configure.in script (see http://www.wxwindows.org)
+
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_GNUMAKE
+dnl
+dnl Detects GNU make
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_GNUMAKE],
+[
+ dnl does make support "-include" (only GNU make does AFAIK)?
+ AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
+ [
+ if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
+ egrep -s GNU > /dev/null); then
+ bakefile_cv_prog_makeisgnu="yes"
+ else
+ bakefile_cv_prog_makeisgnu="no"
+ fi
+ ])
+
+ if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
+ IF_GNU_MAKE=""
+ else
+ IF_GNU_MAKE="#"
+ fi
+ AC_SUBST(IF_GNU_MAKE)
+])
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_PLATFORM
+dnl
+dnl Detects platform and sets PLATFORM_XXX variables accordingly
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_PLATFORM],
+[
+ PLATFORM_UNIX=0
+ PLATFORM_WIN32=0
+ PLATFORM_MSDOS=0
+ PLATFORM_MAC=0
+ PLATFORM_MACOS=0
+ PLATFORM_MACOSX=0
+ PLATFORM_OS2=0
+ PLATFORM_BEOS=0
+
+ if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
+ case "${BAKEFILE_HOST}" in
+ *-*-mingw32* )
+ PLATFORM_WIN32=1
+ ;;
+ *-pc-msdosdjgpp )
+ PLATFORM_MSDOS=1
+ ;;
+ *-pc-os2_emx | *-pc-os2-emx )
+ PLATFORM_OS2=1
+ ;;
+ *-*-darwin* )
+ PLATFORM_MAC=1
+ PLATFORM_MACOSX=1
+ ;;
+ *-*-beos* )
+ PLATFORM_BEOS=1
+ ;;
+ powerpc-apple-macos* )
+ PLATFORM_MAC=1
+ PLATFORM_MACOS=1
+ ;;
+ * )
+ PLATFORM_UNIX=1
+ ;;
+ esac
+ else
+ case "$BAKEFILE_FORCE_PLATFORM" in
+ win32 )
+ PLATFORM_WIN32=1
+ ;;
+ msdos )
+ PLATFORM_MSDOS=1
+ ;;
+ os2 )
+ PLATFORM_OS2=1
+ ;;
+ darwin )
+ PLATFORM_MAC=1
+ PLATFORM_MACOSX=1
+ ;;
+ unix )
+ PLATFORM_UNIX=1
+ ;;
+ beos )
+ PLATFORM_BEOS=1
+ ;;
+ * )
+ AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
+ ;;
+ esac
+ fi
+
+ AC_SUBST(PLATFORM_UNIX)
+ AC_SUBST(PLATFORM_WIN32)
+ AC_SUBST(PLATFORM_MSDOS)
+ AC_SUBST(PLATFORM_MAC)
+ AC_SUBST(PLATFORM_MACOS)
+ AC_SUBST(PLATFORM_MACOSX)
+ AC_SUBST(PLATFORM_OS2)
+ AC_SUBST(PLATFORM_BEOS)
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_PLATFORM_SPECIFICS
+dnl
+dnl Sets misc platform-specific settings
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
+[
+ AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
+ [use OMF object format (OS/2)]),
+ [bk_os2_use_omf="$enableval"])
+
+ case "${BAKEFILE_HOST}" in
+ *-*-darwin* )
+ dnl For Unix to MacOS X porting instructions, see:
+ dnl http://fink.sourceforge.net/doc/porting/porting.html
+ if test "x$GCC" = "xyes"; then
+ CFLAGS="$CFLAGS -fno-common"
+ CXXFLAGS="$CXXFLAGS -fno-common"
+ fi
+ if test "x$XLCC" = "xyes"; then
+ CFLAGS="$CFLAGS -qnocommon"
+ CXXFLAGS="$CXXFLAGS -qnocommon"
+ fi
+ ;;
+
+ *-pc-os2_emx | *-pc-os2-emx )
+ if test "x$bk_os2_use_omf" = "xyes" ; then
+ AR=emxomfar
+ RANLIB=:
+ LDFLAGS="-Zomf $LDFLAGS"
+ CFLAGS="-Zomf $CFLAGS"
+ CXXFLAGS="-Zomf $CXXFLAGS"
+ OS2_LIBEXT="lib"
+ else
+ OS2_LIBEXT="a"
+ fi
+ ;;
+
+ i*86-*-beos* )
+ LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
+ ;;
+ esac
+])
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_SUFFIXES
+dnl
+dnl Detects shared various suffixes for shared libraries, libraries, programs,
+dnl plugins etc.
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_SUFFIXES],
+[
+ SO_SUFFIX="so"
+ SO_SUFFIX_MODULE="so"
+ EXEEXT=""
+ LIBPREFIX="lib"
+ LIBEXT=".a"
+ DLLPREFIX="lib"
+ DLLPREFIX_MODULE=""
+ DLLIMP_SUFFIX=""
+ dlldir="$libdir"
+
+ case "${BAKEFILE_HOST}" in
+ *-hp-hpux* )
+ SO_SUFFIX="sl"
+ SO_SUFFIX_MODULE="sl"
+ ;;
+ *-*-aix* )
+ dnl quoting from
+ dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
+ dnl Both archive libraries and shared libraries on AIX have an
+ dnl .a extension. This will explain why you can't link with an
+ dnl .so and why it works with the name changed to .a.
+ SO_SUFFIX="a"
+ SO_SUFFIX_MODULE="a"
+ ;;
+ *-*-cygwin* )
+ SO_SUFFIX="dll"
+ SO_SUFFIX_MODULE="dll"
+ DLLIMP_SUFFIX="dll.a"
+ EXEEXT=".exe"
+ DLLPREFIX="cyg"
+ dlldir="$bindir"
+ ;;
+ *-*-mingw32* )
+ SO_SUFFIX="dll"
+ SO_SUFFIX_MODULE="dll"
+ DLLIMP_SUFFIX="dll.a"
+ EXEEXT=".exe"
+ DLLPREFIX=""
+ dlldir="$bindir"
+ ;;
+ *-pc-msdosdjgpp )
+ EXEEXT=".exe"
+ DLLPREFIX=""
+ dlldir="$bindir"
+ ;;
+ *-pc-os2_emx | *-pc-os2-emx )
+ SO_SUFFIX="dll"
+ SO_SUFFIX_MODULE="dll"
+ DLLIMP_SUFFIX=$OS2_LIBEXT
+ EXEEXT=".exe"
+ DLLPREFIX=""
+ LIBPREFIX=""
+ LIBEXT=".$OS2_LIBEXT"
+ dlldir="$bindir"
+ ;;
+ *-*-darwin* )
+ SO_SUFFIX="dylib"
+ SO_SUFFIX_MODULE="bundle"
+ ;;
+ esac
+
+ if test "x$DLLIMP_SUFFIX" = "x" ; then
+ DLLIMP_SUFFIX="$SO_SUFFIX"
+ fi
+
+ AC_SUBST(SO_SUFFIX)
+ AC_SUBST(SO_SUFFIX_MODULE)
+ AC_SUBST(DLLIMP_SUFFIX)
+ AC_SUBST(EXEEXT)
+ AC_SUBST(LIBPREFIX)
+ AC_SUBST(LIBEXT)
+ AC_SUBST(DLLPREFIX)
+ AC_SUBST(DLLPREFIX_MODULE)
+ AC_SUBST(dlldir)
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_SHARED_LD
+dnl
+dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
+dnl and SHARED_LD_CXX.
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_SHARED_LD],
+[
+ dnl the extra compiler flags needed for compilation of shared library
+ PIC_FLAG=""
+ if test "x$GCC" = "xyes"; then
+ dnl the switch for gcc is the same under all platforms
+ PIC_FLAG="-fPIC"
+ fi
+
+ dnl Defaults for GCC and ELF .so shared libs:
+ SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
+ SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
+ WINDOWS_IMPLIB=0
+
+ case "${BAKEFILE_HOST}" in
+ *-hp-hpux* )
+ dnl default settings are good for gcc but not for the native HP-UX
+ if test "x$GCC" != "xyes"; then
+ dnl no idea why it wants it, but it does
+ LDFLAGS="$LDFLAGS -L/usr/lib"
+
+ SHARED_LD_CC="${CC} -b -o"
+ SHARED_LD_CXX="${CXX} -b -o"
+ PIC_FLAG="+Z"
+ fi
+ ;;
+
+ *-*-linux* )
+ if test "x$GCC" != "xyes"; then
+ AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
+ [
+ AC_TRY_COMPILE([],
+ [
+ #ifndef __INTEL_COMPILER
+ This is not ICC
+ #endif
+ ],
+ bakefile_cv_prog_icc=yes,
+ bakefile_cv_prog_icc=no
+ )
+ ])
+ if test "$bakefile_cv_prog_icc" = "yes"; then
+ PIC_FLAG="-KPIC"
+ fi
+ fi
+ ;;
+
+ *-*-solaris2* )
+ if test "x$GCC" != xyes ; then
+ SHARED_LD_CC="${CC} -G -o"
+ SHARED_LD_CXX="${CXX} -G -o"
+ PIC_FLAG="-KPIC"
+ fi
+ ;;
+
+ *-*-darwin* )
+ AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
+ chmod +x shared-ld-sh
+
+ SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
+ SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
+
+ dnl Most apps benefit from being fully binded (its faster and static
+ dnl variables initialized at startup work).
+ dnl This can be done either with the exe linker flag -Wl,-bind_at_load
+ dnl or with a double stage link in order to create a single module
+ dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
+
+ dnl If using newer dev tools then there is a -single_module flag that
+ dnl we can use to do this for dylibs, otherwise we'll need to use a helper
+ dnl script. Check the version of gcc to see which way we can go:
+ AC_CACHE_CHECK([for gcc 3.1 or later], bakefile_cv_gcc31, [
+ AC_TRY_COMPILE([],
+ [
+ #if (__GNUC__ < 3) || \
+ ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
+ This is old gcc
+ #endif
+ ],
+ [
+ bakefile_cv_gcc31=yes
+ ],
+ [
+ bakefile_cv_gcc31=no
+ ]
+ )
+ ])
+ if test "$bakefile_cv_gcc31" = "no"; then
+ dnl Use the shared-ld-sh helper script
+ SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
+ SHARED_LD_CXX="$SHARED_LD_CC"
+ else
+ dnl Use the -single_module flag and let the linker do it for us
+ SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
+ SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
+ fi
+
+ if test "x$GCC" == "xyes"; then
+ PIC_FLAG="-dynamic -fPIC"
+ fi
+ if test "x$XLCC" = "xyes"; then
+ PIC_FLAG="-dynamic -DPIC"
+ fi
+ ;;
+
+ *-*-aix* )
+ if test "x$GCC" = "xyes"; then
+ dnl at least gcc 2.95 warns that -fPIC is ignored when
+ dnl compiling each and every file under AIX which is annoying,
+ dnl so don't use it there (it's useless as AIX runs on
+ dnl position-independent architectures only anyhow)
+ PIC_FLAG=""
+
+ dnl -bexpfull is needed by AIX linker to export all symbols (by
+ dnl default it doesn't export any and even with -bexpall it
+ dnl doesn't export all C++ support symbols, e.g. vtable
+ dnl pointers) but it's only available starting from 5.1 (with
+ dnl maintenance pack 2, whatever this is), see
+ dnl http://www-128.ibm.com/developerworks/eserver/articles/gnu.html
+ case "${BAKEFILE_HOST}" in
+ *-*-aix5* )
+ LD_EXPFULL="-Wl,-bexpfull"
+ ;;
+ esac
+
+ SHARED_LD_CC="\$(CC) -shared $LD_EXPFULL -o"
+ SHARED_LD_CXX="\$(CXX) -shared $LD_EXPFULL -o"
+ else
+ dnl FIXME: makeC++SharedLib is obsolete, what should we do for
+ dnl recent AIX versions?
+ AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
+ makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
+ SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
+ SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
+ fi
+ ;;
+
+ *-*-beos* )
+ dnl can't use gcc under BeOS for shared library creation because it
+ dnl complains about missing 'main'
+ SHARED_LD_CC="${LD} -nostart -o"
+ SHARED_LD_CXX="${LD} -nostart -o"
+ ;;
+
+ *-*-irix* )
+ dnl default settings are ok for gcc
+ if test "x$GCC" != "xyes"; then
+ PIC_FLAG="-KPIC"
+ fi
+ ;;
+
+ *-*-cygwin* | *-*-mingw32* )
+ PIC_FLAG=""
+ SHARED_LD_CC="\$(CC) -shared -o"
+ SHARED_LD_CXX="\$(CXX) -shared -o"
+ WINDOWS_IMPLIB=1
+ ;;
+
+ *-pc-os2_emx | *-pc-os2-emx )
+ SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
+ SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
+ PIC_FLAG=""
+ AC_BAKEFILE_CREATE_FILE_DLLAR_SH
+ chmod +x dllar.sh
+ ;;
+
+ powerpc-apple-macos* | \
+ *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-k*bsd*-gnu | \
+ *-*-mirbsd* | \
+ *-*-sunos4* | \
+ *-*-osf* | \
+ *-*-dgux5* | \
+ *-*-sysv5* | \
+ *-pc-msdosdjgpp )
+ dnl defaults are ok
+ ;;
+
+ *)
+ AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
+ esac
+
+ if test "x$PIC_FLAG" != "x" ; then
+ PIC_FLAG="$PIC_FLAG -DPIC"
+ fi
+
+ if test "x$SHARED_LD_MODULE_CC" = "x" ; then
+ SHARED_LD_MODULE_CC="$SHARED_LD_CC"
+ fi
+ if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
+ SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
+ fi
+
+ AC_SUBST(SHARED_LD_CC)
+ AC_SUBST(SHARED_LD_CXX)
+ AC_SUBST(SHARED_LD_MODULE_CC)
+ AC_SUBST(SHARED_LD_MODULE_CXX)
+ AC_SUBST(PIC_FLAG)
+ AC_SUBST(WINDOWS_IMPLIB)
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_SHARED_VERSIONS
+dnl
+dnl Detects linker options for attaching versions (sonames) to shared libs.
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
+[
+ USE_SOVERSION=0
+ USE_SOVERLINUX=0
+ USE_SOVERSOLARIS=0
+ USE_SOVERCYGWIN=0
+ USE_SOSYMLINKS=0
+ USE_MACVERSION=0
+ SONAME_FLAG=
+
+ case "${BAKEFILE_HOST}" in
+ *-*-linux* | *-*-freebsd* | *-*-k*bsd*-gnu )
+ SONAME_FLAG="-Wl,-soname,"
+ USE_SOVERSION=1
+ USE_SOVERLINUX=1
+ USE_SOSYMLINKS=1
+ ;;
+
+ *-*-solaris2* )
+ SONAME_FLAG="-h "
+ USE_SOVERSION=1
+ USE_SOVERSOLARIS=1
+ USE_SOSYMLINKS=1
+ ;;
+
+ *-*-darwin* )
+ USE_MACVERSION=1
+ USE_SOVERSION=1
+ USE_SOSYMLINKS=1
+ ;;
+
+ *-*-cygwin* )
+ USE_SOVERSION=1
+ USE_SOVERCYGWIN=1
+ ;;
+ esac
+
+ AC_SUBST(USE_SOVERSION)
+ AC_SUBST(USE_SOVERLINUX)
+ AC_SUBST(USE_SOVERSOLARIS)
+ AC_SUBST(USE_SOVERCYGWIN)
+ AC_SUBST(USE_MACVERSION)
+ AC_SUBST(USE_SOSYMLINKS)
+ AC_SUBST(SONAME_FLAG)
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_DEPS
+dnl
+dnl Detects available C/C++ dependency tracking options
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_DEPS],
+[
+ AC_ARG_ENABLE([dependency-tracking],
+ AS_HELP_STRING([--disable-dependency-tracking],
+ [don't use dependency tracking even if the compiler can]),
+ [bk_use_trackdeps="$enableval"])
+
+ AC_MSG_CHECKING([for dependency tracking method])
+
+ BK_DEPS=""
+ if test "x$bk_use_trackdeps" = "xno" ; then
+ DEPS_TRACKING=0
+ AC_MSG_RESULT([disabled])
+ else
+ DEPS_TRACKING=1
+
+ if test "x$GCC" = "xyes"; then
+ DEPSMODE=gcc
+ case "${BAKEFILE_HOST}" in
+ *-*-darwin* )
+ dnl -cpp-precomp (the default) conflicts with -MMD option
+ dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
+ DEPSFLAG="-no-cpp-precomp -MMD"
+ ;;
+ * )
+ DEPSFLAG="-MMD"
+ ;;
+ esac
+ AC_MSG_RESULT([gcc])
+ elif test "x$MWCC" = "xyes"; then
+ DEPSMODE=mwcc
+ DEPSFLAG="-MM"
+ AC_MSG_RESULT([mwcc])
+ elif test "x$SUNCC" = "xyes"; then
+ DEPSMODE=unixcc
+ DEPSFLAG="-xM1"
+ AC_MSG_RESULT([Sun cc])
+ elif test "x$SGICC" = "xyes"; then
+ DEPSMODE=unixcc
+ DEPSFLAG="-M"
+ AC_MSG_RESULT([SGI cc])
+ elif test "x$HPCC" = "xyes"; then
+ DEPSMODE=unixcc
+ DEPSFLAG="+make"
+ AC_MSG_RESULT([HP cc])
+ elif test "x$COMPAQCC" = "xyes"; then
+ DEPSMODE=gcc
+ DEPSFLAG="-MD"
+ AC_MSG_RESULT([Compaq cc])
+ else
+ DEPS_TRACKING=0
+ AC_MSG_RESULT([none])
+ fi
+
+ if test $DEPS_TRACKING = 1 ; then
+ AC_BAKEFILE_CREATE_FILE_BK_DEPS
+ chmod +x bk-deps
+ dnl FIXME: make this $(top_builddir)/bk-deps once autoconf-2.60
+ dnl is required (and so top_builddir is never empty):
+ BK_DEPS="`pwd`/bk-deps"
+ fi
+ fi
+
+ AC_SUBST(DEPS_TRACKING)
+ AC_SUBST(BK_DEPS)
+])
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_CHECK_BASIC_STUFF
+dnl
+dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
+dnl or "install"
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
+[
+ AC_PROG_RANLIB
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+
+ AC_PROG_MAKE_SET
+ AC_SUBST(MAKE_SET)
+
+ if test "x$SUNCXX" = "xyes"; then
+ dnl Sun C++ compiler requires special way of creating static libs;
+ dnl see here for more details:
+ dnl https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1229751&group_id=9863
+ AR=$CXX
+ AC_SUBST(AR)
+ AROPTIONS="-xar -o"
+ else
+ AC_CHECK_TOOL(AR, ar, ar)
+ AROPTIONS=rcu
+ fi
+ AC_SUBST(AROPTIONS)
+
+ AC_CHECK_TOOL(STRIP, strip, :)
+ AC_CHECK_TOOL(NM, nm, :)
+
+ case ${BAKEFILE_HOST} in
+ *-hp-hpux* )
+ dnl HP-UX install doesn't handle the "-d" switch so don't
+ dnl use it there
+ INSTALL_DIR="mkdir -p"
+ ;;
+ * )
+ dnl we must refer to makefile's $(INSTALL) variable and not
+ dnl current value of shell variable, hence the single quoting:
+ INSTALL_DIR='$(INSTALL) -d'
+ ;;
+ esac
+ AC_SUBST(INSTALL_DIR)
+
+ LDFLAGS_GUI=
+ case ${BAKEFILE_HOST} in
+ *-*-cygwin* | *-*-mingw32* )
+ LDFLAGS_GUI="-mwindows"
+ esac
+ AC_SUBST(LDFLAGS_GUI)
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_RES_COMPILERS
+dnl
+dnl Checks for presence of resource compilers for win32 or mac
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
+[
+ case ${BAKEFILE_HOST} in
+ *-*-cygwin* | *-*-mingw32* )
+ dnl Check for win32 resources compiler:
+ AC_CHECK_TOOL(WINDRES, windres)
+ ;;
+
+ *-*-darwin* | powerpc-apple-macos* )
+ AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
+ AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
+ ;;
+ esac
+
+ AC_SUBST(WINDRES)
+ AC_SUBST(REZ)
+ AC_SUBST(SETFILE)
+])
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_PRECOMP_HEADERS
+dnl
+dnl Check for precompiled headers support (GCC >= 3.4)
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
+[
+
+ AC_ARG_ENABLE([precomp-headers],
+ AS_HELP_STRING([--disable-precomp-headers],
+ [don't use precompiled headers even if compiler can]),
+ [bk_use_pch="$enableval"])
+
+ GCC_PCH=0
+ ICC_PCH=0
+ USE_PCH=0
+ BK_MAKE_PCH=""
+
+ case ${BAKEFILE_HOST} in
+ *-*-cygwin* )
+ dnl PCH support is broken in cygwin gcc because of unportable
+ dnl assumptions about mmap() in gcc code which make PCH generation
+ dnl fail erratically; disable PCH completely until this is fixed
+ bk_use_pch="no"
+ ;;
+ esac
+
+ if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
+ if test "x$GCC" = "xyes"; then
+ dnl test if we have gcc-3.4:
+ AC_MSG_CHECKING([if the compiler supports precompiled headers])
+ AC_TRY_COMPILE([],
+ [
+ #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
+ There is no PCH support
+ #endif
+ #if (__GNUC__ < 3)
+ There is no PCH support
+ #endif
+ #if (__GNUC__ == 3) && \
+ ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
+ ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) || \
+ ( defined(__INTEL_COMPILER) )
+ There is no PCH support
+ #endif
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ GCC_PCH=1
+ ],
+ [
+ AC_TRY_COMPILE([],
+ [
+ #if !defined(__INTEL_COMPILER) || \
+ (__INTEL_COMPILER < 800)
+ There is no PCH support
+ #endif
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ ICC_PCH=1
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ])
+ ])
+ if test $GCC_PCH = 1 -o $ICC_PCH = 1 ; then
+ USE_PCH=1
+ AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
+ chmod +x bk-make-pch
+ dnl FIXME: make this $(top_builddir)/bk-make-pch once
+ dnl autoconf-2.60 is required (and so top_builddir is
+ dnl never empty):
+ BK_MAKE_PCH="`pwd`/bk-make-pch"
+ fi
+ fi
+ fi
+
+ AC_SUBST(GCC_PCH)
+ AC_SUBST(ICC_PCH)
+ AC_SUBST(BK_MAKE_PCH)
+])
+
+
+
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
+dnl
+dnl To be used in configure.in of any project using Bakefile-generated mks
+dnl
+dnl Behaviour can be modified by setting following variables:
+dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
+dnl to perform check for basic tools like ranlib
+dnl BAKEFILE_HOST set this to override host detection, defaults
+dnl to ${host}
+dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
+dnl
+dnl Example usage:
+dnl
+dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
+dnl
+dnl (replace FOO with m4_include above, aclocal would die otherwise)
+dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
+dnl we can do...)
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE],
+[
+ AC_PREREQ([2.58])
+
+ if test "x$BAKEFILE_HOST" = "x"; then
+ if test "x${host}" = "x" ; then
+ AC_MSG_ERROR([You must call the autoconf "CANONICAL_HOST" macro in your configure.ac (or .in) file.])
+ fi
+
+ BAKEFILE_HOST="${host}"
+ fi
+
+ if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
+ AC_BAKEFILE_CHECK_BASIC_STUFF
+ fi
+ AC_BAKEFILE_GNUMAKE
+ AC_BAKEFILE_PLATFORM
+ AC_BAKEFILE_PLATFORM_SPECIFICS
+ AC_BAKEFILE_SUFFIXES
+ AC_BAKEFILE_SHARED_LD
+ AC_BAKEFILE_SHARED_VERSIONS
+ AC_BAKEFILE_DEPS
+ AC_BAKEFILE_RES_COMPILERS
+
+ BAKEFILE_BAKEFILE_M4_VERSION="0.2.1"
+
+ dnl includes autoconf_inc.m4:
+ $1
+
+ if test "$BAKEFILE_AUTOCONF_INC_M4_VERSION" = "" ; then
+ AC_MSG_ERROR([No version found in autoconf_inc.m4 - bakefile macro was changed to take additional argument, perhaps configure.in wasn't updated (see the documentation)?])
+ fi
+
+ if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
+ AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
+ fi
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl Embedded copies of helper scripts follow:
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
+[
+dnl ===================== dllar.sh begins here =====================
+dnl (Created by merge-scripts.py from dllar.sh
+dnl file do not edit here!)
+D='$'
+cat <<EOF >dllar.sh
+#!/bin/sh
+#
+# dllar - a tool to build both a .dll and an .a file
+# from a set of object (.o) files for EMX/OS2.
+#
+# Written by Andrew Zabolotny, bi...@fr...
+# Ported to Unix like shell by Stefan Neis, Ste...@t-...
+#
+# This script will accept a set of files on the command line.
+# All the public symbols from the .o files will be exported into
+# a .DEF file, then linker will be run (through gcc) against them to
+# build a shared library consisting of all given .o files. All libraries
+# (.a) will be first decompressed into component .o files then act as
+# described above. You can optionally give a description (-d "description")
+# which will be put into .DLL. To see the list of accepted options (as well
+# as command-line format) simply run this program without options. The .DLL
+# is built to be imported by name (there is no guarantee that new versions
+# of the library you build will have same ordinals for same symbols).
+#
+# dllar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# dllar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with dllar; see the file COPYING. If not, write to the Free
+# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# To successfuly run this program you will need:
+# - Current drive should have LFN support (HPFS, ext2, network, etc)
+# (Sometimes dllar generates filenames which won't fit 8.3 scheme)
+# - gcc
+# (used to build the .dll)
+# - emxexp
+# (used to create .def file from .o files)
+# - emximp
+# (used to create .a file from .def file)
+# - GNU text utilites (cat, sort, uniq)
+# used to process emxexp output
+# - GNU file utilities (mv, rm)
+# - GNU sed
+# - lxlite (optional, see flag below)
+# (used for general .dll cleanup)
+#
+
+flag_USE_LXLITE=1;
+
+#
+# helper functions
+# basnam, variant of basename, which does _not_ remove the path, _iff_
+# second argument (suffix to remove) is given
+basnam(){
+ case ${D}# in
+ 1)
+ echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
+ ;;
+ 2)
+ echo ${D}1 | sed 's/'${D}2'${D}//'
+ ;;
+ *)
+ echo "error in basnam ${D}*"
+ exit 8
+ ;;
+ esac
+}
+
+# Cleanup temporary files and output
+CleanUp() {
+ cd ${D}curDir
+ for i in ${D}inputFiles ; do
+ case ${D}i in
+ *!)
+ rm -rf \`basnam ${D}i !\`
+ ;;
+ *)
+ ;;
+ esac
+ done
+
+ # Kill result in case of failure as there is just to many stupid make/nmake
+ # things out there which doesn't do this.
+ if @<:@ ${D}# -eq 0 @:>@; then
+ rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
+ fi
+}
+
+# Print usage and exit script with rc=1.
+PrintHelp() {
+ echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
+ echo ' @<:@-name-mangler-script script.sh@:>@'
+ echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
+ echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
+ echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
+ echo ' @<:@*.o@:>@ @<:@*.a@:>@'
+ echo '*> "output_file" should have no extension.'
+ echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
+ echo ' The import library name is derived from this and is set to "name".a,'
+ echo ' unless overridden by -import'
+ echo '*> "importlib_name" should have no extension.'
+ echo ' If it has the .o, or .a extension, it is automatically removed.'
+ echo ' This name is used as the import library name and may be longer and'
+ echo ' more descriptive than the DLL name which has to follow the old '
+ echo ' 8.3 convention of FAT.'
+ echo '*> "script.sh may be given to override the output_file name by a'
+ echo ' different name. It is mainly useful if the regular make process'
+ echo ' of some package does not take into account OS/2 restriction of'
+ echo ' DLL name lengths. It takes the importlib name as input and is'
+ echo ' supposed to procude a shorter name as output. The script should'
+ echo ' expect to get importlib_name without extension and should produce'
+ echo ' a (max.) 8 letter name without extension.'
+ echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
+ echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
+ echo ' These flags will be put at the start of GCC command line.'
+ echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
+ echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
+ echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
+ echo ' If the last character of a symbol is "*", all symbols beginning'
+ echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
+ echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
+ echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
+ echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
+ echo ' C runtime DLLs.'
+ echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
+ echo '*> All other switches (for example -L./ or -lmylib) will be passed'
+ echo ' unchanged to GCC at the end of command line.'
+ echo '*> If you create a DLL from a library and you do not specify -o,'
+ echo ' the basename for DLL and import library will be set to library name,'
+ echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
+ echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
+ echo ' library will be renamed into gcc_s.a.'
+ echo '--------'
+ echo 'Example:'
+ echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
+ echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
+ CleanUp
+ exit 1
+}
+
+# Execute a command.
+# If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
+# @Uses Whatever CleanUp() uses.
+doCommand() {
+ echo "${D}*"
+ eval ${D}*
+ rcCmd=${D}?
+
+ if @<:@ ${D}rcCmd -ne 0 @:>@; then
+ echo "command failed, exit code="${D}rcCmd
+ CleanUp
+ exit ${D}rcCmd
+ fi
+}
+
+# main routine
+# setup globals
+cmdLine=${D}*
+outFile=""
+outimpFile=""
+inputFiles=""
+renameScript=""
+description=""
+CC=gcc.exe
+CFLAGS="-s -Zcrtdll"
+EXTRA_CFLAGS=""
+EXPORT_BY_ORDINALS=0
+exclude_symbols=""
+library_flags=""
+curDir=\`pwd\`
+curDirS=curDir
+case ${D}curDirS in
+*/)
+ ;;
+*)
+ curDirS=${D}{curDirS}"/"
+ ;;
+esac
+# Parse commandline
+libsToLink=0
+omfLinking=0
+while @<:@ ${D}1 @:>@; do
+ case ${D}1 in
+ -ord*)
+ EXPORT_BY_ORDINALS=1;
+ ;;
+ -o*)
+ shift
+ outFile=${D}1
+ ;;
+ -i*)
+ shift
+ outimpFile=${D}1
+ ;;
+ -name-mangler-script)
+ shift
+ renameScript=${D}1
+ ;;
+ -d*)
+ shift
+ description=${D}1
+ ;;
+ -f*)
+ shift
+ CFLAGS=${D}1
+ ;;
+ -c*)
+ shift
+ CC=${D}1
+ ;;
+ -h*)
+ PrintHelp
+ ;;
+ -ex*)
+ shift
+ exclude_symbols=${D}{exclude_symbols}${D}1" "
+ ;;
+ -libf*)
+ shift
+ library_flags=${D}{library_flags}${D}1" "
+ ;;
+ -nocrt*)
+ CFLAGS="-s"
+ ;;
+ -nolxl*)
+ flag_USE_LXLITE=0
+ ;;
+ -* | /*)
+ case ${D}1 in
+ -L* | -l*)
+ libsToLink=1
+ ;;
+ -Zomf)
+ omfLinking=1
+ ;;
+ *)
+ ;;
+ esac
+ EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
+ ;;
+ *.dll)
+ EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
+ if @<:@ ${D}omfLinking -eq 1 @:>@; then
+ EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
+ else
+ EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
+ fi
+ ;;
+ *)
+ found=0;
+ if @<:@ ${D}libsToLink -ne 0 @:>@; then
+ EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
+ else
+ for file in ${D}1 ; do
+ if @<:@ -f ${D}file @:>@; then
+ inputFiles="${D}{inputFiles} ${D}file"
+ found=1
+ fi
+ done
+ if @<:@ ${D}found -eq 0 @:>@; then
+ echo "ERROR: No file(s) found: "${D}1
+ exit 8
+ fi
+ fi
+ ;;
+ esac
+ shift
+done # iterate cmdline words
+
+#
+if @<:@ -z "${D}inputFiles" @:>@; then
+ echo "dllar: no input files"
+ PrintHelp
+fi
+
+# Now extract all .o files from .a files
+newInputFiles=""
+for file in ${D}inputFiles ; do
+ case ${D}file in
+ *.a | *.lib)
+ case ${D}file in
+ *.a)
+ suffix=".a"
+ AR="ar"
+ ;;
+ *.lib)
+ suffix=".lib"
+ AR="emxomfar"
+ EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
+ ;;
+ *)
+ ;;
+ esac
+ dirname=\`basnam ${D}file ${D}suffix\`"_%"
+ mkdir ${D}dirname
+ if @<:@ ${D}? -ne 0 @:>@; then
+ echo "Failed to create subdirectory ./${D}dirname"
+ CleanUp
+ exit 8;
+ fi
+ # Append '!' to indicate archive
+ newInputFiles="${D}newInputFiles ${D}{dirname}!"
+ doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
+ cd ${D}curDir
+ found=0;
+ for subfile in ${D}dirname/*.o* ; do
+ if @<:@ -f ${D}subfile @:>@; then
+ found=1
+ if @<:@ -s ${D}subfile @:>@; then
+ # FIXME: This should be: is file size > 32 byte, _not_ > 0!
+ newInputFiles="${D}newInputFiles ${D}subfile"
+ fi
+ fi
+ done
+ if @<:@ ${D}found -eq 0 @:>@; then
+ echo "WARNING: there are no files in archive \\'${D}file\\'"
+ fi
+ ;;
+ *)
+ newInputFiles="${D}{newInputFiles} ${D}file"
+ ;;
+ esac
+done
+inputFiles="${D}newInputFiles"
+
+# Output filename(s).
+do_backup=0;
+if @<:@ -z ${D}outFile @:>@; then
+ do_backup=1;
+ set outFile ${D}inputFiles; outFile=${D}2
+fi
+
+# If it is an archive, remove the '!' and the '_%' suffixes
+case ${D}outFile in
+*_%!)
+ outFile=\`basnam ${D}outFile _%!\`
+ ;;
+*)
+ ;;
+esac
+case ${D}outFile in
+*.dll)
+ outFile=\`basnam ${D}outFile .dll\`
+ ;;
+*.DLL)
+ outFile=\`basnam ${D}outFile .DLL\`
+ ;;
+*.o)
+ outFile=\`basnam ${D}outFile .o\`
+ ;;
+*.obj)
+...
[truncated message content] |
|
From: <sag...@us...> - 2009-12-13 15:28:16
|
Revision: 441
http://modplug.svn.sourceforge.net/modplug/?rev=441&view=rev
Author: saga-games
Date: 2009-12-13 15:28:07 +0000 (Sun, 13 Dec 2009)
Log Message:
-----------
[Fix] IT Compatibility: Fixes from SchismTracker: VolSwing, PanSwing, PPS
[Fix] XM Compatibility: Slightly improved Rxy behaviour.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-11 23:39:57 UTC (rev 440)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-13 15:28:07 UTC (rev 441)
@@ -768,7 +768,7 @@
if(!IsCompatibleMode(TRK_IMPULSETRACKER))
{
//IT compatibility 15. Retrigger will not be reset (Tremor doesn't store anything here, so we just don't reset this as well)
- pChn->nRetrigCount = 0;
+ if(!IsCompatibleMode(TRK_FASTTRACKER2)) pChn->nRetrigCount = 0;
pChn->nTremorCount = 0;
}
if (bResetEnv)
@@ -785,15 +785,29 @@
// Volume Swing
if (pIns->nVolSwing)
{
- int d = ((LONG)pIns->nVolSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128;
- pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1)/128);
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ {
+ double d = 2 * (((double) rand()) / RAND_MAX) - 1;
+ pChn->nVolSwing = d * pIns->nVolSwing / 100.0 * pChn->nVolume;
+ } else
+ {
+ int d = ((LONG)pIns->nVolSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128;
+ pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1)/128);
+ }
}
// Pan Swing
if (pIns->nPanSwing)
{
- int d = ((LONG)pIns->nPanSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128;
- pChn->nPanSwing = (signed short)d;
- pChn->nRestorePanOnNewNote = pChn->nPan+1;
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ {
+ double d = 2 * (((double) rand()) / RAND_MAX) - 1;
+ pChn->nPanSwing = d * pIns->nPanSwing * 4;
+ } else
+ {
+ int d = ((LONG)pIns->nPanSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128;
+ pChn->nPanSwing = (signed short)d;
+ pChn->nRestorePanOnNewNote = pChn->nPan + 1;
+ }
}
// Cutoff Swing
if (pIns->nCutSwing)
@@ -2500,7 +2514,7 @@
// E4x: Set Vibrato WaveForm
case 0x40: pChn->nVibratoType = param & 0x07; break;
// E5x: Set FineTune
- case 0x50: if (m_nTickCount) break;
+ case 0x50: if(!(m_dwSongFlags & SONG_FIRSTTICK)) break;
pChn->nC5Speed = S3MFineTuneTable[param];
if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))
pChn->nFineTune = param*2;
@@ -2536,7 +2550,11 @@
if((m_nType & MOD_TYPE_MOD) != 0) // MOD: Invert Loop
{
pChn->nEFxSpeed = param;
- if(m_dwSongFlags & SONG_FIRSTTICK) InvertLoop(pChn);
+ if(m_dwSongFlags & SONG_FIRSTTICK)
+ {
+ //if((pChn->nRowInstr != 0) && (m_nTickCount == 0)) pChn->nEFxOffset = 0; // reset offset (except when in pattern delay) TODO
+ InvertLoop(pChn);
+ }
}
else // XM: Set Active Midi Macro
{
@@ -2559,7 +2577,7 @@
// S1x: Set Glissando Control
case 0x10: pChn->dwFlags &= ~CHN_GLISSANDO; if (param) pChn->dwFlags |= CHN_GLISSANDO; break;
// S2x: Set FineTune
- case 0x20: if (m_nTickCount) break;
+ case 0x20: if(!(m_dwSongFlags & SONG_FIRSTTICK)) break;
pChn->nC5Speed = S3MFineTuneTable[param & 0x0F];
pChn->nFineTune = MOD2XMFineTune(param);
if (pChn->nPeriod) pChn->nPeriod = GetPeriodFromNote(pChn->nNote, pChn->nFineTune, pChn->nC5Speed);
@@ -2573,7 +2591,7 @@
// S6x: Pattern Delay for x frames
case 0x60: m_nFrameDelay = param; break;
// S7x: Envelope Control
- case 0x70: if (m_nTickCount) break;
+ case 0x70: if(!(m_dwSongFlags & SONG_FIRSTTICK)) break;
switch(param)
{
case 0:
@@ -3150,8 +3168,9 @@
if(m_dwSongFlags & SONG_FIRSTTICK)
{
- // FT2 bug: if a retrig (Rxy) occours together with a volume command, the first retrig interval is increased by one tick
- if(pChn->nRowVolCmd == VOLCMD_VOLUME) nRetrigCount = -1;
+ // here are some really stupid things FT2 does
+ if(pChn->nRowInstr > 0 && pChn->nRowNote == NOTE_NONE) nRetrigCount = 1;
+ if(pChn->nRowVolCmd == VOLCMD_VOLUME) nRetrigCount = -1; // not correct yet
if(pChn->nRowNote != NOTE_NONE && pChn->nRowNote <= GetModSpecifications().noteMax) nRetrigCount++;
}
if (nRetrigCount >= nRetrigSpeed)
@@ -3164,6 +3183,8 @@
}
} else
{
+ // old routines
+
if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))
{
if (!nRetrigSpeed) nRetrigSpeed = 1;
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2009-12-11 23:39:57 UTC (rev 440)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2009-12-13 15:28:07 UTC (rev 441)
@@ -1153,7 +1153,9 @@
// Pitch/Pan separation
if ((pIns->nPPS) && (pChn->nRealPan) && (pChn->nNote))
{
- int pandelta = (int)pChn->nRealPan + (int)((int)(pChn->nNote - pIns->nPPC - 1) * (int)pIns->nPPS) / (int)8;
+ // PPS value is 1/512, i.e. PPS=1 will adjust by 8/512 = 1/64 for each 8 semitones
+ // with PPS = 32 / PPC = C-5, E-6 will pan hard right (and D#6 will not)
+ int pandelta = (int)pChn->nRealPan + (int)((int)(pChn->nNote - pIns->nPPC - 1) * (int)pIns->nPPS) / (int)(IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 8);
pChn->nRealPan = CLAMP(pandelta, 0, 256);
}
} else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-11 23:40:12
|
Revision: 440
http://modplug.svn.sourceforge.net/modplug/?rev=440&view=rev
Author: saga-games
Date: 2009-12-11 23:39:57 +0000 (Fri, 11 Dec 2009)
Log Message:
-----------
[Fix] XM Compatibility: A somewhat more compatible Rxy effect. Still needs more testing, as it's approximately the same algorithm as in Milky (which I know is not 100% correct).
[Fix] Comments tab: The lower part of the tab was receiving update messages that were not even meaningful to this tab (f.e. speed changes), so it was updating quite often modules that have alternating speed... Only letting in important update messages now.
[Fix] Wave Convert: The wave convert dialog had two default buttons, one of them (the "default default button") didn't make sense.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/view_com.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-12-08 19:42:46 UTC (rev 439)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-12-11 23:39:57 UTC (rev 440)
@@ -220,7 +220,7 @@
END
IDD_WAVECONVERT DIALOGEX 0, 0, 262, 197
-STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Wave Convert"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
@@ -229,7 +229,7 @@
GROUPBOX "Render",IDC_STATIC,6,6,192,90
COMBOBOX IDC_COMBO1,18,18,54,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO2,78,18,73,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "Change Player Options",IDC_PLAYEROPTIONS,18,36,81,14,BS_CENTER
+ PUSHBUTTON "Change Player Options",IDC_PLAYEROPTIONS,18,36,81,14,BS_CENTER
CONTROL "Channel mode (one file per channel)",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,168,8
CONTROL "Normalize Output",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,73,10
CONTROL "High quality resampling",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,102,66,84,10
Modified: trunk/OpenMPT/mptrack/view_com.cpp
===================================================================
--- trunk/OpenMPT/mptrack/view_com.cpp 2009-12-08 19:42:46 UTC (rev 439)
+++ trunk/OpenMPT/mptrack/view_com.cpp 2009-12-11 23:39:57 UTC (rev 440)
@@ -180,7 +180,10 @@
m_ToolBar.UpdateStyle();
lHint &= ~HINT_MPTOPTIONS;
}
- lHint &= ~(HINT_SAMPLEDATA|HINT_PATTERNDATA|HINT_ENVELOPE);
+ lHint &= (HINT_MODTYPE
+ |HINT_SMPNAMES|HINT_SAMPLEINFO
+ |HINT_INSNAMES|HINT_INSTRUMENT
+ /*|HINT_PATNAMES|HINT_PATTERNROW*/); // pattern stuff currently unused
if (!lHint) return;
m_ItemList.SetRedraw(FALSE);
// Add sample headers
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-08 19:42:46 UTC (rev 439)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-11 23:39:57 UTC (rev 440)
@@ -3122,13 +3122,13 @@
}
//end rewbs.volOffset:
-void CSoundFile::RetrigNote(UINT nChn, UINT param, UINT offset) //rewbs.VolOffset: added offset param.
-//-------------------------------------------------------------
+void CSoundFile::RetrigNote(UINT nChn, int param, UINT offset) //rewbs.VolOffset: added offset param.
+//------------------------------------------------------------
{
// Retrig: bit 8 is set if it's the new XM retrig
MODCHANNEL *pChn = &Chn[nChn];
- UINT nRetrigSpeed = param & 0x0F;
- UINT nRetrigCount = pChn->nRetrigCount;
+ int nRetrigSpeed = param & 0x0F;
+ int nRetrigCount = pChn->nRetrigCount;
bool bDoRetrig = false;
if(IsCompatibleMode(TRK_IMPULSETRACKER))
@@ -3144,8 +3144,26 @@
bDoRetrig = true;
}
}
- else
+ else if(IsCompatibleMode(TRK_FASTTRACKER2) && (param & 0x100))
{
+ // buggy-like-hell FT2 Rxy retrig!
+
+ if(m_dwSongFlags & SONG_FIRSTTICK)
+ {
+ // FT2 bug: if a retrig (Rxy) occours together with a volume command, the first retrig interval is increased by one tick
+ if(pChn->nRowVolCmd == VOLCMD_VOLUME) nRetrigCount = -1;
+ if(pChn->nRowNote != NOTE_NONE && pChn->nRowNote <= GetModSpecifications().noteMax) nRetrigCount++;
+ }
+ if (nRetrigCount >= nRetrigSpeed)
+ {
+ if (!(m_dwSongFlags & SONG_FIRSTTICK) || (pChn->nRowNote == NOTE_NONE))
+ {
+ bDoRetrig = true;
+ nRetrigCount = 0;
+ }
+ }
+ } else
+ {
if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))
{
if (!nRetrigSpeed) nRetrigSpeed = 1;
@@ -3153,9 +3171,10 @@
nRetrigCount++;
} else
{
- UINT realspeed = nRetrigSpeed;
+ int realspeed = nRetrigSpeed;
+ // FT2 bug: if a retrig (Rxy) occours together with a volume command, the first retrig interval is increased by one tick
if ((param & 0x100) && (pChn->nRowVolCmd == VOLCMD_VOLUME) && (pChn->nRowParam & 0xF0)) realspeed++;
- if ((m_nTickCount) || (param & 0x100))
+ if (!(m_dwSongFlags & SONG_FIRSTTICK) || (param & 0x100))
{
if (!realspeed) realspeed = 1;
if ((!(param & 0x100)) && (m_nMusicSpeed) && (!(m_nTickCount % realspeed))) bDoRetrig = true;
@@ -3213,6 +3232,10 @@
SampleOffset(nChn, offset, false);
}
}
+
+ // buggy-like-hell FT2 Rxy retrig!
+ if(IsCompatibleMode(TRK_FASTTRACKER2) && (param & 0x100)) nRetrigCount++;
+
if(!IsCompatibleMode(TRK_IMPULSETRACKER))
pChn->nRetrigCount = (BYTE)nRetrigCount;
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-12-08 19:42:46 UTC (rev 439)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-12-11 23:39:57 UTC (rev 440)
@@ -220,7 +220,7 @@
BYTE nOldCmdEx, nOldVolParam, nOldTempo;
BYTE nOldOffset, nOldHiOffset;
BYTE nCutOff, nResonance;
- BYTE nRetrigCount, nRetrigParam;
+ int nRetrigCount, nRetrigParam;
BYTE nTremorCount, nTremorParam;
BYTE nPatternLoop, nPatternLoopCount;
BYTE nRowNote, nRowInstr;
@@ -846,7 +846,7 @@
void FineVolumeDown(MODCHANNEL *pChn, UINT param);
void Tremolo(MODCHANNEL *pChn, UINT param);
void Panbrello(MODCHANNEL *pChn, UINT param);
- void RetrigNote(UINT nChn, UINT param, UINT offset=0); //rewbs.volOffset: added last param
+ void RetrigNote(UINT nChn, int param, UINT offset=0); //rewbs.volOffset: added last param
void SampleOffset(UINT nChn, UINT param, bool bPorta); //rewbs.volOffset: moved offset code to own method
void NoteCut(UINT nChn, UINT nTick);
int PatternLoop(MODCHANNEL *, UINT param);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-08 20:28:25
|
Revision: 439
http://modplug.svn.sourceforge.net/modplug/?rev=439&view=rev
Author: saga-games
Date: 2009-12-08 19:42:46 +0000 (Tue, 08 Dec 2009)
Log Message:
-----------
[Fix] Mainframe: Split keyboard settings menu entry was always locked.
[Imp] Mainframe: Extended paste mechanisms (mix, flood, push forward) have been moved into a sub menu
[Imp] Mainframe: Improved accelerator keys in the edit menu
[Imp] Treeview: If there's only one sequence, prepend "Sequence:" text if it has a custom name.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/InputHandler.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/InputHandler.cpp
===================================================================
--- trunk/OpenMPT/mptrack/InputHandler.cpp 2009-12-06 22:13:32 UTC (rev 438)
+++ trunk/OpenMPT/mptrack/InputHandler.cpp 2009-12-08 19:42:46 UTC (rev 439)
@@ -411,7 +411,7 @@
CString CInputHandler::GetMenuText(UINT id)
{
CString s;
- CommandID c;
+ CommandID c = kcNull;
switch(id)
{
@@ -439,14 +439,16 @@
case ID_EDIT_CUT: s="Cu&t\t"; c=kcEditCut; break;
case ID_EDIT_COPY: s="&Copy\t"; c=kcEditCopy; break;
case ID_EDIT_PASTE: s="&Paste\t"; c=kcEditPaste; break;
- case ID_EDIT_PASTE_SPECIAL: s="&Mix Paste\t"; c=kcEditMixPaste; break;
- case ID_EDIT_PASTEFLOOD: s="Paste Fl&ood\t"; c=kcEditPasteFlood; break;
- case ID_EDIT_PUSHFORWARDPASTE: s="Push For&ward Paste\t"; c=kcEditPushForwardPaste; break;
- case ID_EDIT_SELECT_ALL: s="&Select All\t"; c=kcEditSelectAll; break;
+ case ID_EDIT_SELECT_ALL: s="Select &All\t"; c=kcEditSelectAll; break;
+ case ID_EDIT_CLEANUP: s="C&leanup"; break;
case ID_EDIT_FIND: s="&Find\t"; c=kcEditFind; break;
case ID_EDIT_FINDNEXT: s="Find &Next\t"; c=kcEditFindNext; break;
case ID_EDIT_GOTO_MENU: s="&Goto\t"; c=kcPatternGoto; break;
case ID_EDIT_SPLITKEYBOARDSETTINGS: s="Split &Keyboard Settings\t"; c=kcShowSplitKeyboardSettings; break;
+ // "Paste Special" sub menu
+ case ID_EDIT_PASTE_SPECIAL: s="&Mix Paste\t"; c=kcEditMixPaste; break;
+ case ID_EDIT_PASTEFLOOD: s="Paste Fl&ood\t"; c=kcEditPasteFlood; break;
+ case ID_EDIT_PUSHFORWARDPASTE: s="&Push Forward Paste\t"; c=kcEditPushForwardPaste; break;
case ID_VIEW_GLOBALS: s="&General\t"; c=kcViewGeneral; break;
case ID_VIEW_SAMPLES: s="&Samples\t"; c=kcViewSamples; break;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-06 22:13:32 UTC (rev 438)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-08 19:42:46 UTC (rev 439)
@@ -68,6 +68,7 @@
// -> CODE#0012
// -> DESC="midi keyboard split"
ON_COMMAND(ID_EDIT_SPLITRECSELECT, OnSplitRecordSelect)
+ ON_COMMAND(ID_EDIT_SPLITKEYBOARDSETTINGS, SetSplitKeyboardSettings)
// -! NEW_FEATURE#0012
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
ON_COMMAND(ID_PATTERN_CHNRESET, OnChannelReset)
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-12-06 22:13:32 UTC (rev 438)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-12-08 19:42:46 UTC (rev 439)
@@ -746,7 +746,10 @@
if(((hintFlagPart == HINT_SEQNAMES) && pSndFile->Order.GetNumSequences() == 1) || adjustParentNode)
{
CString sSeqName = pSndFile->Order.GetSequence(0).m_sName;
- if(sSeqName.IsEmpty() || pSndFile->Order.GetNumSequences() > 1) sSeqName = "Sequence";
+ if(sSeqName.IsEmpty() || pSndFile->Order.GetNumSequences() > 1)
+ sSeqName = "Sequence";
+ else
+ sSeqName = "Sequence: " + sSeqName;
SetItem(pInfo->hOrders, TVIF_TEXT, sSeqName, 0, 0, 0, 0, 0);
}
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-12-06 22:13:32 UTC (rev 438)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-12-08 19:42:46 UTC (rev 439)
@@ -442,26 +442,26 @@
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Follow Song",IDC_PATTERN_FOLLOWSONG,"Button",BS_AUTOCHECKBOX | BS_FLAT,312,32,55,8
- COMBOBOX IDC_COMBO_INSTRUMENT,18,30,102,137,CBS_DROPDOWNLIST | WS_VSCROLL
- CTEXT "Row Spacing",IDC_STATIC,168,32,42,8,SS_CENTERIMAGE
- EDITTEXT IDC_EDIT_SPACING,216,30,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP
- CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,236,30,11,11
+ CONTROL "Follow Song",IDC_PATTERN_FOLLOWSONG,"Button",BS_AUTOCHECKBOX | BS_FLAT,312,33,55,8
+ COMBOBOX IDC_COMBO_INSTRUMENT,18,31,102,137,CBS_DROPDOWNLIST | WS_VSCROLL
+ CTEXT "Row Spacing",IDC_STATIC,168,33,42,8,SS_CENTERIMAGE
+ EDITTEXT IDC_EDIT_SPACING,216,31,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP
+ CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,236,31,11,11
PUSHBUTTON "<<",IDC_BUTTON2,3,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
PUSHBUTTON ">>",IDC_BUTTON1,15,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
- LTEXT "Pattern Name",IDC_STATIC_PATTERNNAME,384,32,48,8,SS_CENTERIMAGE
- EDITTEXT IDC_EDIT_PATTERNNAME,439,30,108,12,ES_AUTOHSCROLL
+ LTEXT "Pattern Name",IDC_STATIC_PATTERNNAME,384,33,48,8,SS_CENTERIMAGE
+ EDITTEXT IDC_EDIT_PATTERNNAME,439,31,108,12,ES_AUTOHSCROLL
CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,2,4,370,18
- CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",0x0,6,30,11,12
- PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI,126,30,33,13,0,WS_EX_STATICEDGE
- GROUPBOX "",IDC_STATIC,3,22,369,24
- CONTROL "Loop Pattern",IDC_PATTERN_LOOP,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,252,32,57,8
+ CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",0x0,6,31,11,12
+ PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI,126,31,33,13,0,WS_EX_STATICEDGE
+ GROUPBOX "",IDC_STATIC,3,23,369,24
+ CONTROL "Loop Pattern",IDC_PATTERN_LOOP,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,252,33,57,8
EDITTEXT IDC_EDIT_ORDERLIST_MARGINS,3,65,28,12,ES_AUTOHSCROLL | ES_READONLY
CONTROL "",IDC_SPIN_ORDERLIST_MARGINS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,16,70,11,11
EDITTEXT IDC_EDIT_SEQUENCE_NAME,439,8,108,12,ES_AUTOHSCROLL
CTEXT "Sequence Name",IDC_STATIC_SEQUENCE_NAME,384,10,53,8,SS_CENTERIMAGE
GROUPBOX "",IDC_STATIC_SEQUENCE_NAME_FRAME,378,0,174,24
- GROUPBOX "",IDC_STATIC,378,22,174,24
+ GROUPBOX "",IDC_STATIC,378,23,174,24
END
IDD_CONTROL_SAMPLES DIALOGEX 0, 0, 544, 106
@@ -1835,17 +1835,20 @@
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
- MENUITEM "&Mix Paste\tCtrl+M", ID_EDIT_PASTE_SPECIAL
- MENUITEM "Paste Flood", ID_EDIT_PASTEFLOOD
- MENUITEM "Push Forward Paste", ID_EDIT_PUSHFORWARDPASTE
+ POPUP "Paste &Special"
+ BEGIN
+ MENUITEM "&Mix Paste\tCtrl+M", ID_EDIT_PASTE_SPECIAL
+ MENUITEM "Paste &Flood", ID_EDIT_PASTEFLOOD
+ MENUITEM "&Push Forward Paste", ID_EDIT_PUSHFORWARDPASTE
+ END
MENUITEM "Select &All\tCtrl+5", ID_EDIT_SELECT_ALL
MENUITEM SEPARATOR
MENUITEM "C&leanup...", ID_EDIT_CLEANUP
MENUITEM SEPARATOR
MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND
- MENUITEM "Find Next\tF3", ID_EDIT_FINDNEXT
- MENUITEM "Go to...", ID_EDIT_GOTO_MENU
- MENUITEM "Split Keyboard Settings", ID_EDIT_SPLITKEYBOARDSETTINGS
+ MENUITEM "Find &Next\tF3", ID_EDIT_FINDNEXT
+ MENUITEM "&Goto", ID_EDIT_GOTO_MENU
+ MENUITEM "Split &Keyboard Settings", ID_EDIT_SPLITKEYBOARDSETTINGS
END
POPUP "&View"
BEGIN
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2009-12-06 22:13:32 UTC (rev 438)
+++ trunk/OpenMPT/mptrack/resource.h 2009-12-08 19:42:46 UTC (rev 439)
@@ -1159,6 +1159,7 @@
#define ID_MODTREE_SWITCHTO 59238
#define ID_EDIT_PUSHFORWARDPASTE 59239
#define ID_EDIT_SPLITKEYBOARDSETTINGS 59240
+#define ID_EDIT_PASTESPECIAL 59241
// Next default values for new objects
//
@@ -1166,7 +1167,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 524
-#define _APS_NEXT_COMMAND_VALUE 59241
+#define _APS_NEXT_COMMAND_VALUE 59242
#define _APS_NEXT_CONTROL_VALUE 2413
#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...> - 2009-12-06 22:13:40
|
Revision: 438
http://modplug.svn.sourceforge.net/modplug/?rev=438&view=rev
Author: saga-games
Date: 2009-12-06 22:13:32 +0000 (Sun, 06 Dec 2009)
Log Message:
-----------
[Fix] Mod Creation: Filling the whole mod title field with null bytes on creation to avoid funky characters in other programs
[Fix] Pattern editor: PCNote handling was missing in OnClearSelection, so it was possible to delete the effect column only partly
[Imp] Pattern editor: When using the MPTM format, plugin param changes are written to the pattern as PC Notes
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-06 19:22:50 UTC (rev 437)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-12-06 22:13:32 UTC (rev 438)
@@ -639,6 +639,7 @@
m_SndFile.Patterns.Insert(0, 64);
}
+ memset(m_SndFile.m_szNames, 0, sizeof(m_SndFile.m_szNames));
strcpy(m_SndFile.m_szNames[0], "untitled");
m_SndFile.m_nMusicTempo = m_SndFile.m_nDefaultTempo = 125;
@@ -3388,11 +3389,7 @@
void CModDoc::RecordParamChange(int plugSlot, long paramIndex)
//------------------------------------------------------
{
- CVstPlugin *pPlug = (CVstPlugin*)m_SndFile.m_MixPlugins[plugSlot].pMixPlugin;
- if (pPlug) {
- UINT value = pPlug->GetZxxParameter(paramIndex);
- SendMessageToActiveViews(WM_MOD_RECORDPARAM, paramIndex, value);
- }
+ SendMessageToActiveViews(WM_MOD_RECORDPARAM, plugSlot, paramIndex);
}
void CModDoc::LearnMacro(int macroToSet, long paramToUse)
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-06 19:22:50 UTC (rev 437)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-06 22:13:32 UTC (rev 438)
@@ -7,6 +7,7 @@
#include "globals.h"
#include "view_pat.h"
#include "ctrl_pat.h"
+#include "vstplug.h" // for writing plug params to pattern
#include "EffectVis.h" //rewbs.fxvis
#include "OpenGLEditor.h" //rewbs.fxvis
@@ -915,6 +916,7 @@
case 3: // Clear Command
if (rm.command) {
m->command = 0;
+ if(m->note == NOTE_PC || m->note == NOTE_PCS) m->SetValueEffectCol(0);
}
break;
case 4: // Clear Command Param
@@ -2936,8 +2938,9 @@
}
-LRESULT CViewPattern::OnRecordPlugParamChange(WPARAM paramIndex, LPARAM value)
-//--------------------------------------------------------------------------
+// record plugin parameter changes into current pattern
+LRESULT CViewPattern::OnRecordPlugParamChange(WPARAM plugSlot, LPARAM paramIndex)
+//-------------------------------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
//if (!m_bRecord || !pModDoc) {
@@ -2964,35 +2967,52 @@
// TODO: Is the right plugin active? Move to a chan with the right plug
// Probably won't do this - finish fluctuator implementation instead.
- //Figure out which plug param (if any) is controllable using the active macro on this channel.
- long activePlugParam = -1;
- BYTE activeMacro = pSndFile->Chn[nChn].nActiveMacro;
- CString activeMacroString = &(pSndFile->m_MidiCfg.szMidiSFXExt[activeMacro*32]);
- if (pModDoc->GetMacroType(activeMacroString) == sfx_plug) {
- activePlugParam = pModDoc->MacroToPlugParam(activeMacroString);
- }
- //If the wrong macro is active, see if we can find the right one.
- //If we can, activate it for this chan by writing appropriate SFx command it.
- if (activePlugParam != paramIndex) {
- int foundMacro = pModDoc->FindMacroForParam(paramIndex);
- if (foundMacro >= 0) {
- pSndFile->Chn[nChn].nActiveMacro = foundMacro;
- if (pRow->command == 0 || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) { //we overwrite existing Zxx and \xx only.
- pRow->command = (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))?CMD_S3MCMDEX:CMD_MODCMDEX;;
- pRow->param = 0xF0 + (foundMacro&0x0F);
- InvalidateRow();
- }
+ CVstPlugin *pPlug = (CVstPlugin*)pSndFile->m_MixPlugins[plugSlot].pMixPlugin;
+ if (pPlug == nullptr) return 0;
+ if(pSndFile->GetType() == MOD_TYPE_MPT)
+ {
+ // MPTM: Use PC Notes
+
+ // only overwrite existing PC Notes
+ if(pRow->IsEmpty() || pRow->note == NOTE_PC || pRow->note == NOTE_PCS)
+ {
+ pRow->Set(NOTE_PCS, plugSlot + 1, paramIndex, static_cast<uint16>(pPlug->GetParameter(paramIndex) * MODCOMMAND::maxColumnValue));
+ InvalidateRow();
}
- }
+ } else
+ {
+ // Other formats: Use MIDI macros
+ //Figure out which plug param (if any) is controllable using the active macro on this channel.
+ long activePlugParam = -1;
+ BYTE activeMacro = pSndFile->Chn[nChn].nActiveMacro;
+ CString activeMacroString = &(pSndFile->m_MidiCfg.szMidiSFXExt[activeMacro*32]);
+ if (pModDoc->GetMacroType(activeMacroString) == sfx_plug) {
+ activePlugParam = pModDoc->MacroToPlugParam(activeMacroString);
+ }
+ //If the wrong macro is active, see if we can find the right one.
+ //If we can, activate it for this chan by writing appropriate SFx command it.
+ if (activePlugParam != paramIndex) {
+ int foundMacro = pModDoc->FindMacroForParam(paramIndex);
+ if (foundMacro >= 0) {
+ pSndFile->Chn[nChn].nActiveMacro = foundMacro;
+ if (pRow->command == 0 || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) { //we overwrite existing Zxx and \xx only.
+ pRow->command = (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))?CMD_S3MCMDEX:CMD_MODCMDEX;;
+ pRow->param = 0xF0 + (foundMacro&0x0F);
+ InvalidateRow();
+ }
+ }
+ }
- //Write the data, but we only overwrite if the command is a macro anyway.
- if (pRow->command == 0 || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) {
- pRow->command = CMD_SMOOTHMIDI;
- pRow->param = value;
- InvalidateRow();
+ //Write the data, but we only overwrite if the command is a macro anyway.
+ if (pRow->command == CMD_NONE || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) {
+ pRow->command = CMD_SMOOTHMIDI;
+ pRow->param = pPlug->GetZxxParameter(paramIndex);
+ InvalidateRow();
+ }
+
}
return 0;
@@ -4471,7 +4491,7 @@
default: p->Clear(); //If not specified, delete them all! :)
}
if((field == 3 || field == 4) && (p->note == NOTE_PC || p->note == NOTE_PCS))
- p->command = p->param = 0;
+ p->SetValueEffectCol(0);
if(IsEditingEnabled_bmsg())
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-06 19:22:58
|
Revision: 437
http://modplug.svn.sourceforge.net/modplug/?rev=437&view=rev
Author: saga-games
Date: 2009-12-06 19:22:50 +0000 (Sun, 06 Dec 2009)
Log Message:
-----------
[Fix] Pattern Editor: Amplify acted VERY weird when it was applied on an instrument that's not assigned to any sample. Should be a bit better now.
[Fix] Pattern Editor: Amplify doesn't use volume column in mod format anymore.
[Ref] Small changes to playback engine
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-06 15:56:30 UTC (rev 436)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-12-06 19:22:50 UTC (rev 437)
@@ -2699,115 +2699,145 @@
if (pSndFile->Patterns[m_nPattern])
{
MODCOMMAND *p = pSndFile->Patterns[m_nPattern];
- for (UINT j=0; j<pSndFile->m_nChannels; j++)
+
+ CHANNELINDEX firstChannel = (m_dwBeginSel & 0xFFFF) >> 3, lastChannel = (m_dwEndSel & 0xFFFF) >> 3;
+ ROWINDEX firstRow = (m_dwBeginSel >> 16), lastRow = (m_dwEndSel >> 16);
+ firstChannel = CLAMP(firstChannel, 0, pSndFile->m_nChannels - 1);
+ lastChannel = CLAMP(lastChannel, 0, pSndFile->m_nChannels - 1);
+ firstRow = CLAMP(firstRow, 0, pSndFile->PatternSize[m_nPattern] - 1);
+ lastRow = CLAMP(lastRow, 0, pSndFile->PatternSize[m_nPattern] - 1);
+
+ for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++)
{
- for (UINT i=0; i<pSndFile->PatternSize[m_nPattern]; i++)
+ for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++)
{
- if ((i >= (m_dwBeginSel >> 16)) && (i <= (m_dwEndSel >> 16)))
+ MODCOMMAND *m = p + nRow * pSndFile->m_nChannels + nChn;
+ if ((m->command == CMD_VOLUME) && (m->param <= 64))
{
- MODCOMMAND *m = p + i*pSndFile->m_nChannels+j;
- if ((m->command == CMD_VOLUME) && (m->param <= 64))
+ chvol[nChn] = m->param;
+ break;
+ }
+ if (m->volcmd == VOLCMD_VOLUME)
+ {
+ chvol[nChn] = m->vol;
+ break;
+ }
+ if ((m->note) && (m->note <= NOTE_MAX) && (m->instr))
+ {
+ UINT nSmp = m->instr;
+ if (pSndFile->m_nInstruments)
{
- chvol[j] = m->param;
- break;
+ if ((nSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nSmp]))
+ {
+ nSmp = pSndFile->Instruments[nSmp]->Keyboard[m->note];
+ if(!nSmp) chvol[nChn] = 64; // hack for instruments without samples
+ } else
+ {
+ nSmp = 0;
+ }
}
- if (m->volcmd == VOLCMD_VOLUME)
+ if ((nSmp) && (nSmp <= pSndFile->m_nSamples))
{
- chvol[j] = m->vol;
+ chvol[nChn] = (BYTE)(pSndFile->Samples[nSmp].nVolume >> 2);
break;
}
- if ((m->note) && (m->note < 0x80) && (m->instr))
- {
- UINT nSmp = m->instr;
- if (pSndFile->m_nInstruments)
+ else
+ { //nonexistant sample and no volume present in patten? assume volume=64.
+ if(pSndFile->GetType() == MOD_TYPE_MOD)
{
- if ((nSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nSmp]))
- {
- nSmp = pSndFile->Instruments[nSmp]->Keyboard[m->note];
- } else
- {
- nSmp = 0;
- }
- }
- if ((nSmp) && (nSmp <= pSndFile->m_nSamples))
+ m->command = CMD_VOLUME;
+ m->param = 64;
+ } else
{
- chvol[j] = (BYTE)(pSndFile->Samples[nSmp].nVolume >> 2);
- break;
- }
- else
- { //nonexistant sample and no volume present in patten? assume volume=64.
m->volcmd = VOLCMD_VOLUME;
- chvol[j] = 64;
m->vol = 64;
- break;
}
+ chvol[nChn] = 64;
+ break;
}
}
}
}
- for (UINT y=0; y<pSndFile->PatternSize[m_nPattern]; y++)
+
+ // adjust min/max channel if they're only partly selected (i.e. volume column is not covered)
+ if(((firstChannel << 3) | 2) < (m_dwBeginSel & 0xFFFF)) firstChannel++;
+ if(((lastChannel << 3) | 2) > (m_dwEndSel & 0xFFFF)) lastChannel--;
+
+ for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++)
{
- if ((y >= (m_dwBeginSel >> 16)) && (y <= (m_dwEndSel >> 16)))
+ p = pSndFile->Patterns[m_nPattern] + nRow * pSndFile->m_nChannels;
+ int cy = lastRow - firstRow + 1; // total rows (for fading)
+ for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++)
{
- int cy = (m_dwEndSel>>16) - (m_dwBeginSel>>16) + 1;
- int y0 = (m_dwBeginSel>>16);
- for (UINT x=0; x<pSndFile->m_nChannels; x++)
+ if ((!p[nChn].volcmd) && (p[nChn].command != CMD_VOLUME)
+ && (p[nChn].note) && (p[nChn].note <= NOTE_MAX) && (p[nChn].instr))
{
- UINT col = (x<<3) | 2;
- if ((col >= (m_dwBeginSel & 0xFFFF)) && (col <= (m_dwEndSel & 0xFFFF)))
+ UINT nSmp = p[nChn].instr;
+ bool overrideSampleVol = false;
+ if (pSndFile->m_nInstruments)
{
- if ((!p[x].volcmd) && (p[x].command != CMD_VOLUME)
- && (p[x].note) && (p[x].note < 0x80) && (p[x].instr))
+ if ((nSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nSmp]))
{
- UINT nSmp = p[x].instr;
- if (pSndFile->m_nInstruments)
+ nSmp = pSndFile->Instruments[nSmp]->Keyboard[p[nChn].note];
+ // hack for instruments without samples
+ if(!nSmp)
{
- if ((nSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nSmp]))
- {
- nSmp = pSndFile->Instruments[nSmp]->Keyboard[p[x].note];
- } else
- {
- nSmp = 0;
- }
+ nSmp = 1;
+ overrideSampleVol = true;
}
- if ((nSmp) && (nSmp <= pSndFile->m_nSamples))
- {
- p[x].volcmd = VOLCMD_VOLUME;
- p[x].vol = pSndFile->Samples[nSmp].nVolume >> 2;
- }
- }
- if (p[x].volcmd == VOLCMD_VOLUME) chvol[x] = (BYTE)p[x].vol;
- if (((dlg.m_bFadeIn) || (dlg.m_bFadeOut)) && (p[x].command != CMD_VOLUME) && (!p[x].volcmd))
+ } else
{
- p[x].volcmd = VOLCMD_VOLUME;
- p[x].vol = chvol[x];
+ nSmp = 0;
}
- if (p[x].volcmd == VOLCMD_VOLUME)
- {
- int vol = p[x].vol * dlg.m_nFactor;
- if (dlg.m_bFadeIn) vol = (vol * (y+1-y0)) / cy;
- if (dlg.m_bFadeOut) vol = (vol * (cy+y0-y)) / cy;
- vol = (vol+50) / 100;
- if (vol > 64) vol = 64;
- p[x].vol = (BYTE)vol;
- }
}
- col = (x<<3) | 3;
- if ((col >= (m_dwBeginSel & 0xFFFF)) && (col <= (m_dwEndSel & 0xFFFF)))
+ if ((nSmp) && (nSmp <= pSndFile->m_nSamples))
{
- if ((p[x].command == CMD_VOLUME) && (p[x].param <= 64))
+ if(pSndFile->GetType() == MOD_TYPE_MOD)
{
- int vol = p[x].param * dlg.m_nFactor;
- if (dlg.m_bFadeIn) vol = (vol * (y+1-y0)) / cy;
- if (dlg.m_bFadeOut) vol = (vol * (cy+y0-y)) / cy;
- vol = (vol+50) / 100;
- if (vol > 64) vol = 64;
- p[x].param = (BYTE)vol;
+ p[nChn].command = CMD_VOLUME;
+ p[nChn].param = (overrideSampleVol) ? 64 : pSndFile->Samples[nSmp].nVolume >> 2;
+ } else
+ {
+ p[nChn].volcmd = VOLCMD_VOLUME;
+ p[nChn].vol = (overrideSampleVol) ? 64 : pSndFile->Samples[nSmp].nVolume >> 2;
}
}
}
+ if (p[nChn].volcmd == VOLCMD_VOLUME) chvol[nChn] = (BYTE)p[nChn].vol;
+ if (((dlg.m_bFadeIn) || (dlg.m_bFadeOut)) && (p[nChn].command != CMD_VOLUME) && (!p[nChn].volcmd))
+ {
+ if(pSndFile->GetType() == MOD_TYPE_MOD)
+ {
+ p[nChn].command = CMD_VOLUME;
+ p[nChn].param = chvol[nChn];
+ } else
+ {
+ p[nChn].volcmd = VOLCMD_VOLUME;
+ p[nChn].vol = chvol[nChn];
+ }
+ }
+ if (p[nChn].volcmd == VOLCMD_VOLUME)
+ {
+ int vol = p[nChn].vol * dlg.m_nFactor;
+ if (dlg.m_bFadeIn) vol = (vol * (nRow+1-firstRow)) / cy;
+ if (dlg.m_bFadeOut) vol = (vol * (cy+firstRow-nRow)) / cy;
+ vol = (vol+50) / 100;
+ if (vol > 64) vol = 64;
+ p[nChn].vol = (BYTE)vol;
+ }
+ if ((((nChn << 3) | 3) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3) <= (m_dwEndSel & 0xFFFF)))
+ {
+ if ((p[nChn].command == CMD_VOLUME) && (p[nChn].param <= 64))
+ {
+ int vol = p[nChn].param * dlg.m_nFactor;
+ if (dlg.m_bFadeIn) vol = (vol * (nRow + 1 - firstRow)) / cy;
+ if (dlg.m_bFadeOut) vol = (vol * (cy + firstRow - nRow)) / cy;
+ vol = (vol + 50) / 100;
+ if (vol > 64) vol = 64;
+ p[nChn].param = (BYTE)vol;
+ }
+ }
}
- p += pSndFile->m_nChannels;
}
}
pModDoc->SetModified();
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-06 15:56:30 UTC (rev 436)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-12-06 19:22:50 UTC (rev 437)
@@ -1849,7 +1849,7 @@
// Midi Controller
case CMD_MIDI:
- if (m_nTickCount) break;
+ if(!(m_dwSongFlags & SONG_FIRSTTICK)) break;
if (param < 0x80){
ProcessMidiMacro(nChn, &m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro << 5], param);
} else {
@@ -3351,7 +3351,6 @@
void CSoundFile::SetSpeed(UINT param)
//-----------------------------------
{
- UINT max = (m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_S3M)) ? 256 : 128;
// Modplug Tracker and Mod-Plugin don't do this check
#ifndef MODPLUG_TRACKER
#ifndef FASTSOUNDLIB
@@ -3366,7 +3365,7 @@
#endif // FASTSOUNDLIB
#endif // MODPLUG_TRACKER
//if ((m_nType & MOD_TYPE_S3M) && (param > 0x80)) param -= 0x80;
- if ((param) && (param <= max)) m_nMusicSpeed = param;
+ if ((param) && (param <= GetModSpecifications().speedMax)) m_nMusicSpeed = param;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-12-06 15:56:40
|
Revision: 436
http://modplug.svn.sourceforge.net/modplug/?rev=436&view=rev
Author: saga-games
Date: 2009-12-06 15:56:30 +0000 (Sun, 06 Dec 2009)
Log Message:
-----------
[Fix] IT/MPTM Loader: "MPT extensions are making my life hard so they must be wrong" - Fixed again the combination of empty sample slots and the MPTX extension hack...
[Fix] IMF Loader: Slightly wrong instrument loader (this for once didn't break anything, though)
[Imp] Pattern editor: Grey out pattern name input field when in MOD/S3M mode
[Imp] Added "split keyboard settings" dialog to the "edit" menu and updated the shortcuts there (goto was missing)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/InputHandler.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/soundlib/Load_imf.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-12-05 19:44:47 UTC (rev 435)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-12-06 15:56:30 UTC (rev 436)
@@ -231,9 +231,13 @@
else
::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), false);
- // Enable/disablemultisequence controls according the current modtype.
+ // 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);
+
+ // 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);
}
//end rewbs.instroVST
if (dwHintMask & HINT_MPTOPTIONS)
Modified: trunk/OpenMPT/mptrack/InputHandler.cpp
===================================================================
--- trunk/OpenMPT/mptrack/InputHandler.cpp 2009-12-05 19:44:47 UTC (rev 435)
+++ trunk/OpenMPT/mptrack/InputHandler.cpp 2009-12-06 15:56:30 UTC (rev 436)
@@ -440,11 +440,13 @@
case ID_EDIT_COPY: s="&Copy\t"; c=kcEditCopy; break;
case ID_EDIT_PASTE: s="&Paste\t"; c=kcEditPaste; break;
case ID_EDIT_PASTE_SPECIAL: s="&Mix Paste\t"; c=kcEditMixPaste; break;
- case ID_EDIT_PASTEFLOOD: s="&Paste Flood\t"; c=kcEditPasteFlood; break;
- case ID_EDIT_PUSHFORWARDPASTE: s="&Push Forward Paste\t"; c=kcEditPushForwardPaste; break;
+ case ID_EDIT_PASTEFLOOD: s="Paste Fl&ood\t"; c=kcEditPasteFlood; break;
+ case ID_EDIT_PUSHFORWARDPASTE: s="Push For&ward Paste\t"; c=kcEditPushForwardPaste; break;
case ID_EDIT_SELECT_ALL: s="&Select All\t"; c=kcEditSelectAll; break;
case ID_EDIT_FIND: s="&Find\t"; c=kcEditFind; break;
case ID_EDIT_FINDNEXT: s="Find &Next\t"; c=kcEditFindNext; break;
+ case ID_EDIT_GOTO_MENU: s="&Goto\t"; c=kcPatternGoto; break;
+ case ID_EDIT_SPLITKEYBOARDSETTINGS: s="Split &Keyboard Settings\t"; c=kcShowSplitKeyboardSettings; break;
case ID_VIEW_GLOBALS: s="&General\t"; c=kcViewGeneral; break;
case ID_VIEW_SAMPLES: s="&Samples\t"; c=kcViewSamples; break;
@@ -461,7 +463,6 @@
case ID_VIEW_SONGPROPERTIES:s="Song P&roperties...\t"; c=kcViewSongProperties; break; //rewbs.graph
case ID_VIEW_MIDIMAPPING: s="&MIDI mapping...\t"; c = kcViewMIDImapping; break;
-
/*
case ID_WINDOW_NEW: s="&New Window\t"; c=kcWindowNew; break;
case ID_WINDOW_CASCADE: s="&Cascade\t"; c=kcWindowCascade; break;
@@ -512,6 +513,8 @@
pMenu->ModifyMenu(ID_EDIT_SELECT_ALL, MF_BYCOMMAND | MF_STRING, ID_EDIT_SELECT_ALL, GetMenuText(ID_EDIT_SELECT_ALL));
pMenu->ModifyMenu(ID_EDIT_FIND, MF_BYCOMMAND | MF_STRING, ID_EDIT_FIND, GetMenuText(ID_EDIT_FIND));
pMenu->ModifyMenu(ID_EDIT_FINDNEXT, MF_BYCOMMAND | MF_STRING, ID_EDIT_FINDNEXT, GetMenuText(ID_EDIT_FINDNEXT));
+ pMenu->ModifyMenu(ID_EDIT_GOTO_MENU, MF_BYCOMMAND | MF_STRING, ID_EDIT_GOTO_MENU, GetMenuText(ID_EDIT_GOTO_MENU));
+ pMenu->ModifyMenu(ID_EDIT_SPLITKEYBOARDSETTINGS, MF_BYCOMMAND | MF_STRING, ID_EDIT_SPLITKEYBOARDSETTINGS, GetMenuText(ID_EDIT_SPLITKEYBOARDSETTINGS));
pMenu->ModifyMenu(ID_VIEW_GLOBALS, MF_BYCOMMAND | MF_STRING, ID_VIEW_GLOBALS, GetMenuText(ID_VIEW_GLOBALS));
pMenu->ModifyMenu(ID_VIEW_SAMPLES, MF_BYCOMMAND | MF_STRING, ID_VIEW_SAMPLES, GetMenuText(ID_VIEW_SAMPLES));
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-12-05 19:44:47 UTC (rev 435)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-12-06 15:56:30 UTC (rev 436)
@@ -449,7 +449,7 @@
CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,236,30,11,11
PUSHBUTTON "<<",IDC_BUTTON2,3,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
PUSHBUTTON ">>",IDC_BUTTON1,15,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
- LTEXT "Pattern Name",IDC_STATIC,384,32,48,8,SS_CENTERIMAGE
+ LTEXT "Pattern Name",IDC_STATIC_PATTERNNAME,384,32,48,8,SS_CENTERIMAGE
EDITTEXT IDC_EDIT_PATTERNNAME,439,30,108,12,ES_AUTOHSCROLL
CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,2,4,370,18
CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",0x0,6,30,11,12
@@ -1845,6 +1845,7 @@
MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND
MENUITEM "Find Next\tF3", ID_EDIT_FINDNEXT
MENUITEM "Go to...", ID_EDIT_GOTO_MENU
+ MENUITEM "Split Keyboard Settings", ID_EDIT_SPLITKEYBOARDSETTINGS
END
POPUP "&View"
BEGIN
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2009-12-05 19:44:47 UTC (rev 435)
+++ trunk/OpenMPT/mptrack/resource.h 2009-12-06 15:56:30 UTC (rev 436)
@@ -912,6 +912,7 @@
#define IDC_CHECK_PT1X 2409
#define IDC_STATIC_CHANNEL_NAME 2410
#define IDC_EDIT_CHANNEL_NAME 2411
+#define IDC_STATIC_PATTERNNAME 2412
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1157,6 +1158,7 @@
#define ID_MODTREE_INSERT 59237
#define ID_MODTREE_SWITCHTO 59238
#define ID_EDIT_PUSHFORWARDPASTE 59239
+#define ID_EDIT_SPLITKEYBOARDSETTINGS 59240
// Next default values for new objects
//
@@ -1164,8 +1166,8 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 524
-#define _APS_NEXT_COMMAND_VALUE 59240
-#define _APS_NEXT_CONTROL_VALUE 2412
+#define _APS_NEXT_COMMAND_VALUE 59241
+#define _APS_NEXT_CONTROL_VALUE 2413
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
Modified: trunk/OpenMPT/soundlib/Load_imf.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_imf.cpp 2009-12-05 19:44:47 UTC (rev 435)
+++ trunk/OpenMPT/soundlib/Load_imf.cpp 2009-12-06 15:56:30 UTC (rev 436)
@@ -476,7 +476,7 @@
}
pIns->nFadeOut = imfins.fadeout;
- pIns->nGlobalVol = 128;
+ pIns->nGlobalVol = 64;
load_imf_envelope(&pIns->VolEnv, &imfins, IMF_ENV_VOL);
load_imf_envelope(&pIns->PanEnv, &imfins, IMF_ENV_PAN);
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2009-12-05 19:44:47 UTC (rev 435)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-12-06 15:56:30 UTC (rev 436)
@@ -1246,6 +1246,9 @@
pSmp->nVibRate = pis->vis;
pSmp->nVibDepth = pis->vid & 0x7F;
pSmp->nVibSweep = pis->vir; //(pis->vir + 3) / 4;
+
+ if(pis->samplepointer) lastSampleOffset = pis->samplepointer; // MPTX hack
+
if ((pis->samplepointer) && (pis->samplepointer < dwMemLength) && (pis->length))
{
pSmp->nLength = pis->length;
@@ -1268,8 +1271,7 @@
// -> CODE#0027
// -> DESC="per-instrument volume ramping setup (refered as attack)"
// ReadSample(&Ins[nsmp+1], flags, (LPSTR)(lpStream+pis->samplepointer), dwMemLength - pis->samplepointer);
- if(pis->samplepointer)
- lastSampleOffset = pis->samplepointer + ReadSample(&Samples[nsmp+1], flags, (LPSTR)(lpStream+pis->samplepointer), dwMemLength - pis->samplepointer);
+ lastSampleOffset = pis->samplepointer + ReadSample(&Samples[nsmp+1], flags, (LPSTR)(lpStream+pis->samplepointer), dwMemLength - pis->samplepointer);
// -! NEW_FEATURE#0027
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|