Skip to content

Commit

Permalink
[Imp] When displaying the volume column in hex, also show the effect …
Browse files Browse the repository at this point in the history
…info for it in hex.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22438 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Dec 1, 2024
1 parent 1221be0 commit 3a32192
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mptrack/Draw_pat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ CString CViewPattern::GetCursorDescription() const
effectInfo.GetVolCmdInfo(effectInfo.GetIndexFromVolCmd(m->volcmd), &s);
s += _T(": ");
CString tmp;
effectInfo.GetVolCmdParamInfo(*m, &tmp);
effectInfo.GetVolCmdParamInfo(*m, &tmp, TrackerSettings::Instance().patternVolColHex);
s += tmp;
}
break;
Expand Down
22 changes: 14 additions & 8 deletions mptrack/EffectInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,11 +1026,18 @@ bool EffectInfo::GetVolCmdInfo(UINT ndx, CString *s, ModCommand::VOL *prangeMin,
}


bool EffectInfo::GetVolCmdParamInfo(const ModCommand &m, CString *s) const
bool EffectInfo::GetVolCmdParamInfo(const ModCommand &m, CString *s, bool hex) const
{
if(s == nullptr) return false;
if(s == nullptr)
return false;
s->Empty();

CString volume;
if(hex)
volume = mpt::cfmt::HEX(m.vol);
else
volume = mpt::cfmt::dec(m.vol);

switch(m.volcmd)
{
case VOLCMD_PANNING:
Expand All @@ -1043,9 +1050,8 @@ bool EffectInfo::GetVolCmdParamInfo(const ModCommand &m, CString *s) const
case VOLCMD_FINEVOLDOWN:
if(m.vol > 0 || sndFile.GetType() == MOD_TYPE_XM)
{
s->Format(_T("%c%u"),
(m.volcmd == VOLCMD_VOLSLIDEUP || m.volcmd == VOLCMD_FINEVOLUP) ? _T('+') : _T('-'),
m.vol);
*s = (m.volcmd == VOLCMD_VOLSLIDEUP || m.volcmd == VOLCMD_FINEVOLUP) ? _T('+') : _T('-')
+ volume;
} else
{
*s = _T("continue");
Expand All @@ -1068,8 +1074,8 @@ bool EffectInfo::GetVolCmdParamInfo(const ModCommand &m, CString *s) const
if(sndFile.GetType() != MOD_TYPE_XM) param = ImpulseTrackerPortaVolCmd[m.vol & 0x0F];
else param = m.vol << 4;
}
s->Format(_T("%u (%c%02X)"),
m.vol,
*s = volume;
s->AppendFormat(_T(" (%c%02X)"),
sndFile.GetModSpecifications().GetEffectLetter(cmd),
param);
} else
Expand Down Expand Up @@ -1113,7 +1119,7 @@ bool EffectInfo::GetVolCmdParamInfo(const ModCommand &m, CString *s) const
break;

default:
s->Format(_T("%u"), m.vol);
*s = volume;
break;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion mptrack/EffectInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class EffectInfo
// Get range information, effect name, etc... from a given effect.
bool GetVolCmdInfo(UINT ndx, CString *s, ModCommand::VOL *prangeMin = nullptr, ModCommand::VOL *prangeMax = nullptr) const;
// Get effect name and parameter description
bool GetVolCmdParamInfo(const ModCommand &m, CString *s) const;
bool GetVolCmdParamInfo(const ModCommand &m, CString *s, bool hex) const;
// Map an effect value to slider position
UINT MapVolumeToPos(VolumeCommand cmd, ModCommand::VOL param) const;
// Map slider position to an effect value
Expand Down
2 changes: 1 addition & 1 deletion mptrack/PatternEditorDialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void CEditCommand::UpdateVolCmdValue()
} else
{
// process as effect
effectInfo.GetVolCmdParamInfo(*m, &s);
effectInfo.GetVolCmdParamInfo(*m, &s, TrackerSettings::Instance().patternVolColHex);
}
SetDlgItemText(IDC_TEXT2, s);
}
Expand Down

0 comments on commit 3a32192

Please sign in to comment.