Skip to content

Commit

Permalink
Merge pull request #983 from LibrePCB/fix-open-add-component-dialog
Browse files Browse the repository at this point in the history
Schematic editor: Fix opening component chooser dialog

(cherry picked from commit 07e1f09)
  • Loading branch information
ubruhin committed Sep 23, 2022
1 parent 9fb8a09 commit acf89fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -57,6 +57,7 @@ SchematicEditorState_AddComponent::SchematicEditorState_AddComponent(
const Context& context) noexcept
: SchematicEditorState(context),
mIsUndoCmdActive(false),
mUseAddComponentDialog(true),
mAddComponentDialog(nullptr),
mLastAngle(0),
mCurrentComponent(nullptr),
Expand Down Expand Up @@ -156,6 +157,7 @@ bool SchematicEditorState_AddComponent::processAddComponent() noexcept {
// start adding (another) component
if (!abortCommand(true)) return false;
mLastAngle.setAngleMicroDeg(0); // reset the angle
mUseAddComponentDialog = true;
startAddingComponent();
return true;
} catch (UserCanceled& exc) {
Expand All @@ -172,6 +174,7 @@ bool SchematicEditorState_AddComponent::processAddComponent(
// start adding (another) component
if (!abortCommand(true)) return false;
mLastAngle.setAngleMicroDeg(0); // reset the angle
mUseAddComponentDialog = false;
startAddingComponent(cmp, symbVar);
return true;
} catch (UserCanceled& exc) {
Expand Down Expand Up @@ -199,7 +202,8 @@ bool SchematicEditorState_AddComponent::processAbortCommand() noexcept {
if (!abortCommand(true)) {
return false;
}
if (mAddComponentDialog && mAddComponentDialog->getAutoOpenAgain()) {
if (mUseAddComponentDialog && mAddComponentDialog &&
mAddComponentDialog->getAutoOpenAgain()) {
mLastAngle.setAngleMicroDeg(0); // reset the angle
startAddingComponent();
return true;
Expand Down
Expand Up @@ -108,6 +108,7 @@ class SchematicEditorState_AddComponent final : public SchematicEditorState {

private: // Data
bool mIsUndoCmdActive;
bool mUseAddComponentDialog;
QScopedPointer<AddComponentDialog> mAddComponentDialog;
Angle mLastAngle;

Expand Down

0 comments on commit acf89fc

Please sign in to comment.