* In single window navigation, tracker wasn't restoring the view origin (current scrolling) properly. It was reseting the origin even after

successfully loading the saved state. Reworked the logic to make that work properly (this also needed checking if the state read succeeded). This 
fixes part of #2441. There is still an issue when sometimes the view state is not saved properly, more tomorrow! 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28158 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner 2008-10-16 01:41:45 +00:00
parent fcbcb00e18
commit e522ba55ba

View File

@ -7477,13 +7477,16 @@ BPoseView::SwitchDir(const entry_ref *newDirRef, AttributeStreamNode *node)
StopWatching();
ClearPoses();
// Restore state if requested
if (node) {
uint32 oldMode = ViewMode();
// Get new state
RestoreState(node);
// Restore state, might fail if the state has never been saved for this node
uint32 oldMode = ViewMode();
bool viewStateRestored = false;
if (node) {
BViewState *previousState = fViewState;
RestoreState(node);
viewStateRestored = (fViewState != previousState);
}
if (viewStateRestored) {
// Make sure the title view reset its items
fTitleView->Reset();
@ -7529,6 +7532,9 @@ BPoseView::SwitchDir(const entry_ref *newDirRef, AttributeStreamNode *node)
UpdateScrollRange();
SetScrollBarsTo(origin);
EnableScrollBars();
} else {
ResetOrigin();
ResetPosePlacementHint();
}
StartWatching();
@ -7541,9 +7547,7 @@ BPoseView::SwitchDir(const entry_ref *newDirRef, AttributeStreamNode *node)
else AddPoses(TargetModel());
TargetModel()->CloseNode();
Invalidate();
ResetOrigin();
ResetPosePlacementHint();
Invalidate();
sLastKeyTime = 0;
}