Exemplo n.º 1
0
void TrackList::RecalcPositions(TrackNodePointer node)
{
   if (isNull(node)) {
      return;
   }
   Track *t;
   int i = 0;
   int y = 0;

#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
   int cnt = 0;
   if (node->prev) {
      t = node->prev->t;
      i = t->GetIndex() + 1;
      if(MONO_WAVE_PAN(t))
         y = t->GetY(true) + t->GetHeight(true);
      else
         y = t->GetY() + t->GetHeight();
   }

   for (const TrackListNode *n = node; n; n = n->next) {
      t = n->t;
      if(MONO_WAVE_PAN(t))
         cnt++;

      if(cnt != 2){
         t->SetIndex(i++);
         t->SetY(y);
         y += t->GetHeight();
      }
      if(cnt != 0){
         t->SetY(y,true);
         y += t->GetHeight(true);
      }
      cnt = 0;
   }
#else // EXPERIMENTAL_OUTPUT_DISPLAY
   if (hasPrev(node)) {
      auto prev = node;
      --prev;
      t = prev->get();
      i = t->GetIndex() + 1;
      y = t->GetY() + t->GetHeight();
   }

   const auto theEnd = end();
   for (auto n = node; n != theEnd; ++n) {
      t = n->get();
      t->SetIndex(i++);
      t->SetY(y);
      y += t->GetHeight();
   }
#endif // EXPERIMENTAL_OUTPUT_DISPLAY
}
Exemplo n.º 2
0
void TrackList::RecalcPositions(const TrackListNode *node)
{
   Track *t;
   int i = 0;
   int y = 0;

   if (!node) {
      return;
   }

#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
   int cnt = 0;
   if (node->prev) {
      t = node->prev->t;
      i = t->GetIndex() + 1;
      if(MONO_WAVE_PAN(t))
         y = t->GetY(true) + t->GetHeight(true);
      else
         y = t->GetY() + t->GetHeight();
   }

   for (const TrackListNode *n = node; n; n = n->next) {
      t = n->t;
      if(MONO_WAVE_PAN(t))
         cnt++;

      if(cnt != 2){
         t->SetIndex(i++);
         t->SetY(y);
         y += t->GetHeight();
      }
      if(cnt != 0){
         t->SetY(y,true);
         y += t->GetHeight(true);
      }
      cnt = 0;
   }
#else // EXPERIMENTAL_OUTPUT_DISPLAY
   if (node->prev) {
      t = node->prev->t;
      i = t->GetIndex() + 1;
      y = t->GetY() + t->GetHeight();
   }

   for (const TrackListNode *n = node; n; n = n->next) {
      t = n->t;
      t->SetIndex(i++);
      t->SetY(y);
      y += t->GetHeight();
   }
#endif // EXPERIMENTAL_OUTPUT_DISPLAY
}
Exemplo n.º 3
0
void EditCursorOverlay::Draw
   (wxDC &dc, TrackPanelCellIterator begin, TrackPanelCellIterator end)
{
   mLastCursorX = mNewCursorX;
   if (mLastCursorX == -1)
      return;

   const ZoomInfo &viewInfo = mProject->GetZoomInfo();

   const bool
      onScreen = between_incexc(viewInfo.h,
         mCursorTime,
         mProject->GetScreenEndTime());

   if (!onScreen)
      return;

   AColor::CursorColor(&dc);

   // Draw cursor in all selected tracks
   for (; begin != end; ++begin)
   {
      TrackPanelCellIterator::value_type data(*begin);
      Track *const pTrack = data.first;
      if (!pTrack)
         continue;
      if (pTrack->GetSelected() ||
          mProject->GetTrackPanel()->GetAx().IsFocused(pTrack))
      {
         const wxRect &rect = data.second;
         // AColor::Line includes both endpoints so use GetBottom()
         AColor::Line(dc, mLastCursorX, rect.GetTop(), mLastCursorX, rect.GetBottom()); // <-- The whole point of this routine.

#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
         if (MONO_WAVE_PAN(t)){
            y = t->GetY(true) - mViewInfo->vpos + 1;
            top = y + kTopInset;
            bottom = y + t->GetHeight(true) - kTopInset;
            AColor::Line(dc, mLastCursorX, top, mLastCursorX, bottom);
         }
#endif

      }
   }

   // AS: Ah, no, this is where we draw the blinky thing in the ruler.
   mProject->GetRulerPanel()->DrawCursor(mCursorTime);

   // This updates related displays such as numbers on the status bar
   mProject->TP_DisplaySelection();
}
Exemplo n.º 4
0
/// For mono track height of track
/// For stereo track combined height of both channels.
int TrackList::GetGroupHeight(Track * t) const
{
   int height = t->GetHeight();

   t = t->GetLink();
   if (t) {
      height += t->GetHeight();
   }
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
   else if(MONO_WAVE_PAN(t)){
      height += t->GetHeight(true);
   }
#endif
   return height;
}
Exemplo n.º 5
0
int TrackList::GetHeight() const
{
   int height = 0;

#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
   if (tail) {
      const Track *t = tail->t;
      if(MONO_WAVE_PAN(t))
         height = t->GetY(true) + t->GetHeight(true);
      else
         height = t->GetY() + t->GetHeight();
   }
#else
   if (tail) {
      const Track *t = tail->t;
      height = t->GetY() + t->GetHeight();
   }
#endif
   return height;
}
Exemplo n.º 6
0
bool AudacityPrintout::OnPrintPage(int WXUNUSED(page))
{
   wxDC *dc = GetDC();
   if (!dc)
      return false;

   int width, height;
   dc->GetSize(&width, &height);

   int rulerScreenHeight = 40;
   int screenTotalHeight = mTracks->GetHeight() + rulerScreenHeight;

   double scale = height / (double)screenTotalHeight;

   int rulerPageHeight = (int)(rulerScreenHeight * scale);
   Ruler ruler;
   ruler.SetBounds(0, 0, width, rulerPageHeight);
   ruler.SetOrientation(wxHORIZONTAL);
   ruler.SetRange(0.0, mTracks->GetEndTime());
   ruler.SetFormat(Ruler::TimeFormat);
   ruler.SetLabelEdges(true);
   ruler.Draw(*dc);

   TrackArtist artist;
   artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
                               *wxWHITE_PEN, *wxWHITE_PEN);
   const double screenDuration = mTracks->GetEndTime();
   ZoomInfo zoomInfo(0.0, width / screenDuration);
   int y = rulerPageHeight;

   TrackListIterator iter(mTracks);
   Track *n = iter.First();
   while (n) {
      wxRect r;
      r.x = 0;
      r.y = y;
      r.width = width;
      r.height = (int)(n->GetHeight() * scale);

      artist.DrawTrack(n, *dc, r, SelectedRegion(), zoomInfo, false, false, false, false);

      dc->SetPen(*wxBLACK_PEN);
      AColor::Line(*dc, 0, r.y, width, r.y);

#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
      if(MONO_WAVE_PAN(n)){
         y += r.height;
         r.x = 0;
         r.y = y;
         r.width = width;
         r.height = (int)(n->GetHeight(true) * scale);
         artist.DrawTrack(
            n, *dc, r, SelectedRegion{}, zoomInfo, false, false, false, false);
         dc->SetPen(*wxBLACK_PEN);
         AColor::Line(*dc, 0, r.y, width, r.y);
      }
#endif
      n = iter.Next();
      y += r.height;
   };

   return true;
}
Exemplo n.º 7
0
void EditCursorOverlay::Draw(OverlayPanel &panel, wxDC &dc)
{
   if (mIsMaster && !mPartner) {
      auto ruler = mProject->GetRulerPanel();
      if (ruler) {
         mPartner = std::make_unique<EditCursorOverlay>(mProject, false);
         ruler->AddOverlay(mPartner.get());
      }
   }

   mLastCursorX = mNewCursorX;
   if (mLastCursorX == -1)
      return;

   const ZoomInfo &viewInfo = mProject->GetZoomInfo();

   const bool
   onScreen = between_incexc(viewInfo.h,
                             mCursorTime,
                             mProject->GetScreenEndTime());

   if (!onScreen)
      return;

   if (auto tp = dynamic_cast<TrackPanel*>(&panel)) {
      wxASSERT(mIsMaster);
      AColor::CursorColor(&dc);
      TrackPanelCellIterator begin(tp, true);
      TrackPanelCellIterator end(tp, false);

      // Draw cursor in all selected tracks
      for (; begin != end; ++begin)
      {
         TrackPanelCellIterator::value_type data(*begin);
         Track *const pTrack = data.first;
         if (!pTrack)
            continue;
         if (pTrack->GetSelected() ||
             mProject->GetTrackPanel()->GetAx().IsFocused(pTrack))
         {
            const wxRect &rect = data.second;
            // AColor::Line includes both endpoints so use GetBottom()
            AColor::Line(dc, mLastCursorX, rect.GetTop(), mLastCursorX, rect.GetBottom());
            // ^^^ The whole point of this routine.

#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
            if (MONO_WAVE_PAN(pTrack)){
               auto y = pTrack->GetY(true) - viewInfo.vpos + 1;
               auto top = y + kTopInset;
               auto bottom = y + pTrack->GetHeight(true) - kTopInset;
               AColor::Line(dc, mLastCursorX, top, mLastCursorX, bottom);
            }
#endif

         }
      }
   }
   else if (auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
      wxASSERT(!mIsMaster);
      dc.SetPen(*wxBLACK_PEN);
      // AColor::Line includes both endpoints so use GetBottom()
      auto rect = ruler->GetInnerRect();
      AColor::Line(dc, mLastCursorX, rect.GetTop(), mLastCursorX, rect.GetBottom());
   }
   else
      wxASSERT(false);
}