Phase 11: Complete and verify the minimal music-making workflow

This commit is contained in:
Johannes Findeisen 2026-10-27 03:25:04 +01:00
commit 461689dd44
12 changed files with 463 additions and 25 deletions

View file

@ -10,12 +10,12 @@
#include <unistd.h>
namespace {
Fl_Widget *find(Fl_Group &group, const char *label)
Fl_Widget *find(Fl_Group &group, const char *label, bool exact = false)
{
for (int i = 0; i < group.children(); ++i) {
Fl_Widget *child = group.child(i);
if (child->label() != nullptr && std::strstr(child->label(), label) != nullptr) return child;
if (auto *nested = dynamic_cast<Fl_Group *>(child)) if (auto *match = find(*nested, label)) return match;
if (child->label() != nullptr && (exact ? std::strcmp(child->label(), label) == 0 : std::strstr(child->label(), label) != nullptr)) return child;
if (auto *nested = dynamic_cast<Fl_Group *>(child)) if (auto *match = find(*nested, label, exact)) return match;
}
return nullptr;
}
@ -107,7 +107,7 @@ int main(int argc, char **argv)
CHECK(window.open_project(song.c_str()) == XTC_OK);
play->do_callback(); pump();
CHECK(find(window, "running — modular graph") != nullptr);
auto *add_midi = find(window, "Add MIDI clip"); CHECK(add_midi != nullptr);
auto *add_midi = find(window, "Add MIDI clip", true); CHECK(add_midi != nullptr);
add_midi->do_callback(); CHECK(window.open_piano_roll() == XTC_OK);
CHECK(window.piano_roll()->add_note(0, 960, 69) == XTC_OK);
CHECK(window.save_project(song.c_str()) == XTC_OK);