mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Allow undoing hiding operations. Fixes #251.
This commit is contained in:
parent
59ecbcdd5e
commit
69d46cc4c4
1 changed files with 49 additions and 22 deletions
|
@ -3625,13 +3625,9 @@ void lcModel::RemoveFromSelection(const lcObjectSection& ObjectSection)
|
|||
|
||||
void lcModel::SelectAllPieces()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->IsVisible(mCurrentStep))
|
||||
Piece->SetSelected(true);
|
||||
}
|
||||
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
gMainWindow->UpdateAllViews();
|
||||
|
@ -3639,13 +3635,9 @@ void lcModel::SelectAllPieces()
|
|||
|
||||
void lcModel::InvertSelection()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->IsVisible(mCurrentStep))
|
||||
Piece->SetSelected(!Piece->IsSelected());
|
||||
}
|
||||
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
gMainWindow->UpdateAllViews();
|
||||
|
@ -3653,60 +3645,95 @@ void lcModel::InvertSelection()
|
|||
|
||||
void lcModel::HideSelectedPieces()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
bool Modified = false;
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->IsSelected())
|
||||
{
|
||||
Piece->SetHidden(true);
|
||||
Piece->SetSelected(false);
|
||||
Modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Modified)
|
||||
return;
|
||||
|
||||
gMainWindow->UpdateTimeline(false, true);
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
gMainWindow->UpdateAllViews();
|
||||
|
||||
SaveCheckpoint(tr("Hide"));
|
||||
}
|
||||
|
||||
void lcModel::HideUnselectedPieces()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
bool Modified = false;
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (!Piece->IsSelected())
|
||||
{
|
||||
Piece->SetHidden(true);
|
||||
Modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Modified)
|
||||
return;
|
||||
|
||||
gMainWindow->UpdateTimeline(false, true);
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
gMainWindow->UpdateAllViews();
|
||||
|
||||
SaveCheckpoint(tr("Hide"));
|
||||
}
|
||||
|
||||
void lcModel::UnhideSelectedPieces()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
bool Modified = false;
|
||||
|
||||
if (Piece->IsSelected())
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->IsSelected() && Piece->IsHidden())
|
||||
{
|
||||
Piece->SetHidden(false);
|
||||
Modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Modified)
|
||||
return;
|
||||
|
||||
gMainWindow->UpdateTimeline(false, true);
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
gMainWindow->UpdateAllViews();
|
||||
|
||||
SaveCheckpoint(tr("Unhide"));
|
||||
}
|
||||
|
||||
void lcModel::UnhideAllPieces()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
mPieces[PieceIdx]->SetHidden(false);
|
||||
bool Modified = false;
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->IsHidden())
|
||||
{
|
||||
Piece->SetHidden(false);
|
||||
Modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Modified)
|
||||
return;
|
||||
|
||||
gMainWindow->UpdateTimeline(false, true);
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
gMainWindow->UpdateAllViews();
|
||||
|
||||
SaveCheckpoint(tr("Unhide"));
|
||||
}
|
||||
|
||||
void lcModel::FindPiece(bool FindFirst, bool SearchForward)
|
||||
|
|
Loading…
Reference in a new issue