Added unhide selected option to timeline menu.

This commit is contained in:
leo 2015-03-15 20:01:07 +00:00
parent 601efe5f35
commit 03c506c667
6 changed files with 48 additions and 10 deletions

View file

@ -1082,6 +1082,13 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
QT_TRANSLATE_NOOP("Status", "Hide objects that are not selected"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_PIECE_UNHIDE_SELECTED
{
"Piece.UnhideSelected",
QT_TRANSLATE_NOOP("Menu", "&Unhide Selected"),
QT_TRANSLATE_NOOP("Status", "Show hidden objects that are selected"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_PIECE_UNHIDE_ALL
{
"Piece.UnhideAll",

View file

@ -165,6 +165,7 @@ enum lcCommandId
LC_PIECE_GROUP_EDIT,
LC_PIECE_HIDE_SELECTED,
LC_PIECE_HIDE_UNSELECTED,
LC_PIECE_UNHIDE_SELECTED,
LC_PIECE_UNHIDE_ALL,
LC_PIECE_SHOW_EARLIER,
LC_PIECE_SHOW_LATER,

View file

@ -1385,9 +1385,10 @@ void lcMainWindow::UpdateSelectedObjects(int Flags, int SelectedCount, lcObject*
mActions[LC_PIECE_DELETE]->setEnabled(Flags & LC_SEL_SELECTED);
mActions[LC_PIECE_ARRAY]->setEnabled(Flags & LC_SEL_PIECE);
mActions[LC_PIECE_HIDE_SELECTED]->setEnabled(Flags & LC_SEL_PIECE);
mActions[LC_PIECE_UNHIDE_ALL]->setEnabled(Flags & LC_SEL_HIDDEN);
mActions[LC_PIECE_HIDE_SELECTED]->setEnabled(Flags & LC_SEL_VISIBLE_SELECTED);
mActions[LC_PIECE_HIDE_UNSELECTED]->setEnabled(Flags & LC_SEL_UNSELECTED);
mActions[LC_PIECE_UNHIDE_SELECTED]->setEnabled(Flags & LC_SEL_HIDDEN_SELECTED);
mActions[LC_PIECE_UNHIDE_ALL]->setEnabled(Flags & LC_SEL_HIDDEN);
mActions[LC_PIECE_GROUP]->setEnabled(Flags & LC_SEL_CAN_GROUP);
mActions[LC_PIECE_UNGROUP]->setEnabled(Flags & LC_SEL_GROUPED);
mActions[LC_PIECE_GROUP_ADD]->setEnabled((Flags & (LC_SEL_GROUPED | LC_SEL_FOCUS_GROUPED)) == LC_SEL_GROUPED);
@ -2021,6 +2022,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
lcGetActiveModel()->HideUnselectedPieces();
break;
case LC_PIECE_UNHIDE_SELECTED:
lcGetActiveModel()->UnhideSelectedPieces();
break;
case LC_PIECE_UNHIDE_ALL:
lcGetActiveModel()->UnhideAllPieces();
break;

View file

@ -2766,6 +2766,11 @@ void lcModel::UpdateSelection() const
if (Piece->IsFocused())
Focus = Piece;
if (Piece->IsHidden())
Flags |= LC_SEL_HIDDEN | LC_SEL_HIDDEN_SELECTED;
else
Flags |= LC_SEL_VISIBLE_SELECTED;
Flags |= LC_SEL_PIECE | LC_SEL_SELECTED;
if (Piece->GetGroup() != NULL)
@ -3015,6 +3020,20 @@ void lcModel::HideUnselectedPieces()
gMainWindow->UpdateAllViews();
}
void lcModel::UnhideSelectedPieces()
{
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
{
lcPiece* Piece = mPieces[PieceIdx];
if (Piece->IsSelected())
Piece->SetHidden(false);
}
UpdateSelection();
gMainWindow->UpdateAllViews();
}
void lcModel::UnhideAllPieces()
{
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)

View file

@ -5,14 +5,16 @@
#include "lc_math.h"
#include "object.h"
#define LC_SEL_NO_PIECES 0x01 // No pieces in model
#define LC_SEL_PIECE 0x02 // At last 1 piece selected
#define LC_SEL_SELECTED 0x04 // At last 1 object selected
#define LC_SEL_UNSELECTED 0x08 // At least 1 piece unselected
#define LC_SEL_HIDDEN 0x10 // At least one piece hidden
#define LC_SEL_GROUPED 0x20 // At least one piece selected is grouped
#define LC_SEL_FOCUS_GROUPED 0x40 // Focused piece is grouped
#define LC_SEL_CAN_GROUP 0x80 // Can make a new group
#define LC_SEL_NO_PIECES 0x001 // No pieces in model
#define LC_SEL_PIECE 0x002 // At last 1 piece selected
#define LC_SEL_SELECTED 0x004 // At last 1 object selected
#define LC_SEL_UNSELECTED 0x008 // At least 1 piece unselected
#define LC_SEL_HIDDEN 0x010 // At least one piece hidden
#define LC_SEL_HIDDEN_SELECTED 0x020 // At least one piece selected is hidden
#define LC_SEL_VISIBLE_SELECTED 0x040 // At least one piece selected is not hidden
#define LC_SEL_GROUPED 0x080 // At least one piece selected is grouped
#define LC_SEL_FOCUS_GROUPED 0x100 // Focused piece is grouped
#define LC_SEL_CAN_GROUP 0x200 // Can make a new group
enum lcTransformType
{
@ -259,6 +261,7 @@ public:
void HideSelectedPieces();
void HideUnselectedPieces();
void UnhideSelectedPieces();
void UnhideAllPieces();
void FindPiece(bool FindFirst, bool SearchForward);

View file

@ -18,6 +18,8 @@ lcTimelineWidget::lcTimelineWidget(QWidget* Parent)
setHeaderHidden(true);
setContextMenuPolicy(Qt::CustomContextMenu);
invisibleRootItem()->setFlags(invisibleRootItem()->flags() & ~Qt::ItemIsDropEnabled);
connect(this, SIGNAL(itemSelectionChanged()), SLOT(ItemSelectionChanged()));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(CustomMenuRequested(QPoint)));
}
@ -35,6 +37,7 @@ void lcTimelineWidget::CustomMenuRequested(QPoint Pos)
Menu->addSeparator();
Menu->addAction(gMainWindow->mActions[LC_PIECE_HIDE_SELECTED]);
Menu->addAction(gMainWindow->mActions[LC_PIECE_HIDE_UNSELECTED]);
Menu->addAction(gMainWindow->mActions[LC_PIECE_UNHIDE_SELECTED]);
Menu->addAction(gMainWindow->mActions[LC_PIECE_UNHIDE_ALL]);
Menu->popup(viewport()->mapToGlobal(Pos));