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

Don't give clips a hidden default name (Fix #5528) #5621

Merged
merged 9 commits into from
Sep 21, 2020
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ SET(PROJECT_EMAIL "[email protected]")
SET(PROJECT_DESCRIPTION "${PROJECT_NAME_UCASE} - Free music production software")
SET(PROJECT_COPYRIGHT "2008-${PROJECT_YEAR} ${PROJECT_AUTHOR}")
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "2")
SET(VERSION_RELEASE "2")
SET(VERSION_STAGE "")
SET(VERSION_BUILD "0")
SET(VERSION_MINOR "3")
SET(VERSION_RELEASE "0")
SET(VERSION_STAGE "alpha")
SET(VERSION_BUILD "1")
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
IF(VERSION_STAGE)
SET(VERSION "${VERSION}-${VERSION_STAGE}")
Expand Down
2 changes: 1 addition & 1 deletion include/AutomationPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public slots:
ProgressionTypes m_progressionType;

bool m_dragging;

bool m_isRecording;
float m_lastRecordedValue;

Expand Down
2 changes: 1 addition & 1 deletion include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class LMMS_EXPORT DataFile : public QDomDocument
void upgrade_1_1_91();
void upgrade_1_2_0_rc3();
void upgrade_1_2_0_rc2_42();
void upgrade_1_3_0_alpha_1();
void upgrade_1_3_0();

void upgrade();
Expand Down Expand Up @@ -135,4 +136,3 @@ const QString LDF_VERSION_STRING = QString::number( LDF_MAJOR_VERSION ) + "." +


#endif

5 changes: 0 additions & 5 deletions src/core/AutomationPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,3 @@ void AutomationPattern::generateTangents( timeMap::const_iterator it,
it++;
}
}





48 changes: 39 additions & 9 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,10 @@ void DataFile::upgrade_0_4_0_rc2()
void DataFile::upgrade_1_0_99()
{
jo_id_t last_assigned_id = 0;

QList<jo_id_t> idList;
findIds(documentElement(), idList);

QDomNodeList list = elementsByTagName("ladspacontrols");
for(int i = 0; !list.item(i).isNull(); ++i)
{
Expand All @@ -791,22 +791,22 @@ void DataFile::upgrade_1_0_99()
QDomElement me = createElement("data");
me.setAttribute("value", el.attribute("data"));
me.setAttribute("scale_type", "log");

jo_id_t id;
for(id = last_assigned_id + 1;
idList.contains(id); id++)
{
}

last_assigned_id = id;
idList.append(id);
me.setAttribute("id", id);
el.appendChild(me);

}
}
}
}
}
}


Expand Down Expand Up @@ -1047,7 +1047,7 @@ void DataFile::upgrade_1_3_0()

QDomElement attribute = attributes.item( k ).toElement();
if( attribute.attribute( "name" ) == "file" &&
( attribute.attribute( "value" ) == "calf" ||
( attribute.attribute( "value" ) == "calf" ||
attribute.attribute( "value" ) == "calf.so" ) )
{
attribute.setAttribute( "value", "veal" );
Expand Down Expand Up @@ -1311,7 +1311,7 @@ void DataFile::upgrade_1_3_0()
};
iterate_ladspa_ports(effect, fn);
}

if( attribute.attribute( "name" ) == "plugin" &&
attribute.attribute( "value" ) == "StereoTools" )
{
Expand All @@ -1335,6 +1335,35 @@ void DataFile::upgrade_1_3_0()
}
}

void DataFile::upgrade_1_3_0_alpha_1()
{
QDomNodeList tracks = elementsByTagName("track");

auto clearDefaultNames = [](QDomNodeList clips, QString trackName)
{
for (int j = 0; !clips.item(j).isNull(); ++j)
{
QDomElement clip = clips.item(j).toElement();
QString clipName = clip.attribute("name", "");
if (clipName == trackName){ clip.setAttribute("name", ""); }
}
};

for (int i = 0; !tracks.item(i).isNull(); ++i)
{
QDomElement track = tracks.item(i).toElement();
QString trackName = track.attribute("name", "");

QDomNodeList instClips = elementsByTagName("pattern");
QDomNodeList autoClips = elementsByTagName("automationpattern");
QDomNodeList bbClips = elementsByTagName("bbtco");

clearDefaultNames(instClips, trackName);
clearDefaultNames(autoClips, trackName);
clearDefaultNames(bbClips, trackName);
}
}


