From: <sag...@us...> - 2011-10-06 15:37:44
|
Revision: 1093 http://modplug.svn.sourceforge.net/modplug/?rev=1093&view=rev Author: saga-games Date: 2011-10-06 15:37:37 +0000 (Thu, 06 Oct 2011) Log Message: ----------- [New] Pattern Editor: Option to display default volume in the volume column if it is empty (obviously inspired by Impulse Tracker) [Mod] Internal: Changed floating point model to fast, explicitely enabled intrinsics (though /O2 should enable the implicitely) [Mod] OpenMPT: Version is now 1.20.00.39 Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-10-06 15:37:37 UTC (rev 1093) @@ -160,13 +160,23 @@ BYTE r,g,b; m_Dib.SetAllColors(0, MAX_MODCOLORS, CMainFrame::GetSettings().rgbCustomColors); + r = hilightcolor(GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); + g = hilightcolor(GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); + b = hilightcolor(GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); + m_Dib.SetColor(MODCOLOR_2NDHIGHLIGHT, RGB(r,g,b)); + + r = hilightcolor(GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_VOLUME]), GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - g = hilightcolor(GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + g = hilightcolor(GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_VOLUME]), GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - b = hilightcolor(GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + b = hilightcolor(GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_VOLUME]), GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - m_Dib.SetColor(MODCOLOR_2NDHIGHLIGHT, RGB(r,g,b)); + m_Dib.SetColor(MODCOLOR_DEFAULTVOLUME, RGB(r,g,b)); + m_Dib.SetBlendColor(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BLENDCOLOR]); } @@ -429,8 +439,8 @@ } -void CViewPattern::DrawVolumeCommand(int x, int y, const MODCOMMAND mc) -//--------------------------------------------------------------------- +void CViewPattern::DrawVolumeCommand(int x, int y, const MODCOMMAND &mc, bool drawDefaultVolume) +//---------------------------------------------------------------------------------------------- { PCPATTERNFONT pfnt = GetCurrentPatternFont(); @@ -448,10 +458,34 @@ } else { - if (mc.volcmd) + static_assert(MAX_VOLCMDS <= 16, "Pattern draw code assumes <= 16 volume commands"); + int volcmd = (mc.volcmd & 0x0F); + int vol = (mc.vol & 0x7F); + + if(drawDefaultVolume) { - const int volcmd = (mc.volcmd & 0x0F); - const int vol = (mc.vol & 0x7F); + // Displaying sample default volume if there is no volume command. + const CSoundFile *pSndFile = GetDocument()->GetSoundFile(); + SAMPLEINDEX sample = mc.instr; + if(pSndFile->GetNumInstruments()) + { + if(mc.instr <= pSndFile->GetNumInstruments()) + { + sample = pSndFile->Instruments[mc.instr]->Keyboard[mc.note - NOTE_MIN]; + } else + { + sample = 0; + } + } + if(sample && sample <= pSndFile->GetNumSamples()) + { + volcmd = VOLCMD_VOLUME; + vol = pSndFile->GetSample(sample).nVolume / 4; + } + } + + if (volcmd) + { m_Dib.TextBlt(x, y, pfnt->nVolCmdWidth, COLUMN_HEIGHT, pfnt->nVolX, pfnt->nVolY+volcmd*COLUMN_HEIGHT); m_Dib.TextBlt(x+pfnt->nVolCmdWidth, y, pfnt->nVolHiWidth, COLUMN_HEIGHT, @@ -731,7 +765,8 @@ { BYTE bColSel[MAX_BASECHANNELS]; PCPATTERNFONT pfnt = GetCurrentPatternFont(); - MODCOMMAND m0, *pPattern = pSndFile->Patterns[nPattern]; + const MODCOMMAND m0 = MODCOMMAND::Empty(); + const MODCOMMAND *pPattern = pSndFile->Patterns[nPattern]; CHAR s[256]; CRect rect; int xpaint, ypaint = *pypaint; @@ -739,7 +774,6 @@ UINT bRowSel, bSpeedUp, nColumnWidth, ncols, maxcol; ncols = pSndFile->GetNumChannels(); - m0.note = m0.instr = m0.vol = m0.volcmd = m0.command = m0.param = 0; nColumnWidth = m_szCell.cx; rect.SetRect(m_szHeader.cx, rcClient.top, m_szHeader.cx+nColumnWidth, rcClient.bottom); for (UINT cmk=xofs; cmk<ncols; cmk++) @@ -855,15 +889,17 @@ xbmp = nbmp = 0; do { - DWORD dwSpeedUpMask; - MODCOMMAND *m; int x, bk_col, tx_col, col_sel, fx_col; - m = (pPattern) ? &pPattern[row*ncols+col] : &m0; - dwSpeedUpMask = 0; + const MODCOMMAND *m = (pPattern) ? &pPattern[row*ncols+col] : &m0; + + // Should empty volume commands be replaced with a volume command showing the default volume? + const bool drawDefaultVolume = (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SHOWDEFAULTVOLUME) && m->volcmd == VOLCMD_NONE && m->instr != 0 && m->note != NOTE_NONE && NOTE_IS_VALID(m->note); + + DWORD dwSpeedUpMask = 0; if ((bSpeedUp) && (bColSel[col] & 0x40) && (pPattern) && (row)) { - MODCOMMAND *mold = m - ncols; + const MODCOMMAND *mold = m - ncols; if (m->note == mold->note) dwSpeedUpMask |= 0x01; if ((m->instr == mold->instr) || (m_nDetailLevel < 1)) dwSpeedUpMask |= 0x02; if ( m->IsPcNote() || mold->IsPcNote() ) @@ -876,8 +912,8 @@ } else { - if (((m->volcmd == mold->volcmd) && ((!m->volcmd) || (m->vol == mold->vol))) || (m_nDetailLevel < 2)) dwSpeedUpMask |= 0x04; - if ((m->command == mold->command) || (m_nDetailLevel < 3)) dwSpeedUpMask |= (m->command) ? 0x08 : 0x18; + if ((m->volcmd == mold->volcmd && (m->volcmd == VOLCMD_NONE || m->vol == mold->vol) && !drawDefaultVolume) || (m_nDetailLevel < 2)) dwSpeedUpMask |= 0x04; + if ((m->command == mold->command) || (m_nDetailLevel < 3)) dwSpeedUpMask |= (m->command != CMD_NONE) ? 0x08 : 0x18; } if (dwSpeedUpMask == 0x1F) goto DoBlit; } @@ -958,15 +994,19 @@ { tx_col = MODCOLOR_TEXTSELECTED; bk_col = MODCOLOR_BACKSELECTED; - } else - if ((!m->IsPcNote()) && (m->volcmd) && (m->volcmd < MAX_VOLCMDS) && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) + } else if (!m->IsPcNote() && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { - if(volEffectColors[m->volcmd] != 0) + if(m->volcmd != VOLCMD_NONE && m->volcmd < MAX_VOLCMDS && volEffectColors[m->volcmd] != 0) + { tx_col = volEffectColors[m->volcmd]; + } else if(drawDefaultVolume) + { + tx_col = MODCOLOR_DEFAULTVOLUME; + } } // Drawing Volume m_Dib.SetTextColor(tx_col, bk_col); - DrawVolumeCommand(xbmp+x, 0, *m); + DrawVolumeCommand(xbmp + x, 0, *m, drawDefaultVolume); } x += pfnt->nEltWidths[2]; } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-10-06 15:37:37 UTC (rev 1093) @@ -157,6 +157,7 @@ MAX_MODCOLORS, // Internal color codes (not saved to color preset files) MODCOLOR_2NDHIGHLIGHT, + MODCOLOR_DEFAULTVOLUME, MAX_MODPALETTECOLORS }; @@ -193,7 +194,7 @@ #define PATTERN_AUTODELAY 0x2000000 // automatically insert delay commands in pattern when entering notes #define PATTERN_NOTEFADE 0x4000000 // alt. note fade behaviour when entering notes #define PATTERN_OVERFLOWPASTE 0x8000000 // continue paste in the next pattern instead of cutting off -//#define PATTERN_POSITIONAWARETIMER 0x10000000 // try to set the timer in the statusbar when jumping around in modules (deprecated, it generated too much load in the code due to some bugs, hence it was made optional. those bugs are now resolved, so there's no point in keeping this flag.) +#define PATTERN_SHOWDEFAULTVOLUME 0x10000000 // if there is no volume command next to note+instr, display the sample's default volume. #define PATTERN_RESETCHANNELS 0x20000000 // reset channels when looping #define PATTERN_LIVEUPDATETREE 0x40000000 // update active sample / instr icons in treeview Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2011-10-06 15:37:37 UTC (rev 1093) @@ -562,6 +562,7 @@ {PATTERN_LIVEUPDATETREE,"Update sample status in tree", "If enabled, active samples and instruments will be indicated by a different icon in the treeview."}, {PATTERN_NOCLOSEDIALOG, "Disable modern close dialog", "When closing the main window, a confirmation window is shown for every unsaved document instead of one single window with a list of unsaved documents."}, {PATTERN_DBLCLICKSELECT, "Double-click to select channel", "Instead of showing the note properties, double-clicking a pattern cell selects the whole channel."}, + {PATTERN_SHOWDEFAULTVOLUME, "Show default volume commands", "If there is no volume command next to a note + instrument combination, the sample's default volume is shown."}, }; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-10-06 15:37:37 UTC (rev 1093) @@ -366,8 +366,8 @@ m_dwPatternSetup &= ~0x200000; // dito if(vIniVersion < MAKE_VERSION_NUMERIC(1,20,00,07)) m_dwPatternSetup &= ~0x400000; // dito - if(vIniVersion < MptVersion::num) - m_dwPatternSetup &= ~0x10000000; // various deprecated old options + if(vIniVersion < MAKE_VERSION_NUMERIC(1,20,00,39)) + m_dwPatternSetup &= ~0x10000000; // dito m_nRowHighlightMeasures = CMainFrame::GetPrivateProfileDWord("Pattern Editor", "RowSpacing", m_nRowHighlightMeasures, iniFile); m_nRowHighlightBeats = CMainFrame::GetPrivateProfileDWord("Pattern Editor", "RowSpacing2", m_nRowHighlightBeats, iniFile); Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/View_pat.h 2011-10-06 15:37:37 UTC (rev 1093) @@ -208,7 +208,7 @@ void DrawLetter(int x, int y, char letter, int sizex=10, int ofsx=0); void DrawNote(int x, int y, UINT note, CTuning* pTuning = NULL); void DrawInstrument(int x, int y, UINT instr); - void DrawVolumeCommand(int x, int y, const MODCOMMAND mc); + void DrawVolumeCommand(int x, int y, const MODCOMMAND &mc, bool drawDefaultVolume); void DrawChannelVUMeter(HDC hdc, int x, int y, UINT nChn); void UpdateAllVUMeters(MPTNOTIFICATION *pnotify); void DrawDragSel(HDC hdc); Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2011-10-06 15:37:37 UTC (rev 1093) @@ -138,6 +138,8 @@ <CompileAs>Default</CompileAs> <ExceptionHandling>Async</ExceptionHandling> <AdditionalOptions>/O2 %(AdditionalOptions)</AdditionalOptions> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FloatingPointModel>Fast</FloatingPointModel> </ClCompile> <ResourceCompile> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-10-06 12:21:52 UTC (rev 1092) +++ trunk/OpenMPT/mptrack/version.h 2011-10-06 15:37:37 UTC (rev 1093) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 38 +#define VER_MINORMINOR 39 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |