mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-12 14:47:43 +02:00
Computing best font size for TrackInfo is redone when preferences change
This commit is contained in:
parent
16261a2a11
commit
e7477746df
@ -796,6 +796,9 @@ void TrackPanel::UpdatePrefs()
|
|||||||
// All vertical rulers must be recalculated since the minimum and maximum
|
// All vertical rulers must be recalculated since the minimum and maximum
|
||||||
// frequences may have been changed.
|
// frequences may have been changed.
|
||||||
UpdateVRulers();
|
UpdateVRulers();
|
||||||
|
|
||||||
|
mTrackInfo.UpdatePrefs();
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8774,21 +8777,7 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
|
|||||||
PAN_SLIDER);
|
PAN_SLIDER);
|
||||||
mPanCaptured->SetDefaultValue(0.0);
|
mPanCaptured->SetDefaultValue(0.0);
|
||||||
|
|
||||||
int fontSize = 10;
|
UpdatePrefs();
|
||||||
mFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
|
||||||
|
|
||||||
int allowableWidth = GetTrackInfoWidth() - 2; // 2 to allow for left/right borders
|
|
||||||
int textWidth, textHeight;
|
|
||||||
do {
|
|
||||||
mFont.SetPointSize(fontSize);
|
|
||||||
pParent->GetTextExtent(_("Stereo, 999999Hz"),
|
|
||||||
&textWidth,
|
|
||||||
&textHeight,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&mFont);
|
|
||||||
fontSize--;
|
|
||||||
} while (textWidth >= allowableWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackInfo::~TrackInfo()
|
TrackInfo::~TrackInfo()
|
||||||
@ -9169,6 +9158,28 @@ LWSlider * TrackInfo::PanSlider(WaveTrack *t, bool captured) const
|
|||||||
return captured ? mPanCaptured : mPan;
|
return captured ? mPanCaptured : mPan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackInfo::UpdatePrefs()
|
||||||
|
{
|
||||||
|
// Calculation of best font size depends on language, so it should be redone in case
|
||||||
|
// the language preference changed.
|
||||||
|
|
||||||
|
int fontSize = 10;
|
||||||
|
mFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||||
|
|
||||||
|
int allowableWidth = GetTrackInfoWidth() - 2; // 2 to allow for left/right borders
|
||||||
|
int textWidth, textHeight;
|
||||||
|
do {
|
||||||
|
mFont.SetPointSize(fontSize);
|
||||||
|
pParent->GetTextExtent(_("Stereo, 999999Hz"),
|
||||||
|
&textWidth,
|
||||||
|
&textHeight,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&mFont);
|
||||||
|
fontSize--;
|
||||||
|
} while (textWidth >= allowableWidth);
|
||||||
|
}
|
||||||
|
|
||||||
TrackPanelCellIterator::TrackPanelCellIterator(TrackPanel *trackPanel, bool begin)
|
TrackPanelCellIterator::TrackPanelCellIterator(TrackPanel *trackPanel, bool begin)
|
||||||
: mPanel(trackPanel)
|
: mPanel(trackPanel)
|
||||||
, mIter(trackPanel->GetProject())
|
, mIter(trackPanel->GetProject())
|
||||||
|
@ -121,6 +121,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void UpdatePrefs();
|
||||||
|
|
||||||
TrackPanel * pParent;
|
TrackPanel * pParent;
|
||||||
wxFont mFont;
|
wxFont mFont;
|
||||||
LWSlider *mGainCaptured;
|
LWSlider *mGainCaptured;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user