本文整理汇总了C++中Track::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetHeight方法的具体用法?C++ Track::GetHeight怎么用?C++ Track::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecalcPositions
void TrackList::RecalcPositions(TrackNodePointer node)
{
if ( isNull( node ) )
return;
Track *t;
int i = 0;
int y = 0;
auto prev = getPrev( node );
if ( !isNull( prev ) ) {
t = prev.first->get();
i = t->GetIndex() + 1;
y = t->GetY() + t->GetHeight();
}
const auto theEnd = end();
for (auto n = Find( node.first->get() ); n != theEnd; ++n) {
t = *n;
t->SetIndex(i++);
t->DoSetY(y);
y += t->GetHeight();
}
UpdatePendingTracks();
}
示例2: GetHeight
int TrackList::GetHeight() const
{
int height = 0;
ConstTrackListIterator iter(this);
for (Track *t = iter.First(); t; t = iter.Next())
height += t->GetHeight();
return height;
}
示例3: if
TrackPanelResizeHandle::TrackPanelResizeHandle
( const std::shared_ptr<Track> &track, int y, const AudacityProject *pProject )
: mpTrack{ track }
, mMouseClickY( y )
{
auto tracks = pProject->GetTracks();
Track *prev = tracks->GetPrev(track.get());
Track *next = tracks->GetNext(track.get());
//STM: Determine whether we should rescale one or two tracks
if (prev && prev->GetLink() == track.get()) {
// mpTrack is the lower track
mInitialTrackHeight = track->GetHeight();
mInitialActualHeight = track->GetActualHeight();
mInitialMinimized = track->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight();
mInitialUpperActualHeight = prev->GetActualHeight();
mMode = IsResizingBelowLinkedTracks;
}
else if (next && track->GetLink() == next) {
// mpTrack is the upper track
mInitialTrackHeight = next->GetHeight();
mInitialActualHeight = next->GetActualHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = track->GetHeight();
mInitialUpperActualHeight = track->GetActualHeight();
mMode = IsResizingBetweenLinkedTracks;
}
else {
// DM: Save the initial mouse location and the initial height
mInitialTrackHeight = track->GetHeight();
mInitialActualHeight = track->GetActualHeight();
mInitialMinimized = track->GetMinimized();
mMode = IsResizing;
}
}
示例4: RecalcPositions
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
}
示例5: RecalcPositions
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
}
示例6: 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;
}
示例7: 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;
}
示例8: WXUNUSED
UIHandle::Result TrackPanelResizeHandle::Drag
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
{
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
if ( !pTrack )
return RefreshCode::Cancelled;
const wxMouseEvent &event = evt.event;
TrackList *const tracks = pProject->GetTracks();
int delta = (event.m_y - mMouseClickY);
// On first drag, jump out of minimized mode. Initial height
// will be height of minimized track.
//
// This used to be in HandleResizeClick(), but simply clicking
// on a resize border would switch the minimized state.
if (pTrack->GetMinimized()) {
Track *link = pTrack->GetLink();
pTrack->SetHeight(pTrack->GetHeight());
pTrack->SetMinimized(false);
if (link) {
link->SetHeight(link->GetHeight());
link->SetMinimized(false);
// Initial values must be reset since they weren't based on the
// minimized heights.
mInitialUpperTrackHeight = link->GetHeight();
mInitialTrackHeight = pTrack->GetHeight();
}
}
// Common pieces of code for MONO_WAVE_PAN and otherwise.
auto doResizeBelow = [&] (Track *prev, bool WXUNUSED(vStereo)) {
double proportion = static_cast < double >(mInitialTrackHeight)
/ (mInitialTrackHeight + mInitialUpperTrackHeight);
int newTrackHeight = static_cast < int >
(mInitialTrackHeight + delta * proportion);
int newUpperTrackHeight = static_cast < int >
(mInitialUpperTrackHeight + delta * (1.0 - proportion));
//make sure neither track is smaller than its minimum height
if (newTrackHeight < pTrack->GetMinimizedHeight())
newTrackHeight = pTrack->GetMinimizedHeight();
if (newUpperTrackHeight < prev->GetMinimizedHeight())
newUpperTrackHeight = prev->GetMinimizedHeight();
pTrack->SetHeight(newTrackHeight);
prev->SetHeight(newUpperTrackHeight);
};
auto doResizeBetween = [&] (Track *next, bool WXUNUSED(vStereo)) {
int newUpperTrackHeight = mInitialUpperTrackHeight + delta;
int newTrackHeight = mInitialTrackHeight - delta;
// make sure neither track is smaller than its minimum height
if (newTrackHeight < next->GetMinimizedHeight()) {
newTrackHeight = next->GetMinimizedHeight();
newUpperTrackHeight =
mInitialUpperTrackHeight + mInitialTrackHeight - next->GetMinimizedHeight();
}
if (newUpperTrackHeight < pTrack->GetMinimizedHeight()) {
newUpperTrackHeight = pTrack->GetMinimizedHeight();
newTrackHeight =
mInitialUpperTrackHeight + mInitialTrackHeight - pTrack->GetMinimizedHeight();
}
pTrack->SetHeight(newUpperTrackHeight);
next->SetHeight(newTrackHeight);
};
auto doResize = [&] {
int newTrackHeight = mInitialTrackHeight + delta;
if (newTrackHeight < pTrack->GetMinimizedHeight())
newTrackHeight = pTrack->GetMinimizedHeight();
pTrack->SetHeight(newTrackHeight);
};
//STM: We may be dragging one or two (stereo) tracks.
// If two, resize proportionally if we are dragging the lower track, and
// adjust compensatively if we are dragging the upper track.
switch( mMode )
{
case IsResizingBelowLinkedTracks:
{
Track *prev = tracks->GetPrev(pTrack.get());
doResizeBelow(prev, false);
break;
}
case IsResizingBetweenLinkedTracks:
{
Track *next = tracks->GetNext(pTrack.get());
doResizeBetween(next, false);
break;
}
case IsResizing:
//.........这里部分代码省略.........