mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Small cleanup.
This commit is contained in:
parent
5834587204
commit
c7ab540117
6 changed files with 69 additions and 77 deletions
|
@ -928,13 +928,6 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
|
|||
QT_TRANSLATE_NOOP("Status", "Set the current camera to use an orthographic projection"),
|
||||
QT_TRANSLATE_NOOP("Shortcut", "")
|
||||
},
|
||||
// LC_VIEW_PROJECTION_CYCLE
|
||||
{
|
||||
"View.Projection.Cycle",
|
||||
QT_TRANSLATE_NOOP("Menu", "&Cycle"),
|
||||
QT_TRANSLATE_NOOP("Status", "Cycle to next projection type"),
|
||||
QT_TRANSLATE_NOOP("Shortcut", "")
|
||||
},
|
||||
// LC_VIEW_PROJECTION_FOCUS
|
||||
{
|
||||
"View.Projection.Focus",
|
||||
|
|
|
@ -143,7 +143,6 @@ enum LC_COMMANDS
|
|||
LC_VIEW_PROJECTION_PERSPECTIVE = LC_VIEW_PROJECTION_FIRST,
|
||||
LC_VIEW_PROJECTION_ORTHO,
|
||||
LC_VIEW_PROJECTION_LAST = LC_VIEW_PROJECTION_ORTHO,
|
||||
LC_VIEW_PROJECTION_CYCLE,
|
||||
LC_VIEW_PROJECTION_FOCUS,
|
||||
LC_PIECE_INSERT,
|
||||
LC_PIECE_DELETE,
|
||||
|
|
|
@ -1423,6 +1423,20 @@ void lcModel::AddToSelection(const lcArray<lcObjectSection>& ObjectSections)
|
|||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||
}
|
||||
|
||||
void lcModel::SelectAllPieces()
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
|
||||
if (Piece->IsVisible(mCurrentStep))
|
||||
Piece->SetSelected(true);
|
||||
}
|
||||
|
||||
UpdateSelection();
|
||||
gMainWindow->UpdateAllViews();
|
||||
}
|
||||
|
||||
void lcModel::FindPiece(bool FindFirst, bool SearchForward)
|
||||
{
|
||||
if (mPieces.IsEmpty())
|
||||
|
@ -1479,6 +1493,36 @@ void lcModel::FindPiece(bool FindFirst, bool SearchForward)
|
|||
ClearSelectionAndSetFocus(Focus, LC_PIECE_SECTION_POSITION);
|
||||
}
|
||||
|
||||
void lcModel::UndoAction()
|
||||
{
|
||||
if (mUndoHistory.GetSize() < 2)
|
||||
return;
|
||||
|
||||
lcModelHistoryEntry* Undo = mUndoHistory[0];
|
||||
mUndoHistory.RemoveIndex(0);
|
||||
mRedoHistory.InsertAt(0, Undo);
|
||||
|
||||
LoadCheckPoint(mUndoHistory[0]);
|
||||
|
||||
gMainWindow->UpdateModified(IsModified());
|
||||
gMainWindow->UpdateUndoRedo(mUndoHistory.GetSize() > 1 ? mUndoHistory[0]->Description : NULL, !mRedoHistory.IsEmpty() ? mRedoHistory[0]->Description : NULL);
|
||||
}
|
||||
|
||||
void lcModel::RedoAction()
|
||||
{
|
||||
if (mRedoHistory.IsEmpty())
|
||||
return;
|
||||
|
||||
lcModelHistoryEntry* Redo = mRedoHistory[0];
|
||||
mRedoHistory.RemoveIndex(0);
|
||||
mUndoHistory.InsertAt(0, Redo);
|
||||
|
||||
LoadCheckPoint(Redo);
|
||||
|
||||
gMainWindow->UpdateModified(IsModified());
|
||||
gMainWindow->UpdateUndoRedo(mUndoHistory.GetSize() > 1 ? mUndoHistory[0]->Description : NULL, !mRedoHistory.IsEmpty() ? mRedoHistory[0]->Description : NULL);
|
||||
}
|
||||
|
||||
void lcModel::BeginMouseTool()
|
||||
{
|
||||
mMouseToolDistance = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
|
|
|
@ -169,9 +169,13 @@ public:
|
|||
void ClearSelectionAndSetFocus(const lcObjectSection& ObjectSection);
|
||||
void SetSelection(const lcArray<lcObjectSection>& ObjectSections);
|
||||
void AddToSelection(const lcArray<lcObjectSection>& ObjectSections);
|
||||
void SelectAllPieces();
|
||||
|
||||
void FindPiece(bool FindFirst, bool SearchForward);
|
||||
|
||||
void UndoAction();
|
||||
void RedoAction();
|
||||
|
||||
lcVector3 LockVector(const lcVector3& Vector) const;
|
||||
lcVector3 SnapPosition(const lcVector3& Delta) const;
|
||||
lcVector3 SnapRotation(const lcVector3& Delta) const;
|
||||
|
|
|
@ -1660,9 +1660,9 @@ void Project::HandleCommand(LC_COMMANDS id)
|
|||
gMainWindow->DoDialog(LC_DIALOG_PRINT, NULL);
|
||||
break;
|
||||
|
||||
// TODO: printing
|
||||
case LC_FILE_PRINT_BOM:
|
||||
break;
|
||||
// TODO: printing
|
||||
case LC_FILE_PRINT_BOM:
|
||||
break;
|
||||
|
||||
case LC_FILE_RECENT1:
|
||||
case LC_FILE_RECENT2:
|
||||
|
@ -1677,35 +1677,11 @@ void Project::HandleCommand(LC_COMMANDS id)
|
|||
break;
|
||||
|
||||
case LC_EDIT_UNDO:
|
||||
{
|
||||
if (mUndoHistory.GetSize() < 2)
|
||||
break;
|
||||
|
||||
lcModelHistoryEntry* Undo = mUndoHistory[0];
|
||||
mUndoHistory.RemoveIndex(0);
|
||||
mRedoHistory.InsertAt(0, Undo);
|
||||
|
||||
LoadCheckPoint(mUndoHistory[0]);
|
||||
|
||||
gMainWindow->UpdateModified(IsModified());
|
||||
gMainWindow->UpdateUndoRedo(mUndoHistory.GetSize() > 1 ? mUndoHistory[0]->Description : NULL, !mRedoHistory.IsEmpty() ? mRedoHistory[0]->Description : NULL);
|
||||
}
|
||||
UndoAction();
|
||||
break;
|
||||
|
||||
case LC_EDIT_REDO:
|
||||
{
|
||||
if (mRedoHistory.IsEmpty())
|
||||
break;
|
||||
|
||||
lcModelHistoryEntry* Redo = mRedoHistory[0];
|
||||
mRedoHistory.RemoveIndex(0);
|
||||
mUndoHistory.InsertAt(0, Redo);
|
||||
|
||||
LoadCheckPoint(Redo);
|
||||
|
||||
gMainWindow->UpdateModified(IsModified());
|
||||
gMainWindow->UpdateUndoRedo(mUndoHistory.GetSize() > 1 ? mUndoHistory[0]->Description : NULL, !mRedoHistory.IsEmpty() ? mRedoHistory[0]->Description : NULL);
|
||||
}
|
||||
RedoAction();
|
||||
break;
|
||||
|
||||
case LC_EDIT_CUT:
|
||||
|
@ -1885,37 +1861,26 @@ void Project::HandleCommand(LC_COMMANDS id)
|
|||
gMainWindow->UpdateAllViews();
|
||||
} break;
|
||||
|
||||
case LC_EDIT_FIND:
|
||||
if (gMainWindow->DoDialog(LC_DIALOG_FIND, &gMainWindow->mSearchOptions))
|
||||
FindPiece(true, true);
|
||||
break;
|
||||
case LC_EDIT_FIND:
|
||||
if (gMainWindow->DoDialog(LC_DIALOG_FIND, &gMainWindow->mSearchOptions))
|
||||
FindPiece(true, true);
|
||||
break;
|
||||
|
||||
case LC_EDIT_FIND_NEXT:
|
||||
FindPiece(false, true);
|
||||
break;
|
||||
case LC_EDIT_FIND_NEXT:
|
||||
FindPiece(false, true);
|
||||
break;
|
||||
|
||||
case LC_EDIT_FIND_PREVIOUS:
|
||||
FindPiece(false, false);
|
||||
break;
|
||||
case LC_EDIT_FIND_PREVIOUS:
|
||||
FindPiece(false, false);
|
||||
break;
|
||||
|
||||
case LC_EDIT_SELECT_ALL:
|
||||
{
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
case LC_EDIT_SELECT_ALL:
|
||||
SelectAllPieces();
|
||||
break;
|
||||
|
||||
if (Piece->IsVisible(mCurrentStep))
|
||||
Piece->SetSelected(true);
|
||||
}
|
||||
|
||||
UpdateSelection();
|
||||
gMainWindow->UpdateAllViews();
|
||||
} break;
|
||||
|
||||
case LC_EDIT_SELECT_NONE:
|
||||
{
|
||||
ClearSelection(true);
|
||||
} break;
|
||||
case LC_EDIT_SELECT_NONE:
|
||||
ClearSelection(true);
|
||||
break;
|
||||
|
||||
case LC_EDIT_SELECT_INVERT:
|
||||
{
|
||||
|
@ -2024,18 +1989,6 @@ void Project::HandleCommand(LC_COMMANDS id)
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_VIEW_PROJECTION_CYCLE:
|
||||
{
|
||||
View* ActiveView = gMainWindow->GetActiveView();
|
||||
lcCamera* Camera = ActiveView->mCamera;
|
||||
|
||||
Camera->SetOrtho(!Camera->IsOrtho());
|
||||
|
||||
gMainWindow->UpdateAllViews();
|
||||
gMainWindow->UpdatePerspective();
|
||||
}
|
||||
break;
|
||||
|
||||
case LC_VIEW_PROJECTION_FOCUS:
|
||||
{
|
||||
lcVector3 FocusVector;
|
||||
|
|
|
@ -238,7 +238,6 @@ void lcQMainWindow::createMenus()
|
|||
exportMenu->addAction(actions[LC_FILE_EXPORT_WAVEFRONT]);
|
||||
menuFile->addSeparator();
|
||||
menuFile->addAction(actions[LC_FILE_PROPERTIES]);
|
||||
// menuFile->addAction(actions[LC_FILE_TERRAIN_EDITOR]);
|
||||
menuFile->addSeparator();
|
||||
menuFile->addAction(actions[LC_FILE_PRINT]);
|
||||
menuFile->addAction(actions[LC_FILE_PRINT_PREVIEW]);
|
||||
|
|
Loading…
Reference in a new issue