diff --git a/common/lc_commands.cpp b/common/lc_commands.cpp index d67b0a5c..ff636e75 100644 --- a/common/lc_commands.cpp +++ b/common/lc_commands.cpp @@ -283,13 +283,6 @@ const lcCommand gCommands[] = QT_TRANSLATE_NOOP("Status", "Select objects by name"), "" }, - // LC_EDIT_SELECT_BY_COLOR - { - QT_TRANSLATE_NOOP("Action", "Edit.SelectByColor"), - QT_TRANSLATE_NOOP("Menu", "Select by Col&or..."), - QT_TRANSLATE_NOOP("Status", "Select pieces by color"), - "" - }, // LC_EDIT_SELECT_SINGLE { QT_TRANSLATE_NOOP("Action", "Edit.SelectSingle"), diff --git a/common/lc_commands.h b/common/lc_commands.h index ed08b238..178ac743 100644 --- a/common/lc_commands.h +++ b/common/lc_commands.h @@ -44,7 +44,6 @@ enum lcCommandId LC_EDIT_SELECT_NONE, LC_EDIT_SELECT_INVERT, LC_EDIT_SELECT_BY_NAME, - LC_EDIT_SELECT_BY_COLOR, LC_EDIT_SELECTION_MODE_FIRST, LC_EDIT_SELECTION_SINGLE = LC_EDIT_SELECTION_MODE_FIRST, LC_EDIT_SELECTION_PIECE, diff --git a/common/lc_findreplacewidget.cpp b/common/lc_findreplacewidget.cpp index dbc7935a..ec746358 100644 --- a/common/lc_findreplacewidget.cpp +++ b/common/lc_findreplacewidget.cpp @@ -62,13 +62,15 @@ lcFindReplaceWidget::lcFindReplaceWidget(QWidget* Parent, lcModel* Model, bool R if (Replace) { - ReplaceColorCheckBox = new QCheckBox(tr("Replace Color"), this); + Layout->addWidget(new QLabel(tr("Replace:")), 1, 0); + + ReplaceColorCheckBox = new QCheckBox(this); Layout->addWidget(ReplaceColorCheckBox, 1, 1); ReplaceColorPicker = new lcQColorPicker(this); Layout->addWidget(ReplaceColorPicker, 1, 2); - ReplacePartCheckBox = new QCheckBox(tr("Replace Part"), this); + ReplacePartCheckBox = new QCheckBox(this); Layout->addWidget(ReplacePartCheckBox, 1, 3); ReplacePartComboBox = new QComboBox(this); diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 65dd068e..06e63da5 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -501,7 +501,6 @@ void lcMainWindow::CreateMenus() EditMenu->addAction(mActions[LC_EDIT_SELECT_NONE]); EditMenu->addAction(mActions[LC_EDIT_SELECT_INVERT]); EditMenu->addAction(mActions[LC_EDIT_SELECT_BY_NAME]); - EditMenu->addAction(mActions[LC_EDIT_SELECT_BY_COLOR]); EditMenu->addMenu(mSelectionModeMenu); EditMenu->addSeparator(); EditMenu->addMenu(mTransformMenu); @@ -2009,11 +2008,12 @@ void lcMainWindow::UpdateSelectedObjects(bool SelectionChanged) mActions[LC_EDIT_FIND]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_FIND_NEXT]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_FIND_PREVIOUS]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); + mActions[LC_EDIT_FIND_ALL]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_REPLACE]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_REPLACE_NEXT]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); + mActions[LC_EDIT_REPLACE_ALL]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_SELECT_INVERT]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_SELECT_BY_NAME]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); - mActions[LC_EDIT_SELECT_BY_COLOR]->setEnabled((Flags & LC_SEL_NO_PIECES) == 0); mActions[LC_EDIT_SELECT_NONE]->setEnabled(Flags & LC_SEL_SELECTED); mActions[LC_EDIT_SELECT_ALL]->setEnabled(Flags & LC_SEL_UNSELECTED); @@ -2770,11 +2770,6 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) ActiveModel->ShowSelectByNameDialog(); break; - case LC_EDIT_SELECT_BY_COLOR: - if (ActiveModel) - ActiveModel->ShowSelectByColorDialog(); - break; - case LC_EDIT_SELECTION_SINGLE: SetSelectionMode(lcSelectionMode::Single); break; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 30e50bd3..7d25039e 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -20,7 +20,6 @@ #include "lc_minifigdialog.h" #include "lc_qgroupdialog.h" #include "lc_qeditgroupsdialog.h" -#include "lc_selectbycolordialog.h" #include "lc_qpropertiesdialog.h" #include "lc_qutils.h" #include "lc_lxf.h" @@ -4301,36 +4300,6 @@ void lcModel::ShowSelectByNameDialog() SetSelectionAndFocus(Dialog.mObjects, nullptr, 0, false); } -void lcModel::ShowSelectByColorDialog() -{ - if (mPieces.IsEmpty()) - { - QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Nothing to select.")); - return; - } - - int ColorIndex = gMainWindow->mColorIndex; - - lcObject* Focus = GetFocusObject(); - - if (Focus && Focus->IsPiece()) - ColorIndex = ((lcPiece*)Focus)->GetColorIndex(); - - lcSelectByColorDialog Dialog(gMainWindow, ColorIndex); - - if (Dialog.exec() != QDialog::Accepted) - return; - - ColorIndex = Dialog.mColorIndex; - lcArray Selection; - - for (lcPiece* Piece : mPieces) - if (Piece->IsVisible(mCurrentStep) && Piece->GetColorIndex() == ColorIndex) - Selection.Add(Piece); - - SetSelectionAndFocus(Selection, nullptr, 0, false); -} - void lcModel::ShowArrayDialog() { lcVector3 Center; diff --git a/common/lc_model.h b/common/lc_model.h index 1a168357..5e3096e9 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -341,7 +341,6 @@ public: void ShowPropertiesDialog(); void ShowSelectByNameDialog(); - void ShowSelectByColorDialog(); void ShowArrayDialog(); void ShowMinifigDialog(); void UpdateInterface(); diff --git a/common/lc_selectbycolordialog.cpp b/common/lc_selectbycolordialog.cpp deleted file mode 100644 index 87471639..00000000 --- a/common/lc_selectbycolordialog.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "lc_global.h" -#include "lc_selectbycolordialog.h" -#include "lc_qcolorpicker.h" - -lcSelectByColorDialog::lcSelectByColorDialog(QWidget* Parent, int ColorIndex) - : QDialog(Parent), mColorIndex(ColorIndex) -{ - setWindowTitle(tr("Select By Color")); - - QVBoxLayout* MainLayout = new QVBoxLayout(this); - - QHBoxLayout* ColorLayout = new QHBoxLayout(); - ColorLayout->setContentsMargins(0, 0, 0, 0); - - QLabel* ColorLabel = new QLabel(tr("Color:"), this); - ColorLayout->addWidget(ColorLabel); - - mColorPicker = new lcQColorPicker(this); - mColorPicker->setCurrentColor(mColorIndex); - ColorLayout->addWidget(mColorPicker); - - MainLayout->addLayout(ColorLayout); - - QDialogButtonBox* ButtonBox = new QDialogButtonBox(this); - ButtonBox->setOrientation(Qt::Horizontal); - ButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); - - MainLayout->addWidget(ButtonBox); - - QObject::connect(ButtonBox, SIGNAL(accepted()), this, SLOT(accept())); - QObject::connect(ButtonBox, SIGNAL(rejected()), this, SLOT(reject())); -} - -lcSelectByColorDialog::~lcSelectByColorDialog() -{ -} - -void lcSelectByColorDialog::accept() -{ - mColorIndex = mColorPicker->currentColor(); - - QDialog::accept(); -} diff --git a/common/lc_selectbycolordialog.h b/common/lc_selectbycolordialog.h deleted file mode 100644 index 52296c0c..00000000 --- a/common/lc_selectbycolordialog.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "lc_array.h" -class lcQColorPicker; - -class lcSelectByColorDialog : public QDialog -{ -public: - Q_OBJECT - -public: - lcSelectByColorDialog(QWidget* Parent, int ColorIndex); - ~lcSelectByColorDialog(); - - int mColorIndex; - -public slots: - void accept() override; - -protected: - lcQColorPicker* mColorPicker; -}; - diff --git a/leocad.pro b/leocad.pro index 43d7dc0d..c0d4df85 100644 --- a/leocad.pro +++ b/leocad.pro @@ -190,7 +190,6 @@ SOURCES += \ common/lc_previewwidget.cpp \ common/lc_profile.cpp \ common/lc_scene.cpp \ - common/lc_selectbycolordialog.cpp \ common/lc_shortcuts.cpp \ common/lc_stringcache.cpp \ common/lc_synth.cpp \ @@ -259,7 +258,6 @@ HEADERS += \ common/lc_previewwidget.h \ common/lc_profile.h \ common/lc_scene.h \ - common/lc_selectbycolordialog.h \ common/lc_shortcuts.h \ common/lc_stringcache.h \ common/lc_synth.h \