Proposal Label Track Info

From Audacity Wiki
Jump to: navigation, search
Proposal pages help us get from feature requests into actual plans. This page is a proposal to add a Label Track menu choice to display the count of point, region and pre-zero labels in the Label Track Info area.
Proposal pages are used on an ongoing basis by the Audacity development team and are open to edits from visitors to the wiki. They are a good way to get community feedback on a proposal.


  • Note: Proposals for Google Summer of Code projects are significantly different in structure, are submitted via Google's web app and may or may not have a corresponding proposal page.


The Problem

When there are more than a handful of labels it's often difficult to determine their exact number and type (point or region); one must either visually count them or open the Label Editor dialog, scroll to the bottom of the dialog, and examine the line number of the final item. Occasionally there will be labels before time-zero; this can occur when a label exists at a place in the track which has been shifted before zero with the Time Shift tool.

Proposed Feature

Add some text in the otherwise unused portion of the Label Track's Track Info Panel which shows a running count of one or more of Point, Region & Pre-Zero labels.

Optionally, give the user some control over which of the three (Point, Region or Pre-Zero) types are displayed.

Optionally, give the user some control over the font employed when drawing this text in the Track Info Panel. This could be either by inheriting the user's choice for the Label's font or allowing the user to customize the font. If the user may customize the font it could be global (all Label Track Track Info Panels) or per-Label Track.

Developer/QA/User Backing

Gale

Steve

Peter

Edgar

Bill

Koz

Use Cases

On the Audacity forum this post started this proposal:

forum thread

Edgar: "One of the things I do frequently is convert vinyl to digital. I record the whole side in one go – unattended (I'll be listening on the monitor while I garden). After a bit of cleanup (hands and recording) I Analyze Silence to split it up into tracks. I always do a reality check to see that the number of labels is equal to the number of tracks on the vinyl side. I either have to visually count the labels or open the Label Editor."

Koz: (in re. labels before zero) "I don't do this that often and even I have run into this problem."

Details

Adding 6 lines of code to \src\TrackPanel.cpp somewhere vaguely near line number 8070 (in the function: void TrackInfo::DrawTitleBar (…)) as the very last lines of the function:

   AColor::BevelTrackInfo(*dc, !down, bev);

   //new code start

   if (((LabelTrack *)t)->GetKind() == Track::Label) {

      int numberOfLabels = ((LabelTrack *)t)->GetNumLabels();

      wxString number;

      number.Printf(wxT("Labels:  %d"), numberOfLabels);

      dc->DrawText(number, r.x + 3, r.y + textHeight + 3);

   }

   //new code end

}

gives a rudimentary first approximation - presenting just the total number of labels with no distinction between types.</p>

A second approximation displays three types'count. In Experimental.h, at or near line number 154 (just above the final #endif):

#define EXPERIMENTAL_LABEL_TRACKINFOPANEL

This will allow this feature to be turned on and off easily. The code in Track Panel grows considerably; with more than one number we will need to label them and translate the labels (for my needs a single letter for each suffices; in the interest of conserving space here I do not include the code for pre-zero labels nor do I show the functions GetNumberOfPointLabels() etc.; as an example I also include inheriting the font from the Label's font):

#ifdef EXPERIMENTAL_LABEL_TRACKINFOPANEL

   if (((LabelTrack *)t)->GetKind() == Track::Label) {

      int numberOfLabels = ((LabelTrack *)t)->GetNumLabels();

      if (numberOfLabels != 0) {

         dc->SetFont(((LabelTrack *)t)->GetFont());

         #define VERTICAL_SPACING 3

         #define LEFT_MARGIN (r.x + 3)

         int top = r.y + textHeight + VERTICAL_SPACING ;

         wxString numberString;

         int numberOfPoints = ((LabelTrack *)t)->GetNumberOfPointLabels();

         if (numberOfPoints != 0) {

            numberString.Printf(_("Points:  %d"), numberOfPoints);

            dc->DrawText(numberString, LEFT_MARGIN , top);

         }

         int numberOfRegions = ((LabelTrack *)t)->GetNumberOfRegionLabels();

         if (numberOfRegions != 0) {

            top += VERTICAL_SPACING + textHeight;

            numberString.Printf(_("Regions:  %d"), numberOfRegions);

            dc->DrawText(numberString, LEFT_MARGIN , top);

         }

         SetTrackInfoFont(dc);

      }

   }

#endif

}


Implementation and Design Considerations

  • Koz 28Oct14: Is there any idea of making the Before Zero listing more attention-getting? That portion of the timeline is "magic."
    • Gale 29Oct14: If so, the Before Zero text could be in red.

Bug Reports

GUI Examples

Rudimentary first approximation (please ignore the colors and the large font):

Labels1.png

A third approximation; this one puts the label and the count on separate lines so it does not consume so much horizontal space(again, ignore the highly customized GUI):

Labels2.png

This is an image captured from the initial patch. Please ignore the interesting spelling; the additional letters with descenders and the tall capitalized letters are so that I could easily determine the interline spacing):

Labels4.png

Controlling the state of the text displays via the dropdown menu:

ContextLabels.png

Patches

initial patch

Edgar 27 October 2014: The above patch is against SVN HEAD revision 13513. One must edit the Audacity configuration file to turn the features on:

[GUI]

DisplayLabelCounts=1

DisplayPointLabelCount=1

DisplayRegionLabelCount=1

DisplayPreZeroLabelCount=1

SyncLockTracks=1

[GUI/ToolBars]

The first variable DisplayLabelCounts globally turns the feature on and off; if this one is turned off no information will be displayed regardless of the value of the other three. The other three control the individual kinds; if set to 1 the kind count is displayed, if set to 0 it is not. These must be entered into the configuration file in the [GUI] section; make sure you do not put them under one of its subsections.

patch with preferences in the dropdown menu

Edgar 28 October 2014: This patch must be applied instead of the initial patch. If you have already applied the initial patch do an SVN Update back to the original revision 13513 and apply this new patch. This patch introduces the user's control of the preferences for the three count displays by way of the Label Track's Track Info Panel's dropdown menu. I put the three new items at the very bottom but they might be better placed above "Font…".

Previous Feature Requests relating to this proposal

Edgar 3 November 2014: I'm unaware of any.