Skip to content

Commit

Permalink
filter out some attributes
Browse files Browse the repository at this point in the history
The attributes like `min-value`, `max-value`, `default-value`, `mouse-enabled` and the `title` attribute for text labels/edit fields are now filtered for controls which are managed by parameters, which will always override these values.
  • Loading branch information
scheffle committed Oct 7, 2023
1 parent da4e395 commit 56862d7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 107 deletions.
25 changes: 24 additions & 1 deletion vstgui/plugin-bindings/vst3editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,30 @@ void VST3Editor::save (bool saveAs)
}
if (savePath.empty ())
return;
if (description->save (savePath.c_str (), VST3EditorInternal::getUIDescriptionSaveOptions (frame)))

// filter out attributes we will always override with the values from the parameters
auto filter = [] (CView* view, const std::string& name) -> bool {
if (auto control = dynamic_cast<CControl*> (view))
{
if (control->getTag () != -1)
{
if (name == UIViewCreator::kAttrMinValue)
return false;
if (name == UIViewCreator::kAttrMaxValue)
return false;
if (name == UIViewCreator::kAttrDefaultValue)
return false;
if (name == UIViewCreator::kAttrMouseEnabled)
return false;
if (name == UIViewCreator::kAttrTitle && dynamic_cast<CTextLabel*> (control))
return false;
}
}
return true;
};

if (description->save (savePath.c_str (),
VST3EditorInternal::getUIDescriptionSaveOptions (frame), filter))
description->setFilePath (savePath.c_str ());
}

Expand Down
Loading

0 comments on commit 56862d7

Please sign in to comment.