Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add of a line width parameter for graphical rendering of segment tracks and marker tracks #18

Merged
merged 11 commits into from
Sep 19, 2024
Merged
1 change: 1 addition & 0 deletions BinaryData/Resource/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

- Add: Addition of a line width parameter for graphical rendering of curve tracks and marker tracks
- Add: Add OSC support for sending analysis values on mouseover
- Fix: The "Ignore Matrix Tracks" export option prevents these tracks from being exported independently
- Add: Add a logarithmic scale parameter to tracks that have frequency values in hertz enhancement
Expand Down
4 changes: 3 additions & 1 deletion Docs/Partiels-Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ A color can be modified using the color selector that is prompted by clicking on

**Tip**: The plugin can support its own color mapping. In this case, the color map property is not accessible.

#### 9.2.2. Font
#### 9.2.2. Font, Label and Line Width

The font properties are only available for marker or point type analyses. By default, the font *Nunito Sans* with a size of 14 and a regular style is used. You can change the font according to the ones available on your system (if you load a document using a font that is not present on your system, the default font is used). It may be necessary to use another font if some characters are not supported.

Expand All @@ -653,6 +653,8 @@ The font properties are only available for marker or point type analyses. By def
- Font Style: The style of the font used to render the labels of the markers or the values of the points. The list of available styles depends on the font family (name).
- Font Size: The size of the font used to render the labels of the markers or the values of the points. You can click on the text to define textually a size that would not be accessible in the list.

- Line Width: The line width used to render the the segments and markers.

Label properties are only available for marker analyses. They allow you to adapt the position of marker labels on the graphical representation.

