Zoom extents after loading a file.

This commit is contained in:
leo 2014-12-30 23:45:27 +00:00
parent 98aa121dec
commit 03303cd06e
4 changed files with 15 additions and 26 deletions

View file

@ -77,9 +77,8 @@ void lcApplication::SetProject(Project* Project)
for (int ViewIdx = 0; ViewIdx < Views.GetSize(); ViewIdx++) for (int ViewIdx = 0; ViewIdx < Views.GetSize(); ViewIdx++)
Views[ViewIdx]->SetModel(lcGetActiveModel()); Views[ViewIdx]->SetModel(lcGetActiveModel());
lcGetActiveModel()->UpdateInterface();
gMainWindow->UpdateAllViews(); gMainWindow->UpdateAllViews();
gMainWindow->UpdateModels();
gMainWindow->UpdateTitle();
} }
void lcApplication::SetClipboard(const QByteArray& Clipboard) void lcApplication::SetClipboard(const QByteArray& Clipboard)

View file

@ -190,9 +190,23 @@ bool lcMainWindow::OpenProject(const QString& FileName)
if (NewProject->Load(LoadFileName)) if (NewProject->Load(LoadFileName))
{ {
NewProject->SetActiveModel(0);
g_App->SetProject(NewProject); g_App->SetProject(NewProject);
AddRecentFile(LoadFileName); AddRecentFile(LoadFileName);
for (int ViewIdx = 0; ViewIdx < mViews.GetSize(); ViewIdx++)
{
View* View = mViews[ViewIdx];
if (!View->mCamera->IsSimple())
View->SetDefaultCamera();
View->ZoomExtents();
}
gMainWindow->UpdateAllViews();
return true; return true;
} }

View file

@ -449,8 +449,6 @@ void lcModel::LoadLDraw(QTextStream& Stream)
continue; continue;
} }
// todo: load from disk
Info = lcGetPiecesLibrary()->FindPiece(PartID.toLatin1().constData(), true); Info = lcGetPiecesLibrary()->FindPiece(PartID.toLatin1().constData(), true);
if (Info != NULL) if (Info != NULL)
{ {
@ -772,27 +770,7 @@ bool lcModel::LoadBinary(lcFile* file)
UpdateBackgroundTexture(); UpdateBackgroundTexture();
CalculateStep(mCurrentStep); CalculateStep(mCurrentStep);
/*
gMainWindow->UpdateFocusObject(GetFocusObject());
const lcArray<View*>& Views = gMainWindow->GetViews();
for (int ViewIdx = 0; ViewIdx < Views.GetSize(); ViewIdx++)
{
View* view = Views[ViewIdx];
if (!view->mCamera->IsSimple())
view->SetDefaultCamera();
view->ZoomExtents();
}
gMainWindow->UpdateLockSnap();
gMainWindow->UpdateSnap();
gMainWindow->UpdateCameraMenu();
UpdateSelection();
gMainWindow->UpdateCurrentStep();
gMainWindow->UpdateAllViews();
*/
return true; return true;
} }

View file

@ -59,7 +59,6 @@ void Project::SetActiveModel(int ModelIndex)
mActiveModel = mModels[ModelIndex]; mActiveModel = mModels[ModelIndex];
mActiveModel->UpdateInterface(); mActiveModel->UpdateInterface();
gMainWindow->UpdateModels();
const lcArray<View*>& Views = gMainWindow->GetViews(); const lcArray<View*>& Views = gMainWindow->GetViews();
for (int ViewIdx = 0; ViewIdx < Views.GetSize(); ViewIdx++) for (int ViewIdx = 0; ViewIdx < Views.GetSize(); ViewIdx++)
@ -240,7 +239,6 @@ bool Project::Load(const QString& FileName)
Model->CreatePieceInfo(); Model->CreatePieceInfo();
} }
SetActiveModel(0);
/* /*