Label text stages in the chain list with their words
Effect::label(values) names a stage in a list, defaulting to the title; the text effect answers "Text (words)", and the chain rows are renamed in place as params change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-2
@@ -1313,6 +1313,7 @@ void EffectorWindow::rebuildChainRows() {
|
||||
// Only the rows: the placeholder is a child of the list box as well, and
|
||||
// removing it would leave the empty list blank.
|
||||
while (auto* row = chainList_.get_row_at_index(0)) chainList_.remove(*row);
|
||||
stageLabels_.clear();
|
||||
|
||||
// The first stage that actually runs is the one handed the sources, which
|
||||
// is not stage 1 once stage 1 is switched off.
|
||||
@@ -1343,8 +1344,8 @@ void EffectorWindow::rebuildChainRows() {
|
||||
});
|
||||
box->append(*check);
|
||||
|
||||
auto* label = Gtk::make_managed<Gtk::Label>(std::to_string(index + 1) + ". " +
|
||||
stages_[i].effect->title());
|
||||
auto* label = Gtk::make_managed<Gtk::Label>(stageLabel(i));
|
||||
stageLabels_.push_back(label);
|
||||
label->set_xalign(0.0F);
|
||||
label->set_hexpand(true);
|
||||
label->set_ellipsize(Pango::EllipsizeMode::END);
|
||||
@@ -1418,8 +1419,17 @@ void EffectorWindow::onStageSelected() {
|
||||
|
||||
// ------------------------------------------------------------ rendering ---
|
||||
|
||||
std::string EffectorWindow::stageLabel(std::size_t index) const {
|
||||
const ChainStage& stage = stages_[index];
|
||||
return std::to_string(index + 1) + ". " + stage.effect->label(stageValues(stage, styles_));
|
||||
}
|
||||
|
||||
void EffectorWindow::onParamChanged() {
|
||||
storeParams();
|
||||
// A param can be what names the stage (the words of a text stage), and a
|
||||
// styled one can rename every stage sharing the style.
|
||||
for (std::size_t i = 0; i < stageLabels_.size() && i < stages_.size(); ++i)
|
||||
stageLabels_[i]->set_text(stageLabel(i));
|
||||
requestRender();
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ private:
|
||||
// The check on a chain row: the stage stays where it is, and is skipped.
|
||||
void setStageEnabled(int index, bool enabled);
|
||||
void rebuildChainRows();
|
||||
std::string stageLabel(std::size_t index) const;
|
||||
void selectStage(int index);
|
||||
void onStageSelected();
|
||||
Gtk::Widget& buildMainMenu(); // the header menu: new, open, save project
|
||||
@@ -145,6 +146,8 @@ private:
|
||||
StyleSet styles_;
|
||||
int selectedStage_ = 0;
|
||||
bool suspendStageSelect_ = false; // guards the rebuild of the chain rows
|
||||
// The name label of each chain row, renamed in place as params change.
|
||||
std::vector<Gtk::Label*> stageLabels_;
|
||||
Image result_;
|
||||
std::uint64_t seed_ = 0;
|
||||
std::string projectPath_; // empty until the project has been saved once
|
||||
|
||||
Reference in New Issue
Block a user