当前位置: 首页>>代码示例>>C++>>正文


C++ TrackList::GetHeight方法代码示例

本文整理汇总了C++中TrackList::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackList::GetHeight方法的具体用法?C++ TrackList::GetHeight怎么用?C++ TrackList::GetHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrackList的用法示例。


在下文中一共展示了TrackList::GetHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnPrintPage

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;
}
开发者ID:rbuj,项目名称:audacity,代码行数:63,代码来源:Printing.cpp

示例2: OnPrintPage

bool AudacityPrintout::OnPrintPage(int 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);
   ViewInfo viewInfo;
   viewInfo.sel0 = viewInfo.sel1 = 0;
   viewInfo.vpos = 0;
   viewInfo.h = 0.0;
   viewInfo.screen = mTracks->GetEndTime() - viewInfo.h;
   viewInfo.total = viewInfo.screen;
   viewInfo.zoom = viewInfo.lastZoom = width / viewInfo.screen;
   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);

      switch(n->GetKind()) {
      case Track::Wave:
         switch (((WaveTrack *)n)->GetDisplay()) {
         case WaveTrack::WaveformDisplay:
            artist.DrawWaveform((WaveTrack *)n, *dc, r,
                                &viewInfo, false, false, false, false, false);
            break;
         case WaveTrack::WaveformDBDisplay:
            artist.DrawWaveform((WaveTrack *)n, *dc, r,
                                &viewInfo, false, false, false, true, false);
            break;
         case WaveTrack::SpectrumDisplay:
            artist.DrawSpectrum((WaveTrack *)n, *dc, r, &viewInfo, false);
            break;
         case WaveTrack::PitchDisplay:
            artist.DrawSpectrum((WaveTrack *)n, *dc, r, &viewInfo, true);
            break;
         }
         break;
      case Track::Note:
         artist.DrawNoteTrack((NoteTrack *)n, *dc, r, &viewInfo);
         break;
      case Track::Label:
         artist.DrawLabelTrack((LabelTrack *)n, *dc, r, &viewInfo);
         break;
      case Track::Time:
         artist.DrawTimeTrack((TimeTrack *)n, *dc, r, &viewInfo);
         break;
      }

      dc->SetPen(*wxBLACK_PEN);
      dc->DrawLine(0, r.y, width, r.y);

      n = iter.Next();
      y += r.height;
   };

   return true;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:83,代码来源:Printing.cpp

示例3: FixScrollbars

void AudioView::FixScrollbars()
{
  if (!hsbar || !vsbar)
    return;

  AudioDoc *doc = ((AudioDoc *)GetDocument());
  if (!doc)
    return;
    
  bool rescroll = false;

  TrackList *tracks = GetTracks();
  int totalHeight = (tracks->GetHeight() + 32);

  int panelWidth, panelHeight;
  trackPanel->GetSize(&panelWidth, &panelHeight);

  sinfo.total = tracks->GetMaxLen() + 1.0;
  sinfo.screen = ((double)panelWidth) / sinfo.zoom;

  if (sinfo.h > sinfo.total - sinfo.screen) {
  	sinfo.h = sinfo.total - sinfo.screen;
  	rescroll = true;
  }
  if (sinfo.h < 0.0) {
  	sinfo.h = 0.0;
  	rescroll = true;
  }

  sinfo.sbarTotal = (int)(sinfo.total * sinfo.zoom) / sinfo.scrollStep;
  sinfo.sbarScreen = (int)(sinfo.screen * sinfo.zoom) / sinfo.scrollStep;

  sinfo.sbarH = (int)(sinfo.h * sinfo.zoom) / sinfo.scrollStep;

  vpos =
	vsbar->GetThumbPosition() * sinfo.scrollStep;

  if (vpos >= totalHeight)
	vpos = totalHeight-1;
  if (vpos < 0)
	vpos = 0;

  hsbar->Show(sinfo.screen < sinfo.total);
  vsbar->Show(panelHeight < totalHeight);

  if (panelHeight >= totalHeight && vpos != 0) {
	vpos = 0;
	REDRAW(trackPanel);
	REDRAW(rulerPanel);
	rescroll = false;
  }
  if (sinfo.screen >= sinfo.total && sinfo.sbarH != 0) {
	sinfo.sbarH = 0;
	REDRAW(trackPanel);
	REDRAW(rulerPanel);
	rescroll = false;
  }

  hsbar->SetScrollbar(sinfo.sbarH, sinfo.sbarScreen,
					  sinfo.sbarTotal, sinfo.sbarScreen, TRUE);
  vsbar->SetScrollbar(vpos / sinfo.scrollStep,
					  panelHeight / sinfo.scrollStep,
					  totalHeight / sinfo.scrollStep,
					  panelHeight / sinfo.scrollStep,
					  TRUE);

  sinfo.lastZoom = sinfo.zoom;
  
  if (rescroll && sinfo.screen < sinfo.total) {
	  REDRAW(trackPanel);
		REDRAW(rulerPanel);
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:73,代码来源:AudioView.cpp


注:本文中的TrackList::GetHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。