Audacity  2.2.0
LabelStruct Class Reference

A LabelStruct holds information for ONE label in a LabelTrack. More...

#include <LabelTrack.h>

Classes

struct  BadFormatException
 

Public Types

enum  TimeRelations {
  BEFORE_LABEL, AFTER_LABEL, SURROUNDS_LABEL, WITHIN_LABEL,
  BEGINS_IN_LABEL, ENDS_IN_LABEL
}
 Relationships between selection region and labels. More...
 

Public Member Functions

 LabelStruct (const SelectedRegion &region, const wxString &aTitle)
 
 LabelStruct (const SelectedRegion &region, double t0, double t1, const wxString &aTitle)
 
void DrawLines (wxDC &dc, const wxRect &r) const
 
void DrawGlyphs (wxDC &dc, const wxRect &r, int GlyphLeft, int GlyphRight) const
 
void DrawText (wxDC &dc, const wxRect &r) const
 
void DrawTextBox (wxDC &dc, const wxRect &r) const
 
void DrawHighlight (wxDC &dc, int xPos1, int xPos2, int charHeight) const
 Draws text-selected region within the label. More...
 
void getXPos (wxDC &dc, int *xPos1, int cursorPos) const
 
const SelectedRegiongetSelectedRegion () const
 
double getDuration () const
 
double getT0 () const
 
double getT1 () const
 
bool AdjustEdge (int iEdge, double fNewTime)
 
void MoveLabel (int iEdge, double fNewTime)
 
void Export (wxTextFile &file) const
 
TimeRelations RegionRelation (double reg_t0, double reg_t1, const LabelTrack *parent=NULL) const
 

Static Public Member Functions

static LabelStruct Import (wxTextFile &file, int &index)
 

Public Attributes

SelectedRegion selectedRegion
 
wxString title
 
int width
 Text of the label. More...
 
int x
 width of the text in pixels. More...
 
int x1
 Pixel position of left hand glyph. More...
 
int xText
 Pixel position of right hand glyph. More...
 
int y
 Pixel position of left hand side of text box. More...
 
bool updated
 Pixel position of label. More...
 

Detailed Description

A LabelStruct holds information for ONE label in a LabelTrack.

LabelStruct also has label specific functions, mostly functions for drawing different aspects of the label and its text box.

Member Enumeration Documentation

Relationships between selection region and labels.

Enumerator
BEFORE_LABEL 
AFTER_LABEL 
SURROUNDS_LABEL 
WITHIN_LABEL 
BEGINS_IN_LABEL 
ENDS_IN_LABEL 

Constructor & Destructor Documentation

LabelStruct::LabelStruct ( const SelectedRegion region,
const wxString &  aTitle 
)

References updated, width, x, x1, xText, and y.

LabelStruct::LabelStruct ( const SelectedRegion region,
double  t0,
double  t1,
const wxString &  aTitle 
)

Member Function Documentation

bool LabelStruct::AdjustEdge ( int  iEdge,
double  fNewTime 
)
void LabelStruct::DrawGlyphs ( wxDC &  dc,
const wxRect &  r,
int  GlyphLeft,
int  GlyphRight 
) const

DrawGlyphs draws the wxIcons at the start and end of a label.

Parameters
dcthe device context
rthe LabelTrack rectangle.

References LabelTrack::GetGlyph(), LabelTrack::mIconHeight, LabelTrack::mIconWidth, and LabelTrack::mTextHeight.

void LabelStruct::DrawHighlight ( wxDC &  dc,
int  xPos1,
int  xPos2,
int  charHeight 
) const

Draws text-selected region within the label.

void LabelStruct::DrawLines ( wxDC &  dc,
const wxRect &  r 
) const

Draw vertical lines that go exactly through the position of the start or end of a label.

Parameters
dcthe device context
rthe LabelTrack rectangle.

References AColor::Line(), LabelTrack::mIconHeight, LabelTrack::mTextHeight, x, x1, and y.

void LabelStruct::DrawText ( wxDC &  dc,
const wxRect &  r 
) const

Draw the text of the label and also draw a long thin rectangle for its full extent from x to x1 and a rectangular frame behind the text itself.

Parameters
dcthe device context
rthe LabelTrack rectangle.

References LabelTrack::mIconWidth, LabelTrack::mTextHeight, title, width, xText, and y.

void LabelStruct::DrawTextBox ( wxDC &  dc,
const wxRect &  r 
) const
void LabelStruct::Export ( wxTextFile &  file) const
double LabelStruct::getDuration ( ) const
inline

References SelectedRegion::duration(), and selectedRegion.

Referenced by MoveLabel().

const SelectedRegion& LabelStruct::getSelectedRegion ( ) const
inline

References selectedRegion.

void LabelStruct::getXPos ( wxDC &  dc,
int *  xPos1,
int  cursorPos 
) const

References title, and xText.

LabelStruct LabelStruct::Import ( wxTextFile &  file,
int &  index 
)
static
void LabelStruct::MoveLabel ( int  iEdge,
double  fNewTime 
)
auto LabelStruct::RegionRelation ( double  reg_t0,
double  reg_t1,
const LabelTrack parent = NULL 
) const

Returns relationship between a region described and this label; if parent is set, it will consider point labels at the very beginning and end of parent to be within a region that borders them (this makes it possible to DELETE capture all labels with a Select All).

References AFTER_LABEL, BEFORE_LABEL, BEGINS_IN_LABEL, ENDS_IN_LABEL, getT0(), getT1(), gPrefs, SURROUNDS_LABEL, and WITHIN_LABEL.

Member Data Documentation

bool LabelStruct::updated

Pixel position of label.

Referenced by AdjustEdge(), LabelStruct(), and MoveLabel().

int LabelStruct::width
mutable

Text of the label.

Referenced by DrawText(), DrawTextBox(), LabelStruct(), and LabelTrack::OverTextBox().

int LabelStruct::x
mutable

width of the text in pixels.

Referenced by DrawLines(), DrawTextBox(), and LabelStruct().

int LabelStruct::x1
mutable

Pixel position of left hand glyph.

Referenced by DrawLines(), DrawTextBox(), and LabelStruct().

int LabelStruct::xText
mutable

Pixel position of right hand glyph.

Referenced by DrawText(), DrawTextBox(), getXPos(), LabelStruct(), and LabelTrack::OverTextBox().

int LabelStruct::y
mutable

Pixel position of left hand side of text box.

Referenced by DrawLines(), DrawText(), DrawTextBox(), LabelStruct(), LabelTrack::OverTextBox(), and LabelTrack::ShowContextMenu().


The documentation for this class was generated from the following files: