Skip to content

Commit

Permalink
Box: handle property selected changed #177
Browse files Browse the repository at this point in the history
And disable graph icon for properties.
  • Loading branch information
rodlie committed Aug 24, 2024
1 parent f5e82b1 commit d586eb6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/app/GUI/BoxesList/boxsinglewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ BoxSingleWidget::BoxSingleWidget(BoxScroller * const parent)
} else if (const auto eEff = enve_cast<eEffect*>(target)) {
if (eEff->isVisible()) { return BoxSingleWidget::VISIBLE_ICON; }
return BoxSingleWidget::INVISIBLE_ICON;
} else if (enve_cast<GraphAnimator*>(target)) {
} /*else if (enve_cast<GraphAnimator*>(target)) {
const auto bsvt = static_cast<BoxScroller*>(mParent);
const auto keysView = bsvt->getKeysView();
if (keysView) { return BoxSingleWidget::GRAPH_PROPERTY_ICON; }
return static_cast<QPixmap*>(nullptr);
}
}*/
return static_cast<QPixmap*>(nullptr);
});

Expand Down Expand Up @@ -382,6 +382,24 @@ void BoxSingleWidget::setComboProperty(ComboBoxProperty* const combo) {
mPropertyComboBox->show();
}

void BoxSingleWidget::handlePropertySelectedChanged(const Property *prop)
{
if (const auto graph = enve_cast<GraphAnimator*>(prop)) {
const auto bsvt = static_cast<BoxScroller*>(mParent);
const auto keysView = bsvt->getKeysView();
if (keysView) {
const bool graphSelected = keysView->graphIsSelected(graph);
const bool isSelected = prop->prp_isSelected();
if (graphSelected) {
if (!isSelected) { keysView->graphRemoveViewedAnimator(graph); }
} else {
if (isSelected) { keysView->graphAddViewedAnimator(graph); }
}
Document::sInstance->actionFinished();
}
}
}

ColorAnimator *BoxSingleWidget::getColorTarget() const {
const auto swt = mTarget->getTarget();
ColorAnimator * color = nullptr;
Expand Down Expand Up @@ -561,6 +579,8 @@ void BoxSingleWidget::setTargetAbstraction(SWT_Abstraction *abs) {
if(!boundingBox && !eindependentSound) {
mTargetConn << connect(prop, &Property::prp_selectionChanged,
this, qOverload<>(&QWidget::update));
mTargetConn << connect(prop, &Property::prp_selectionChanged,
this, [this, prop]() { handlePropertySelectedChanged(prop); });
}

mValueSlider->setVisible(valueSliderVisible);
Expand Down Expand Up @@ -878,7 +898,7 @@ void BoxSingleWidget::switchBoxVisibleAction() {
ebos->switchVisible();
} else if(const auto eEff = enve_cast<eEffect*>(target)) {
eEff->switchVisible();
} else if(const auto graph = enve_cast<GraphAnimator*>(target)) {
} /*else if(const auto graph = enve_cast<GraphAnimator*>(target)) {
const auto bsvt = static_cast<BoxScroller*>(mParent);
const auto keysView = bsvt->getKeysView();
if(keysView) {
Expand All @@ -889,7 +909,7 @@ void BoxSingleWidget::switchBoxVisibleAction() {
}
Document::sInstance->actionFinished();
}
}
}*/
Document::sInstance->actionFinished();
update();
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/GUI/BoxesList/boxsinglewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class BoxSingleWidget : public SingleWidget {

void setComboProperty(ComboBoxProperty * const combo);

void handlePropertySelectedChanged(const Property *prop);

BoxScroller* const mParent;

bool mDragPressPos = false;
Expand Down

0 comments on commit d586eb6

Please sign in to comment.