mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 16:37:12 +01:00
Bug2265: Should save and restore track heights...
... Regression happened at 3f1fd8ced0
The heights were written to file, but not read back again.
This fix was done carefully to avoid making dependency cycles. We don't want
Track to depend on TrackView or TrackControls.
It's not great that LabelTrack, NoteTrack, TimeTrack, and WaveTrack now have
those dependencies, but at least they don't make cycles.
It would be better to figure out how to attach the view and controls to the
track with ClientData, then just invoke BuildAll to repopulate the view and
controls, so that they are non-null when you reach
Track::HandleCommonXMLAttribute.
This commit is contained in:
@@ -31,6 +31,9 @@ for drawing different aspects of the label and its text box.
|
||||
#include "Audacity.h" // for HAVE_GTK
|
||||
#include "LabelTrack.h"
|
||||
|
||||
#include "tracks/ui/TrackView.h"
|
||||
#include "tracks/ui/TrackControls.h"
|
||||
|
||||
#include "Experimental.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -56,7 +59,10 @@ static ProjectFileIORegistry::Entry registerFactory{
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewLabelTrack());
|
||||
auto result = tracks.Add(trackFactory.NewLabelTrack());
|
||||
TrackView::Get( *result );
|
||||
TrackControls::Get( *result );
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
#include "InconsistencyException.h"
|
||||
|
||||
#include "tracks/ui/TrackView.h"
|
||||
#include "tracks/ui/TrackControls.h"
|
||||
|
||||
#include "AllThemeResources.h"
|
||||
|
||||
#ifdef SONIFY
|
||||
@@ -108,7 +111,10 @@ static ProjectFileIORegistry::Entry registerFactory{
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewNoteTrack());
|
||||
auto result = tracks.Add(trackFactory.NewNoteTrack());
|
||||
TrackView::Get( *result );
|
||||
TrackControls::Get( *result );
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#include "ProjectSettings.h"
|
||||
#include "ProjectFileIORegistry.h"
|
||||
|
||||
#include "tracks/ui/TrackView.h"
|
||||
#include "tracks/ui/TrackControls.h"
|
||||
|
||||
|
||||
//TODO-MB: are these sensible values?
|
||||
#define TIMETRACK_MIN 0.01
|
||||
#define TIMETRACK_MAX 10.0
|
||||
@@ -42,7 +46,10 @@ static ProjectFileIORegistry::Entry registerFactory{
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewTimeTrack());
|
||||
auto result = tracks.Add(trackFactory.NewTimeTrack());
|
||||
TrackView::Get( *result );
|
||||
TrackControls::Get( *result );
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ Track classes.
|
||||
|
||||
#include "InconsistencyException.h"
|
||||
|
||||
#include "tracks/ui/TrackView.h"
|
||||
#include "tracks/ui/TrackControls.h"
|
||||
|
||||
using std::max;
|
||||
|
||||
static ProjectFileIORegistry::Entry registerFactory{
|
||||
@@ -68,7 +71,10 @@ static ProjectFileIORegistry::Entry registerFactory{
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewWaveTrack());
|
||||
auto result = tracks.Add(trackFactory.NewWaveTrack());
|
||||
TrackView::Get( *result );
|
||||
TrackControls::Get( *result );
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void TrackView::WriteXMLAttributes( XMLWriter &xmlFile ) const
|
||||
|
||||
bool TrackView::HandleXMLAttribute( const wxChar *attr, const wxChar *value )
|
||||
{
|
||||
wxString strValue;
|
||||
wxString strValue( value );
|
||||
long nValue;
|
||||
if (!wxStrcmp(attr, wxT("height")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) {
|
||||
|
||||
Reference in New Issue
Block a user