docs(screenshots): show real MIDI input devices in preferences dropdown

This commit is contained in:
Johannes Findeisen 2026-11-06 02:48:18 +01:00
commit 0c91f29453
4 changed files with 35 additions and 0 deletions

View file

@ -13,6 +13,7 @@
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Input_Choice.H>
#include <FL/Fl_Scroll.H>
#include <FL/x.H>
#include <chrono>
@ -63,6 +64,26 @@ int main(int argc,char **argv) {
MainWindow window(false,"");main_window=&window;window.resize(0,0,1400,900);window.show();check(window.open_project(project.c_str()));pump();
auto *s=first<SequencerWidget>(window);if(!s)throw std::runtime_error("Sequencer missing");
auto reset=[&](){window.reset_layout();check(window.open_project(project.c_str()));window.resize(0,20,1400,900);tab("Sequencer");s->select(0,0);s->position(0);check(window.set_loop(3840,7680,true));window.fit_song();pump();};
if(std::getenv("XTC_CAPTURE_MIDI_INPUT_ONLY")) {
reset();
if(window.midi_devices(true).empty())throw std::runtime_error("No real MIDI input sources exposed by the host");
Fl::add_timeout(.3,[](void*){
auto *preferences=Fl::modal();if(!preferences)throw std::runtime_error("Preferences missing");
auto *tabs=first<Fl_Tabs>(*preferences);auto *page=named(*preferences,"midi");
if(!tabs || !page)throw std::runtime_error("MIDI preferences missing");
tabs->value(page);tabs->redraw();pump();
auto *choice=dynamic_cast<Fl_Input_Choice *>(named(*preferences,"Default MIDI input source (next Play)"));
if(!choice || choice->menubutton()->size()<3)throw std::runtime_error("MIDI source list is empty");
Fl::add_timeout(.3,[](void*){
capture("preferences-midi-input-devices");
if(system("xdotool key Escape"))std::abort();
});
choice->menubutton()->popup();
auto *close=named(*preferences,"Close");if(!close)throw std::runtime_error("Preferences close missing");close->do_callback();
});
window.show_preferences();window.do_callback();
std::puts("Real host MIDI input device dropdown captured.");return 0;
}
if(std::getenv("XTC_CAPTURE_MIDI_ONLY")) {
reset();dialog("preferences-midi",[&]{window.show_preferences();},"midi");
dialog("preferences-midi-help",[&]{window.show_preferences();},"MIDI help");