src/tracks/labeltrack/ui/LabelTrackView.cpp
/// 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.
///   @param  dc the device context
///   @param  r  the LabelTrack rectangle.
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.
@param  dc the device context
@param  r  the LabelTrack rectangle.
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 . @param dc the device context @param r the LabelTrack rectangle .
void LabelTrackView::DrawText(wxDC & dc, const LabelStruct &ls, const wxRect & r)
{
   const int yFrameHeight = mTextHeight + TextFramePadding * 2;
   auto &y = ls.y;
   if( y == -1 )
      return;
   {
      auto &xText = ls.xText;
      const int xStart=wxMax(r.x,xText-mIconWidth/2);
      const int xEnd=wxMin(r.x+r.width,xText+ls.width+mIconWidth/2);
      const int xWidth = xEnd-xStart;
      if( (xStart < (r.x+r.width)) && (xEnd > r.x) && (xWidth>0))
      {
         auto pos = y - LabelBarHeight - yFrameHeight + TextFrameYOffset +
            (yFrameHeight - mFontHeight) / 2 + dc.GetFontMetrics().ascent;
         dc.DrawText(ls.title, xText, pos);
      }
   }
}
void LabelTrackView :: DrawText ( wxDC & dc , const LabelStruct & ls , const wxRect & r ) { const int yFrameHeight = mTextHeight + TextFramePadding * 2 ; auto & y = ls . y ; if ( y == -1 ) return ; { auto & xText = ls . xText ; const int xStart = wxMax ( r . x , xText - mIconWidth / 2 ) ; const int xEnd = wxMin ( r . x + r . width , xText + ls . width + mIconWidth / 2 ) ; const int xWidth = xEnd - xStart ; if ( ( xStart < ( r . x + r . width ) ) && ( xEnd > r . x ) && ( xWidth > 0 ) ) { auto pos = y - LabelBarHeight - yFrameHeight + TextFrameYOffset + ( yFrameHeight - mFontHeight ) / 2 + dc . GetFontMetrics ( ) . ascent ; dc . DrawText ( ls . title , xText , pos ) ; } } }
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.
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 .
//If y is positive then it is the center line for the //text we are about to draw. //if it isn't, nothing to draw. // Draw frame for the text... // We draw it half an icon width left of the text itself. // Now draw the text itself.