<p align="center">
Expand Down
22 changes: 11 additions & 11 deletions Docs/Project/J'attendrai.ptldoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
<layout value="daaaa5e9ca9440919fee0457c301a5ae"/>
<layout value="66cf756a43824c299a0256f18b5df652"/>
<timeZoom MiscModelVersion="131077" globalRange_start="0.0" globalRange_end="57.12369614512472"
minimumLength="0.01160997732426304" visibleRange_start="6.833910363234121"
visibleRange_end="17.05217626551128">
minimumLength="0.01160997732426304" visibleRange_start="17.66830186991283"
visibleRange_end="46.09175495829903">
<grid MiscModelVersion="131077" tickReference="0.0" mainTickInterval="0"
tickPowerBase="2.0" tickDivisionFactor="10.0"/>
</timeZoom>
<transport MiscModelVersion="131077" startPlayhead="9.150473751017453" looping="0"
<transport MiscModelVersion="131077" startPlayhead="26.83089326921248" looping="0"
loopRange_start="55.674250339" loopRange_end="56.208309296" stopAtLoopEnd="0"
autoScroll="1" gain="0.06478693864793536" magnetize="0"/>
<groups MiscModelVersion="131077" identifier="66cf756a43824c299a0256f18b5df652"
Expand All @@ -43,8 +43,8 @@
</groups>
<tracks MiscModelVersion="131077" identifier="2476c2bd12534fc48f5612a755917925"
name="Fast Fourier Transform" input="" sampleRate="44100.0" height="360"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="1"
zoomValueMode="1" zoomLogScale="0" zoomLink="1">
font="Nunito Sans; 14.0 Regular" lineWidth="1.0" showInGroup="1"
sendViaOsc="1" zoomValueMode="1" zoomLogScale="0" zoomLink="1">
<file path="" commit="">
<args/>
</file>
Expand Down Expand Up @@ -640,8 +640,8 @@
</tracks>
<tracks MiscModelVersion="131077" identifier="03570fdcd3f14391a13d069fcabdf7ef"
name="Spectral Centroid" input="" sampleRate="44100.0" height="336"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="1"
zoomValueMode="1" zoomLogScale="0" zoomLink="1">
font="Nunito Sans; 14.0 Regular" lineWidth="2.0" showInGroup="1"
sendViaOsc="1" zoomValueMode="1" zoomLogScale="0" zoomLink="1">
<file path="" commit="">
<args/>
</file>
Expand Down Expand Up @@ -729,8 +729,8 @@
</tracks>
<tracks MiscModelVersion="131077" identifier="4012ed3f6d2a4d5d8b2c0bd4e771088e"
name="Waveform" input="" sampleRate="48000.0" height="109" font="Nunito Sans; 14.0 Regular"
showInGroup="1" sendViaOsc="0" zoomValueMode="1" zoomLogScale="0"
zoomLink="1">
lineWidth="1.0" showInGroup="1" sendViaOsc="0" zoomValueMode="1"
zoomLogScale="0" zoomLink="1">
<file path="" commit="">
<args/>
</file>
Expand Down Expand Up @@ -767,8 +767,8 @@
</tracks>
<tracks MiscModelVersion="131077" identifier="d9dc8ffb44944467a7099d1f9877f1ac"
name="Beat Detection" input="" sampleRate="48000.0" height="109"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="1"
zoomValueMode="0" zoomLogScale="0" zoomLink="1">
font="Nunito Sans; 14.0 Regular" lineWidth="1.0" showInGroup="1"
sendViaOsc="1" zoomValueMode="0" zoomLogScale="0" zoomLink="1">
<file path="" commit="">
<args/>
</file>
Expand Down
1 change: 1 addition & 0 deletions Source/Group/AnlGroupPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Group::Plot::Plot(Accessor& accessor, Zoom::Accessor& timeZoomAcsr)
case Track::AttrType::graphics:
case Track::AttrType::colours:
case Track::AttrType::font:
case Track::AttrType::lineWidth:
case Track::AttrType::unit:
case Track::AttrType::labelLayout:
case Track::AttrType::channelsLayout:
Expand Down
58 changes: 57 additions & 1 deletion Source/Group/AnlGroupPropertyGraphicalsSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ Group::PropertyGraphicalsSection::PropertyGraphicalsSection(Director& director)
setFontSize(mPropertyFontSize.entry.getText().getFloatValue());
mDirector.endAction(true, ActionState::newTransaction, juce::translate("Change group's font size"));
})
, mPropertyLineWidth(juce::translate("Line Width"), juce::translate("The line width for the graphical renderers of the tracks of the group."), "", {1.0f, 100.0f}, 0.5f, [&](float value)
{
mDirector.startAction(true);
setLineWidth(value);
mDirector.endAction(true, ActionState::newTransaction, juce::translate("Change group's line width"));
})
, mPropertyUnit(juce::translate("Unit"), juce::translate("The unit of the values for the graphical renderers of the tracks of the group."), [&](juce::String text)
{
setUnit(text);
Expand Down Expand Up @@ -195,12 +201,15 @@ Group::PropertyGraphicalsSection::PropertyGraphicalsSection(Director& director)
{
updateContent();
},
{Track::AttrType::identifier, Track::AttrType::name, Track::AttrType::colours, Track::AttrType::font, Track::AttrType::unit, Track::AttrType::description, Track::AttrType::channelsLayout, Track::AttrType::showInGroup, Track::AttrType::results, Track::AttrType::hasPluginColourMap, Track::AttrType::zoomLogScale})
{Track::AttrType::identifier, Track::AttrType::name, Track::AttrType::colours, Track::AttrType::font, Track::AttrType::lineWidth, Track::AttrType::unit, Track::AttrType::description, Track::AttrType::channelsLayout, Track::AttrType::showInGroup, Track::AttrType::results, Track::AttrType::hasPluginColourMap, Track::AttrType::zoomLogScale})
{
mPropertyFontSize.entry.setEditableText(true);
mPropertyFontSize.entry.getProperties().set("isNumber", true);
NumberField::Label::storeProperties(mPropertyFontSize.entry.getProperties(), {4.0, 200.0}, 0.1, 1, "");

mPropertyLineWidth.entry.getProperties().set("isNumber", true);
NumberField::Label::storeProperties(mPropertyLineWidth.entry.getProperties(), {1.0, 100.0}, 0.5, 1, "");

addAndMakeVisible(mPropertyColourMap);
addAndMakeVisible(mPropertyForegroundColour);
addAndMakeVisible(mPropertyDurationColour);
Expand All @@ -210,6 +219,7 @@ Group::PropertyGraphicalsSection::PropertyGraphicalsSection(Director& director)
addAndMakeVisible(mPropertyFontName);
addAndMakeVisible(mPropertyFontStyle);
addAndMakeVisible(mPropertyFontSize);
addAndMakeVisible(mPropertyLineWidth);
addAndMakeVisible(mPropertyUnit);
addAndMakeVisible(mPropertyLabelJustification);
addAndMakeVisible(mPropertyLabelPosition);
Expand Down Expand Up @@ -238,6 +248,7 @@ void Group::PropertyGraphicalsSection::resized()
setBounds(mPropertyFontName);
setBounds(mPropertyFontStyle);
setBounds(mPropertyFontSize);
setBounds(mPropertyLineWidth);
setBounds(mPropertyUnit);
setBounds(mPropertyLabelJustification);
setBounds(mPropertyLabelPosition);
Expand Down Expand Up @@ -420,6 +431,24 @@ void Group::PropertyGraphicalsSection::setFontSize(float size)
updateFont();
}

void Group::PropertyGraphicalsSection::setLineWidth(float size)
{
auto const trackAcsrs = copy_with_erased_if(Tools::getTrackAcsrs(mAccessor), [](auto const& trackAcsr)
{
return Track::Tools::getFrameType(trackAcsr.get()) == Track::FrameType::vector;
});
if(trackAcsrs.empty())
{
return;
}

for(auto& trackAcsr : trackAcsrs)
{
trackAcsr.get().setAttr<Track::AttrType::lineWidth>(size, NotificationType::synchronous);
}
updateLineWidth();
}

void Group::PropertyGraphicalsSection::setUnit(juce::String const& unit)
{
auto const trackAcsrs = copy_with_erased_if(Tools::getTrackAcsrs(mAccessor), [](auto const& trackAcsr)
Expand Down Expand Up @@ -581,6 +610,7 @@ void Group::PropertyGraphicalsSection::updateContent()
updateColourMap();
updateColours();
updateFont();
updateLineWidth();
updateUnit();
updateLabel();
updateLogScale();
Expand Down Expand Up @@ -776,6 +806,32 @@ void Group::PropertyGraphicalsSection::updateFont()
resized();
}

void Group::PropertyGraphicalsSection::updateLineWidth()
{
juce::StringArray trackNames;
std::set<float> lineWidth;
for(auto const& trackAcsr : Tools::getTrackAcsrs(mAccessor))
{
if(Track::Tools::getFrameType(trackAcsr.get()) != Track::FrameType::vector)
{
lineWidth.insert(trackAcsr.get().getAttr<Track::AttrType::lineWidth>());
trackNames.add(trackAcsr.get().getAttr<Track::AttrType::name>());
}
}

mPropertyLineWidth.setTooltip("Track(s): " + trackNames.joinIntoString(", ") + " - " + juce::translate("The line width used by the graphical renderers of the tracks of the group."));
mPropertyLineWidth.setVisible(!lineWidth.empty());
if(lineWidth.size() == 1_z)
{
mPropertyLineWidth.entry.setValue(static_cast<double>(*lineWidth.cbegin()), juce::NotificationType::dontSendNotification);
}
else if(lineWidth.size() > 1_z)
{
mPropertyLineWidth.entry.setText(juce::translate("Multiple Values"), juce::NotificationType::dontSendNotification);
}
resized();
}

void Group::PropertyGraphicalsSection::updateUnit()
{
juce::StringArray trackNames;
Expand Down
3 changes: 3 additions & 0 deletions Source/Group/AnlGroupPropertyGraphicalsSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Group
void setFontName(juce::String const& name);
void setFontStyle(juce::String const& style);
void setFontSize(float size);
void setLineWidth(float size);
void setUnit(juce::String const& unit);
void setLabelJustification(Track::LabelLayout::Justification justification);
void setLabelPosition(float position);
Expand All @@ -37,6 +38,7 @@ namespace Group
void updateColourMap();
void updateColours();
void updateFont();
void updateLineWidth();
void updateUnit();
void updateLabel();
void updateLogScale();
Expand All @@ -53,6 +55,7 @@ namespace Group
PropertyList mPropertyFontName;
PropertyList mPropertyFontStyle;
PropertyList mPropertyFontSize;
PropertyNumber mPropertyLineWidth;
PropertyText mPropertyUnit;
PropertyList mPropertyLabelJustification;
PropertyNumber mPropertyLabelPosition;
Expand Down
1 change: 1 addition & 0 deletions Source/Group/AnlGroupSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Group::Snapshot::Snapshot(Accessor& accessor, Transport::Accessor& transportAcsr
case Track::AttrType::graphics:
case Track::AttrType::colours:
case Track::AttrType::font:
case Track::AttrType::lineWidth:
case Track::AttrType::unit:
case Track::AttrType::labelLayout:
case Track::AttrType::channelsLayout:
Expand Down
1 change: 1 addition & 0 deletions Source/Track/AnlTrackDirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ Track::Director::Director(Accessor& accessor, juce::UndoManager& undoManager, Hi
case AttrType::focused:
case AttrType::grid:
case AttrType::font:
case AttrType::lineWidth:
case AttrType::unit:
case AttrType::labelLayout:
case AttrType::showInGroup:
Expand Down
7 changes: 7 additions & 0 deletions Source/Track/AnlTrackModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ namespace Track
, height
, colours
, font
, lineWidth
, unit
, labelLayout
, channelsLayout
Expand Down Expand Up @@ -203,6 +204,7 @@ namespace Track
, Model::Attr<AttrType::height, int, Model::Flag::notifying | Model::Flag::saveable>
, Model::Attr<AttrType::colours, ColourSet, Model::Flag::basic>
, Model::Attr<AttrType::font, juce::Font, Model::Flag::basic>
, Model::Attr<AttrType::lineWidth, float, Model::Flag::basic>
, Model::Attr<AttrType::unit, std::optional<juce::String>, Model::Flag::basic>
, Model::Attr<AttrType::labelLayout, LabelLayout, Model::Flag::basic>
, Model::Attr<AttrType::channelsLayout, std::vector<bool>, Model::Flag::basic>
Expand Down Expand Up @@ -251,6 +253,7 @@ namespace Track
, {120}
, {}
, {juce::Font("Nunito Sans", 14.0f, juce::Font::plain)}
, {1.0f}
, {}
, {}
, {std::vector<bool>{}}
Expand All @@ -276,6 +279,10 @@ namespace Track
template <attr_enum_type type, typename value_v>
void setAttr(value_v const& value, NotificationType notification)
{
if constexpr(type == AttrType::lineWidth)
{
Model::Accessor<Accessor, AttrContainer, AcsrContainer>::setAttr<type, value_v>(std::max(value, 1.0f), notification);
}
if constexpr(type == AttrType::channelsLayout)
{
if(!value.empty() && std::none_of(value.cbegin(), value.cend(), [](auto const& state)
Expand Down
1 change: 1 addition & 0 deletions Source/Track/AnlTrackPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Track::Plot::Plot(Accessor& accessor, Zoom::Accessor& timeZoomAccessor)
case AttrType::graphics:
case AttrType::colours:
case AttrType::font:
case AttrType::lineWidth:
case AttrType::unit:
case AttrType::labelLayout:
case AttrType::extraThresholds:
Expand Down
1 change: 1 addition & 0 deletions Source/Track/AnlTrackProgressBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Track::ProgressBar::ProgressBar(Director& director, Mode mode)
case AttrType::height:
case AttrType::colours:
case AttrType::font:
case AttrType::lineWidth:
case AttrType::unit:
case AttrType::labelLayout:
case AttrType::channelsLayout:
Expand Down
18 changes: 18 additions & 0 deletions Source/Track/AnlTrackPropertyGraphicalSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ Track::PropertyGraphicalSection::PropertyGraphicalSection(Director& director)
mAccessor.setAttr<AttrType::font>(font, NotificationType::synchronous);
mDirector.endAction(ActionState::newTransaction, juce::translate("Change track font size"));
})
, mPropertyLineWidth(juce::translate("Line Width"), juce::translate("The line width for the graphical renderer."), "", {1.0f, 100.0f}, 0.5f, [&](float value)
{
mDirector.startAction();
mAccessor.setAttr<AttrType::lineWidth>(value, NotificationType::synchronous);
mDirector.endAction(ActionState::newTransaction, juce::translate("Change the line width for the graphical renderer"));
})
, mPropertyUnit("Unit", "The unit of the values", [&](juce::String text)
{
setUnit(text);
Expand Down Expand Up @@ -302,6 +308,7 @@ Track::PropertyGraphicalSection::PropertyGraphicalSection(Director& director)
mPropertyFontName.setVisible(true);
mPropertyFontStyle.setVisible(true);
mPropertyFontSize.setVisible(true);
mPropertyLineWidth.setVisible(true);
mPropertyLabelJustification.setVisible(true);
mPropertyLabelPosition.setVisible(true);
mPropertyChannelLayout.setVisible(numChannels > 1_z);
Expand All @@ -322,6 +329,7 @@ Track::PropertyGraphicalSection::PropertyGraphicalSection(Director& director)
mPropertyFontName.setVisible(true);
mPropertyFontStyle.setVisible(true);
mPropertyFontSize.setVisible(true);
mPropertyLineWidth.setVisible(true);
mPropertyUnit.setVisible(true);
mPropertyValueRangeMode.setVisible(true);
mPropertyValueRangeLogScale.setVisible(Tools::hasVerticalZoomInHertz(acsr));
Expand Down Expand Up @@ -397,6 +405,12 @@ Track::PropertyGraphicalSection::PropertyGraphicalSection(Director& director)
}
}
break;
case AttrType::lineWidth:
{
auto const& lineWidth = acsr.getAttr<AttrType::lineWidth>();
mPropertyLineWidth.entry.setValue(static_cast<double>(lineWidth), juce::NotificationType::dontSendNotification);
}
break;
case AttrType::labelLayout:
{
auto const& labelLayout = acsr.getAttr<AttrType::labelLayout>();
Expand Down Expand Up @@ -536,6 +550,8 @@ Track::PropertyGraphicalSection::PropertyGraphicalSection(Director& director)
mPropertyFontSize.entry.setEditableText(true);
mPropertyFontSize.entry.getProperties().set("isNumber", true);
NumberField::Label::storeProperties(mPropertyFontSize.entry.getProperties(), {4.0, 200.0}, 0.1, 1, "");
mPropertyLineWidth.entry.getProperties().set("isNumber", true);
NumberField::Label::storeProperties(mPropertyLineWidth.entry.getProperties(), {1.0, 100.0}, 0.5, 1, "");
addAndMakeVisible(mPropertyColourMap);
addAndMakeVisible(mPropertyForegroundColour);
addAndMakeVisible(mPropertyDurationColour);
Expand All @@ -545,6 +561,7 @@ Track::PropertyGraphicalSection::PropertyGraphicalSection(Director& director)
addAndMakeVisible(mPropertyFontName);
addAndMakeVisible(mPropertyFontStyle);
addAndMakeVisible(mPropertyFontSize);
addAndMakeVisible(mPropertyLineWidth);
addAndMakeVisible(mPropertyUnit);
addAndMakeVisible(mPropertyLabelJustification);
addAndMakeVisible(mPropertyLabelPosition);
Expand Down Expand Up @@ -592,6 +609,7 @@ void Track::PropertyGraphicalSection::resized()
setBounds(mPropertyFontName);
setBounds(mPropertyFontStyle);
setBounds(mPropertyFontSize);
setBounds(mPropertyLineWidth);
setBounds(mPropertyUnit);
setBounds(mPropertyLabelJustification);
setBounds(mPropertyLabelPosition);
Expand Down
1 change: 1 addition & 0 deletions Source/Track/AnlTrackPropertyGraphicalSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace Track
PropertyList mPropertyFontName;
PropertyList mPropertyFontStyle;
PropertyList mPropertyFontSize;
PropertyNumber mPropertyLineWidth;
PropertyText mPropertyUnit;
PropertyList mPropertyLabelJustification;
PropertyNumber mPropertyLabelPosition;
Expand Down
1 change: 1 addition & 0 deletions Source/Track/AnlTrackPropertyOscSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Track::PropertyOscSection::PropertyOscSection(Director& director)
case AttrType::warnings:
case AttrType::colours:
case AttrType::font:
case AttrType::lineWidth:
case AttrType::unit:
case AttrType::labelLayout:
case AttrType::channelsLayout:
Expand Down
1 change: 1 addition & 0 deletions Source/Track/AnlTrackPropertyPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Track::PropertyPanel::PropertyPanel(Director& director)
case AttrType::warnings:
case AttrType::colours:
case AttrType::font:
case AttrType::lineWidth:
case AttrType::unit:
case AttrType::labelLayout:
case AttrType::channelsLayout:
Expand Down
Loading