diff --git a/src/HC-3/HC-3-ui.cpp b/src/HC-3/HC-3-ui.cpp index 97be6b0..866ec48 100644 --- a/src/HC-3/HC-3-ui.cpp +++ b/src/HC-3/HC-3-ui.cpp @@ -12,6 +12,11 @@ constexpr const float START_ROW = 47.5f; constexpr const float ITEM_INTERVAL = 20.f; constexpr const float DIVIDER_OFFSET = 5.f; +std::string hc3_sample_data[] = { + "Experimental", "Strings", "Winds", "Guitars", "Pads", "Leads", "Album 4", "Album 5", + "Mon practice", "", "Th Jam", "Blues setlist", "Recital 10/7", "Community Concert 8/21", "" ,"empty" +}; + Hc3ModuleWidget::Hc3ModuleWidget(Hc3Module* module) : my_module(module) { @@ -57,6 +62,21 @@ void Hc3ModuleWidget::step() if (module && device_label->getText().empty()) { my_module->getPartner(); } + if (!module && !hacked_lights) { + // Rack turns every light to full brightness in the module browser + // we hack it here to show a more representative state. + int n = 0; + for (auto child: children) { + auto light = dynamic_cast(child); + if (light) { + NVGcolor co = *light->baseColors.begin(); + co.a = n == CHOSEN_SAMPLE ? 1.f : hc3_sample_data[n].empty() ? 0.f : .3f; + light->color = co; + ++n; + } + } + hacked_lights = true; + } } void Hc3ModuleWidget::refreshDescriptions() diff --git a/src/HC-3/HC-3.hpp b/src/HC-3/HC-3.hpp index 8c0508d..0fc3d27 100644 --- a/src/HC-3/HC-3.hpp +++ b/src/HC-3/HC-3.hpp @@ -11,6 +11,9 @@ namespace pachde { +extern std::string hc3_sample_data[]; +constexpr const int CHOSEN_SAMPLE = 11; + struct Hc3Module : Module, IHandleHcEvents { enum Params { @@ -25,7 +28,6 @@ struct Hc3Module : Module, IHandleHcEvents NUM_LIGHTS }; - int loaded_id; std::vector files; PartnerBinding partner_binding; @@ -64,6 +66,7 @@ struct Hc3ModuleWidget : ModuleWidget, IHandleHcEvents Hc3Module* my_module; DrawSquareButton drawButton; StaticTextLabel* device_label = nullptr; + bool hacked_lights = false; Hc3ModuleWidget(Hc3Module* module); diff --git a/src/HC-3/preset_file_widget.hpp b/src/HC-3/preset_file_widget.hpp index 81d1eb8..a1e822a 100644 --- a/src/HC-3/preset_file_widget.hpp +++ b/src/HC-3/preset_file_widget.hpp @@ -33,9 +33,17 @@ struct PresetFileWidget : TipWidget id = the_id; } int getId() { return id; } - bool haveFile() { return my_module && !my_module->files[id].empty(); } - bool isCurrent() { return my_module && my_module->loaded_id == id; } - std::string getLabel() { return my_module ? system::getStem(my_module->files[id]) : ""; } + bool haveFile() { + if (my_module) { return !my_module->files[id].empty(); } + return !hc3_sample_data[id].empty(); + } + bool isCurrent() { + if (my_module) { return my_module->loaded_id == id; } + return id == CHOSEN_SAMPLE; + } + std::string getLabel() { + return my_module ? system::getStem(my_module->files[id]) : hc3_sample_data[id]; + } void onDragStart(const DragStartEvent& e) override { if (e.button == GLFW_MOUSE_BUTTON_LEFT) { @@ -99,6 +107,7 @@ struct PresetFileWidget : TipWidget void step() override { TipWidget::step(); + if (!my_module) return; if (!TipWidget::hasText() && haveFile()) { describe(format_string("Open %s", my_module->files[id].c_str())); }