Remove edit menu

master
huxingyi 2020-12-13 23:58:00 +09:30
parent 52252b70af
commit 77b5638de2
2 changed files with 0 additions and 243 deletions

View File

@ -684,208 +684,6 @@ DocumentWindow::DocumentWindow() :
m_exportRenderedAsImageAction->setEnabled(m_graphicsWidget->hasItems());
});
m_editMenu = menuBar()->addMenu(tr("&Edit"));
m_addAction = new QAction(tr("Add..."), this);
connect(m_addAction, &QAction::triggered, [=]() {
m_document->setEditMode(SkeletonDocumentEditMode::Add);
});
m_editMenu->addAction(m_addAction);
m_undoAction = new QAction(tr("Undo"), this);
connect(m_undoAction, &QAction::triggered, m_document, &Document::undo);
m_editMenu->addAction(m_undoAction);
m_redoAction = new QAction(tr("Redo"), this);
connect(m_redoAction, &QAction::triggered, m_document, &Document::redo);
m_editMenu->addAction(m_redoAction);
m_deleteAction = new QAction(tr("Delete"), this);
connect(m_deleteAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::deleteSelected);
m_editMenu->addAction(m_deleteAction);
m_breakAction = new QAction(tr("Break"), this);
connect(m_breakAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::breakSelected);
m_editMenu->addAction(m_breakAction);
m_reduceAction = new QAction(tr("Reduce"), this);
connect(m_reduceAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::reduceSelected);
m_editMenu->addAction(m_reduceAction);
m_reverseAction = new QAction(tr("Reverse"), this);
connect(m_reverseAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::reverseSelectedEdges);
m_editMenu->addAction(m_reverseAction);
m_connectAction = new QAction(tr("Connect"), this);
connect(m_connectAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::connectSelected);
m_editMenu->addAction(m_connectAction);
m_cutAction = new QAction(tr("Cut"), this);
connect(m_cutAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::cut);
m_editMenu->addAction(m_cutAction);
m_copyAction = new QAction(tr("Copy"), this);
connect(m_copyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::copy);
m_editMenu->addAction(m_copyAction);
m_pasteAction = new QAction(tr("Paste"), this);
connect(m_pasteAction, &QAction::triggered, m_document, &Document::paste);
m_editMenu->addAction(m_pasteAction);
m_flipHorizontallyAction = new QAction(tr("H Flip"), this);
connect(m_flipHorizontallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipHorizontally);
m_editMenu->addAction(m_flipHorizontallyAction);
m_flipVerticallyAction = new QAction(tr("V Flip"), this);
connect(m_flipVerticallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipVertically);
m_editMenu->addAction(m_flipVerticallyAction);
m_rotateClockwiseAction = new QAction(tr("Rotate 90D CW"), this);
connect(m_rotateClockwiseAction, &QAction::triggered, [=] {
m_graphicsWidget->rotateClockwise90Degree();
});
m_editMenu->addAction(m_rotateClockwiseAction);
m_rotateCounterclockwiseAction = new QAction(tr("Rotate 90D CCW"), this);
connect(m_rotateCounterclockwiseAction, &QAction::triggered, [=] {
m_graphicsWidget->rotateCounterclockwise90Degree();
});
m_editMenu->addAction(m_rotateCounterclockwiseAction);
m_switchXzAction = new QAction(tr("Switch XZ"), this);
connect(m_switchXzAction, &QAction::triggered, [=] {
m_graphicsWidget->switchSelectedXZ();
});
m_editMenu->addAction(m_switchXzAction);
m_setCutFaceAction = new QAction(tr("Cut Face..."), this);
connect(m_setCutFaceAction, &QAction::triggered, [=] {
m_graphicsWidget->showSelectedCutFaceSettingPopup(m_graphicsWidget->mapFromGlobal(QCursor::pos()));
});
m_editMenu->addAction(m_setCutFaceAction);
m_clearCutFaceAction = new QAction(tr("Clear Cut Face"), this);
connect(m_clearCutFaceAction, &QAction::triggered, [=] {
m_graphicsWidget->clearSelectedCutFace();
});
m_editMenu->addAction(m_clearCutFaceAction);
//m_createWrapPartsAction = new QAction(tr("Create Wrap Parts"), this);
//connect(m_createWrapPartsAction, &QAction::triggered, [=] {
// m_graphicsWidget->createWrapParts();
//});
//m_editMenu->addAction(m_createWrapPartsAction);
m_alignToMenu = new QMenu(tr("Align To"));
m_alignToLocalCenterAction = new QAction(tr("Local Center"), this);
connect(m_alignToLocalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalCenter);
m_alignToMenu->addAction(m_alignToLocalCenterAction);
m_alignToLocalVerticalCenterAction = new QAction(tr("Local Vertical Center"), this);
connect(m_alignToLocalVerticalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalVerticalCenter);
m_alignToMenu->addAction(m_alignToLocalVerticalCenterAction);
m_alignToLocalHorizontalCenterAction = new QAction(tr("Local Horizontal Center"), this);
connect(m_alignToLocalHorizontalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalHorizontalCenter);
m_alignToMenu->addAction(m_alignToLocalHorizontalCenterAction);
m_alignToGlobalCenterAction = new QAction(tr("Global Center"), this);
connect(m_alignToGlobalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalCenter);
m_alignToMenu->addAction(m_alignToGlobalCenterAction);
m_alignToGlobalVerticalCenterAction = new QAction(tr("Global Vertical Center"), this);
connect(m_alignToGlobalVerticalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalVerticalCenter);
m_alignToMenu->addAction(m_alignToGlobalVerticalCenterAction);
m_alignToGlobalHorizontalCenterAction = new QAction(tr("Global Horizontal Center"), this);
connect(m_alignToGlobalHorizontalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalHorizontalCenter);
m_alignToMenu->addAction(m_alignToGlobalHorizontalCenterAction);
m_editMenu->addMenu(m_alignToMenu);
m_markAsMenu = new QMenu(tr("Mark As"));
m_markAsNoneAction = new QAction(tr("None"), this);
connect(m_markAsNoneAction, &QAction::triggered, [=]() {
m_graphicsWidget->setSelectedNodesBoneMark(BoneMark::None);
});
m_markAsMenu->addAction(m_markAsNoneAction);
m_markAsMenu->addSeparator();
for (int i = 0; i < (int)BoneMark::Count - 1; i++) {
BoneMark boneMark = (BoneMark)(i + 1);
m_markAsActions[i] = new QAction(MarkIconCreator::createIcon(boneMark), BoneMarkToDispName(boneMark), this);
connect(m_markAsActions[i], &QAction::triggered, [=]() {
m_graphicsWidget->setSelectedNodesBoneMark(boneMark);
});
m_markAsMenu->addAction(m_markAsActions[i]);
}
m_editMenu->addMenu(m_markAsMenu);
m_colorizeAsMenu = new QMenu(tr("Colorize"));
m_colorizeAsBlankAction = new QAction(tr("Blank"), this);
connect(m_colorizeAsBlankAction, &QAction::triggered, [=]() {
m_graphicsWidget->fadeSelected();
});
m_colorizeAsMenu->addAction(m_colorizeAsBlankAction);
m_colorizeAsAutoAction = new QAction(tr("Auto Color"), this);
connect(m_colorizeAsAutoAction, &QAction::triggered, [=]() {
m_graphicsWidget->colorizeSelected();
});
m_colorizeAsMenu->addAction(m_colorizeAsAutoAction);
m_editMenu->addMenu(m_colorizeAsMenu);
m_selectAllAction = new QAction(tr("Select All"), this);
connect(m_selectAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::selectAll);
m_editMenu->addAction(m_selectAllAction);
m_selectPartAllAction = new QAction(tr("Select Part"), this);
connect(m_selectPartAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::selectPartAll);
m_editMenu->addAction(m_selectPartAllAction);
m_unselectAllAction = new QAction(tr("Unselect All"), this);
connect(m_unselectAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
m_editMenu->addAction(m_unselectAllAction);
connect(m_editMenu, &QMenu::aboutToShow, [=]() {
m_undoAction->setEnabled(m_document->undoable());
m_redoAction->setEnabled(m_document->redoable());
m_deleteAction->setEnabled(m_graphicsWidget->hasSelection());
m_breakAction->setEnabled(m_graphicsWidget->hasEdgeSelection());
m_reduceAction->setEnabled(m_graphicsWidget->hasSelection());
m_reverseAction->setEnabled(m_graphicsWidget->hasEdgeSelection());
m_connectAction->setEnabled(m_graphicsWidget->hasTwoDisconnectedNodesSelection());
m_cutAction->setEnabled(m_graphicsWidget->hasSelection());
m_copyAction->setEnabled(m_graphicsWidget->hasSelection());
m_pasteAction->setEnabled(m_document->hasPastableNodesInClipboard());
m_flipHorizontallyAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_flipVerticallyAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_rotateClockwiseAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_rotateCounterclockwiseAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_switchXzAction->setEnabled(m_graphicsWidget->hasSelection());
m_setCutFaceAction->setEnabled(m_graphicsWidget->hasSelection());
m_clearCutFaceAction->setEnabled(m_graphicsWidget->hasCutFaceAdjustedNodesSelection());
//m_createWrapPartsAction->setEnabled(m_graphicsWidget->hasSelection());
m_colorizeAsBlankAction->setEnabled(m_graphicsWidget->hasSelection());
m_colorizeAsAutoAction->setEnabled(m_graphicsWidget->hasSelection());
m_alignToGlobalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled());
m_alignToGlobalVerticalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled());
m_alignToGlobalHorizontalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled());
m_alignToLocalCenterAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_alignToLocalVerticalCenterAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_alignToLocalHorizontalCenterAction->setEnabled(m_graphicsWidget->hasMultipleSelection());
m_alignToMenu->setEnabled((m_graphicsWidget->hasSelection() && m_document->originSettled()) || m_graphicsWidget->hasMultipleSelection());
m_selectAllAction->setEnabled(m_graphicsWidget->hasItems());
m_selectPartAllAction->setEnabled(m_graphicsWidget->hasItems());
m_unselectAllAction->setEnabled(m_graphicsWidget->hasSelection());
});
m_viewMenu = menuBar()->addMenu(tr("&View"));
//auto isModelSitInVisibleArea = [](ModelWidget *modelWidget) {

