mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Bug812 - Vertical scrollbar position should be persistent too, as is horizontal
Effective but perhaps inelegant fix.
This commit is contained in:
parent
c6455312aa
commit
5d19887da6
@ -773,6 +773,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
mLastEffectType(0),
|
||||
mTimerRecordCanceled(false),
|
||||
mMenuClose(false)
|
||||
, mbInitializingScrollbar(false)
|
||||
{
|
||||
int widths[] = {-2, -1};
|
||||
mStatusBar = CreateStatusBar(2);
|
||||
@ -1508,7 +1509,16 @@ void AudacityProject::FixScrollbars()
|
||||
mViewInfo.sbarH = (wxInt64) (mViewInfo.h * mViewInfo.zoom);
|
||||
|
||||
int lastv = mViewInfo.vpos;
|
||||
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
||||
// PRL: Can someone else find a more elegant solution to bug 812, than
|
||||
// introducing this boolean member variable?
|
||||
// Setting mVSbar earlier, int HandlXMLTag, didn't succeed in restoring
|
||||
// the vertical scrollbar to its saved position. So defer that till now.
|
||||
// mbInitializingScrollbar should be true only at the start of the life
|
||||
// of an AudacityProject reopened from disk.
|
||||
if (!mbInitializingScrollbar) {
|
||||
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
||||
}
|
||||
mbInitializingScrollbar = false;
|
||||
|
||||
if (mViewInfo.vpos >= totalHeight)
|
||||
mViewInfo.vpos = totalHeight - 1;
|
||||
@ -2808,6 +2818,7 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>");
|
||||
wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
|
||||
int requiredTags = 0;
|
||||
long longVpos = 0;
|
||||
|
||||
// loop through attrs, which is a null-terminated list of
|
||||
// attribute-value pairs
|
||||
@ -2834,19 +2845,19 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
}
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("version")))
|
||||
else if (!wxStrcmp(attr, wxT("version")))
|
||||
{
|
||||
fileVersion = value;
|
||||
bFileVersionFound = true;
|
||||
requiredTags++;
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("audacityversion"))) {
|
||||
else if (!wxStrcmp(attr, wxT("audacityversion"))) {
|
||||
audacityVersion = value;
|
||||
requiredTags++;
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("projname"))) {
|
||||
else if (!wxStrcmp(attr, wxT("projname"))) {
|
||||
wxString projName;
|
||||
wxString projPath;
|
||||
|
||||
@ -2911,13 +2922,13 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
requiredTags++;
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("sel0"))) {
|
||||
else if (!wxStrcmp(attr, wxT("sel0"))) {
|
||||
double t0;
|
||||
Internat::CompatibleToDouble(value, &t0);
|
||||
mViewInfo.selectedRegion.setT0(t0, false);
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("sel1"))) {
|
||||
else if (!wxStrcmp(attr, wxT("sel1"))) {
|
||||
double t1;
|
||||
Internat::CompatibleToDouble(value, &t1);
|
||||
mViewInfo.selectedRegion.setT1(t1, false);
|
||||
@ -2925,32 +2936,37 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
|
||||
// PRL: to do: persistence of other fields of the selection
|
||||
|
||||
long longVpos = 0;
|
||||
if (!wxStrcmp(attr, wxT("vpos")))
|
||||
else if (!wxStrcmp(attr, wxT("vpos")))
|
||||
// Just assign a variable, put the value in its place later
|
||||
wxString(value).ToLong(&longVpos);
|
||||
mViewInfo.track = NULL;
|
||||
mViewInfo.vpos = longVpos;
|
||||
|
||||
if (!wxStrcmp(attr, wxT("h")))
|
||||
else if (!wxStrcmp(attr, wxT("h")))
|
||||
Internat::CompatibleToDouble(value, &mViewInfo.h);
|
||||
|
||||
if (!wxStrcmp(attr, wxT("zoom")))
|
||||
else if (!wxStrcmp(attr, wxT("zoom")))
|
||||
Internat::CompatibleToDouble(value, &mViewInfo.zoom);
|
||||
|
||||
if (!wxStrcmp(attr, wxT("rate"))) {
|
||||
else if (!wxStrcmp(attr, wxT("rate"))) {
|
||||
Internat::CompatibleToDouble(value, &mRate);
|
||||
GetSelectionBar()->SetRate(mRate);
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("snapto"))) {
|
||||
else if (!wxStrcmp(attr, wxT("snapto"))) {
|
||||
SetSnapTo(wxString(value) == wxT("on") ? true : false);
|
||||
}
|
||||
|
||||
if (!wxStrcmp(attr, wxT("selectionformat"))) {
|
||||
else if (!wxStrcmp(attr, wxT("selectionformat"))) {
|
||||
SetSelectionFormat(value);
|
||||
}
|
||||
} // while
|
||||
|
||||
if (longVpos != 0) {
|
||||
// PRL: It seems this must happen after SetSnapTo
|
||||
mViewInfo.track = NULL;
|
||||
mViewInfo.vpos = longVpos;
|
||||
mbInitializingScrollbar = true;
|
||||
}
|
||||
|
||||
// Specifically detect newer versions of Audacity
|
||||
// WARNING: This will need review/revision if we ever have a version string
|
||||
// such as 1.5.10, i.e. with 2 digit numbers.
|
||||
|
@ -618,7 +618,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
||||
// Are we currently closing as the result of a menu command?
|
||||
bool mMenuClose;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
bool mbInitializingScrollbar;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
typedef void (AudacityProject::*audCommandFunction)();
|
||||
|
Loading…
x
Reference in New Issue
Block a user