void DataFile::upgrade()
{
Expand Down Expand Up @@ -1417,6 +1446,7 @@ void DataFile::upgrade()
upgrade_1_2_0_rc3();
upgrade_1_2_0_rc2_42();
}
if (version < "1.3.0-alpha-1"){ upgrade_1_3_0_alpha_1(); }
if( version < "1.3.0" )
{
upgrade_1_3_0();
Expand Down Expand Up @@ -1536,7 +1566,7 @@ void findIds(const QDomElement& elem, QList<jo_id_t>& idList)
idList.append(elem.attribute("id").toInt());
}
QDomElement child = elem.firstChildElement();
while(!child.isNull())
while(!child.isNull())
{
findIds(child, idList);
child = child.nextSiblingElement();
Expand Down
7 changes: 0 additions & 7 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1865,13 +1865,6 @@ bool TrackContentWidget::pasteSelection( MidiTime tcoPos, const QMimeData * md,
{
tco->selectViewOnCreate( true );
}

//check tco name, if the same as source track name dont copy
QString sourceTrackName = outerTCOElement.attributeNode( "trackName" ).value();
if( tco->name() == sourceTrackName )
{
tco->setName( "" );
}
}

AutomationPattern::resolveAllIDs();
Expand Down
31 changes: 14 additions & 17 deletions src/tracks/BBTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void BBTCO::saveSettings( QDomDocument & doc, QDomElement & element )
element.setAttribute( "len", length() );
element.setAttribute( "muted", isMuted() );
element.setAttribute( "color", color() );

if( m_useStyleColor )
{
element.setAttribute( "usestyle", 1 );
Expand Down Expand Up @@ -106,10 +106,10 @@ void BBTCO::loadSettings( const QDomElement & element )
{
setColor( QColor( element.attribute( "color" ).toUInt() ) );
}

if( element.hasAttribute( "usestyle" ) )
{
if( element.attribute( "usestyle" ).toUInt() == 1 )
if( element.attribute( "usestyle" ).toUInt() == 1 )
{
m_useStyleColor = true;
}
Expand Down Expand Up @@ -212,12 +212,12 @@ void BBTCOView::paintEvent( QPaintEvent * )
QLinearGradient lingrad( 0, 0, 0, height() );
QColor c;
bool muted = m_bbTCO->getTrack()->isMuted() || m_bbTCO->isMuted();

// state: selected, muted, default, user selected
c = isSelected() ? selectedColor() : ( muted ? mutedBackgroundColor()
: ( m_bbTCO->m_useStyleColor ? painter.background().color()
c = isSelected() ? selectedColor() : ( muted ? mutedBackgroundColor()
: ( m_bbTCO->m_useStyleColor ? painter.background().color()
: m_bbTCO->colorObj() ) );

lingrad.setColorAt( 0, c.lighter( 130 ) );
lingrad.setColorAt( 1, c.lighter( 70 ) );

Expand All @@ -232,7 +232,7 @@ void BBTCOView::paintEvent( QPaintEvent * )
{
p.fillRect( rect(), c );
}

// bar lines
const int lineSize = 3;
p.setPen( c.darker( 200 ) );
Expand All @@ -256,12 +256,12 @@ void BBTCOView::paintEvent( QPaintEvent * )
// inner border
p.setPen( c.lighter( 130 ) );
p.drawRect( 1, 1, rect().right() - TCO_BORDER_WIDTH,
rect().bottom() - TCO_BORDER_WIDTH );
rect().bottom() - TCO_BORDER_WIDTH );

// outer border
p.setPen( c.darker( 300 ) );
p.drawRect( 0, 0, rect().right(), rect().bottom() );

// draw the 'muted' pixmap only if the pattern was manualy muted
if( m_bbTCO->isMuted() )
{
Expand All @@ -270,11 +270,11 @@ void BBTCOView::paintEvent( QPaintEvent * )
p.drawPixmap( spacing, height() - ( size + spacing ),
embed::getIconPixmap( "muted", size, size ) );
}

p.end();

painter.drawPixmap( 0, 0, m_paintPixmap );

}


Expand All @@ -290,10 +290,7 @@ void BBTCOView::openInBBEditor()



void BBTCOView::resetName()
{
m_bbTCO->setName( m_bbTCO->getTrack()->name() );
}
void BBTCOView::resetName() { m_bbTCO->setName(""); }



Expand Down
13 changes: 1 addition & 12 deletions src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ InstrumentTrack::~InstrumentTrack()
autoAssignMidiDevice(false);
s_autoAssignedTrack = NULL;
}

// kill all running notes and the iph
silenceAllNotes( true );

Expand Down Expand Up @@ -535,17 +535,6 @@ void InstrumentTrack::deleteNotePluginData( NotePlayHandle* n )

void InstrumentTrack::setName( const QString & _new_name )
{
// when changing name of track, also change name of those patterns,
// which have the same name as the instrument-track
for( int i = 0; i < numOfTCOs(); ++i )
{
Pattern* p = dynamic_cast<Pattern*>( getTCO( i ) );
if( ( p != NULL && p->name() == name() ) || p->name() == "" )
{
p->setName( _new_name );
}
}

Track::setName( _new_name );
m_midiPort.setName( name() );
m_audioPort.setName( name() );
Expand Down
10 changes: 3 additions & 7 deletions src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Pattern::Pattern( InstrumentTrack * _instrument_track ) :
m_patternType( BeatPattern ),
m_steps( MidiTime::stepsPerBar() )
{
setName( _instrument_track->name() );
if( _instrument_track->trackContainer()
== Engine::getBBTrackContainer() )
{
Expand Down Expand Up @@ -649,10 +648,7 @@ void PatternView::setGhostInPianoRoll()



void PatternView::resetName()
{
m_pat->setName( m_pat->m_instrumentTrack->name() );
}
void PatternView::resetName() { m_pat->setName(""); }



Expand Down Expand Up @@ -887,8 +883,8 @@ void PatternView::paintEvent( QPaintEvent * )

// Check whether we will paint a text box and compute its potential height
// This is needed so we can paint the notes underneath it.
bool const isDefaultName = m_pat->name() == m_pat->instrumentTrack()->name();
bool const drawTextBox = !beatPattern && !isDefaultName;
bool const drawName = !m_pat->name().isEmpty();
bool const drawTextBox = !beatPattern && drawName;

// TODO Warning! This might cause problems if TrackContentObjectView::paintTextLabel changes
int textBoxHeight = 0;
Expand Down