Displaying long track names

Long track names displayed in the Track Control Panel are cut off after about 10 characters. The only way to see the full name is to click on the Track Drop-Down Menu and on Name to rename it.

Ideas to let one see the whole name:

  • Allow the control Panel to be widened
  • Display the name on two lines
  • Display the start and the end of long names, e.g. “Very long track name” is displayed as “Very…name”
  • Display the full name as a tooltip when you hover over it
  • Display the name of the selected track in the status bar, near the “actual rate”

There is a new setting in Preferences that you might like to try:
Edit menu > Preferences > Interface > Show track name in waveform display

Nice! I didn’t think of putting it there.

How come sometimes the name is shown in black, and sometimes in yellow? It looks like it changes when you’re scrolling down, just as a name starts to go off the top of the screen. It and the one in the next track turn yellow, but not the one after that.

Do you have any label tracks?
I get names in black after a label track (which I think is a bug) but not otherwise.

Yes, I’ve got lots of them. So the colour is meant to be black for label tracks and yellow for audio tracks?

The yellow is quite readable, sometimes more so when there’s a spectrogram displayed. It might be handy at times to be able to toggle the colour.

That would be a feature request. Please feel free to post it here: Adding Features - Audacity Forum
Interestingly the original version of “display names in audio track” did allow the colour to be set by the user, but I think there were problems implementing this reliably on all platforms.

The names are supposed to be yellow in audio tracks.
Names in tracks is only for audio tracks as far as I’m aware.
Are you getting names in label tracks?

No, I’m not - sorry, I thought I remembered that it did. (Why don’t they?)

I see what you mean by them being black after a label track. However, if you have another label track further down below some more audio tracks, the name colour of the audio tracks in between the label tracks changes as you scroll up and down.

It’s a great feature, by the way. It’s much easier to identify my tracks now.

Yes I see that too.
There is obviously a bug here. I’ve asked Edgar (who wrote the original version of this feature) if he has any idea what the problem is. I’ll see if he can shed some light on it before I submit a bug report.

Unfortunately, I did not really have anything to do with developing this feature. After one of the Developers implemented a very bare-bones version I offered some thoughts on making the feature more user-friendly. None of my code was used but I might have been instrumental in getting the color changed to yellow.

I just tried out SVN HEAD and I see the bug. In my customized version that I run I do not have the bug. The code that I use to draw in the track names is significantly different from the production code. I have extended the concept of drawing the track name in for all of the other appropriate track types (MIDI, spectrogram, others? – but not time tracks and label tracks). Because of this the text drawing code was moved to where it belongs, not where it currently is. The place where the text drawing code currently resides (as I recall) only gets colorized when the track is opened and subsequent refreshes don’t get colorized – this was the bug that I pointed out (and showed how to fix) many months ago.

This is a trivial bug fix and any of the Developers could fix it in a couple of minutes.

Thanks a lot Edgar. I’ll get the bug report in.

Just a bit of conjecture/guesswork here:
Am I right in thinking that the problem is in TrackArtiste.cpp
line 324:

   wxFont labelFont(12, wxSWISS, wxNORMAL, wxNORMAL);
   dc.SetFont(labelFont);
   dc.SetTextForeground(wxColour(255, 255, 0));

needs to be later - somewhere around line 423 so that the colour/font is set when the wavetrack is drawn?

Exactly. To do it “right” it needs to look vaguely like this (we would have to rip out – or maybe not – the bits which read the color from the configuration file); note also that this code could be simplified so that there was only one call for getting the color instead of getting the color in every Case in which we desire to draw the label – personally, I would leave it as is as it makes the code more readable:

void TrackArtist::DrawTrack(const Track * t,
                            wxDC & dc,
                            const wxRect & r,
                            const ViewInfo * viewInfo,
                            bool drawEnvelope,
                            bool drawSamples,
                            bool drawSliders,
                            bool hasSolo)
{
   switch (t->GetKind()) {
   case Track::Wave:
   {
      WaveTrack* wt = (WaveTrack*)t;
      for (WaveClipList::compatibility_iterator it=wt->GetClipIterator(); it; it=it->GetNext()) {
         it->GetData()->ClearDisplayRect();
      }

      bool muted = (hasSolo || t->GetMute()) && !t->GetSolo();

      switch (wt->GetDisplay()) {
      case WaveTrack::WaveformDisplay:
         DrawWaveform(wt, dc, r, viewInfo,
                      drawEnvelope, drawSamples, drawSliders, false, muted);
         break;
      case WaveTrack::WaveformDBDisplay:
         DrawWaveform(wt, dc, r, viewInfo,
                      drawEnvelope,  drawSamples, drawSliders, true, muted);
         break;
      case WaveTrack::SpectrumDisplay:
         DrawSpectrum(wt, dc, r, viewInfo, false, false);
         break;
      case WaveTrack::SpectrumLogDisplay:
         DrawSpectrum(wt, dc, r, viewInfo, false, true);
         break;
      case WaveTrack::PitchDisplay:
         DrawSpectrum(wt, dc, r, viewInfo, true, false);
         break;
      }
      //efm5 start
//we want to drive on top of (thus after) the audio
      if (mbShowTrackNameInWaveform && wt->GetChannel() != Track::RightChannel) {
         const wxColour& originalForegroundTextColor = dc.GetTextForeground();
         wxString fontColorAsString;
         if (gPrefs->Read(wxT("/GUI/FontColorForNameInWaveform"), &fontColorAsString)) {
            wxColour newForegroundColorFromPrefs(fontColorAsString);
            dc.SetTextForeground(newForegroundColorFromPrefs);
         }
         else {
            wxColour newForegroundColor(0, 0, 0);
            dc.SetTextForeground(newForegroundColor);
         }
         dc.DrawText (wt->GetName(), r.x+10, r.y);  // move right 10 pixels to avoid overwriting <- symbol
         dc.SetTextForeground(originalForegroundTextColor);
      }
      //efm5 end
      break;              // case Wave
   }
   #ifdef USE_MIDI
   case Track::Note:
   {
      bool muted = (hasSolo || t->GetMute()) && !t->GetSolo();
      DrawNoteTrack((NoteTrack *)t, dc, r, viewInfo, muted);
      //efm5 start
      if (mbShowTrackNameInWaveform) {
         const wxColour& originalForegroundTextColor = dc.GetTextForeground();
         wxString fontColorAsString;
         if (gPrefs->Read(wxT("/GUI/FontColorForNameInWaveform"), &fontColorAsString)) {
            wxColour newForegroundColorFromPrefs(fontColorAsString);
            dc.SetTextForeground(newForegroundColorFromPrefs);
         }
         else {
            wxColour newForegroundColor(0, 0, 0);
            dc.SetTextForeground(newForegroundColor);
         }
         dc.DrawText (t->GetName(), r.x+5, r.y);  // move right 5 pixels
         dc.SetTextForeground(originalForegroundTextColor);
      }
      //efm5 end
      break;
   }
   #endif // USE_MIDI
   case Track::Label:
      DrawLabelTrack((LabelTrack *)t, dc, r, viewInfo);
      break;
   case Track::Time:
      DrawTimeTrack((TimeTrack *)t, dc, r, viewInfo);
      break;
   }
}

Thanks Edgar.
I’ve already posted a patch to bugzilla that worked on my machine (and included a disclaimer that I may not know what I’m talking about :smiley:)