View File

@ -163,47 +163,6 @@ private:
QAction *m_exportDs3objAction;
QAction *m_exportRenderedAsImageAction;
QMenu *m_editMenu;
QAction *m_addAction;
QAction *m_undoAction;
QAction *m_redoAction;
QAction *m_deleteAction;
QAction *m_breakAction;
QAction *m_reduceAction;
QAction *m_reverseAction;
QAction *m_connectAction;
QAction *m_cutAction;
QAction *m_copyAction;
QAction *m_pasteAction;
QAction *m_flipHorizontallyAction;
QAction *m_flipVerticallyAction;
QAction *m_rotateClockwiseAction;
QAction *m_rotateCounterclockwiseAction;
QAction *m_switchXzAction;
QAction *m_setCutFaceAction;
QAction *m_clearCutFaceAction;
QAction *m_createWrapPartsAction;
QMenu *m_alignToMenu;
QAction *m_alignToGlobalCenterAction;
QAction *m_alignToGlobalVerticalCenterAction;
QAction *m_alignToGlobalHorizontalCenterAction;
QAction *m_alignToLocalCenterAction;
QAction *m_alignToLocalVerticalCenterAction;
QAction *m_alignToLocalHorizontalCenterAction;
QAction *m_selectAllAction;
QAction *m_selectPartAllAction;
QAction *m_unselectAllAction;
QMenu *m_markAsMenu;
QAction *m_markAsNoneAction;
QAction *m_markAsActions[(int)BoneMark::Count - 1];
QMenu *m_colorizeAsMenu;
QAction *m_colorizeAsBlankAction;
QAction *m_colorizeAsAutoAction;
QMenu *m_viewMenu;
//QAction *m_resetModelWidgetPosAction;
QAction *m_toggleWireframeAction;