Skip to content

Commit

Permalink
Move image field to ImageElement base class
Browse files Browse the repository at this point in the history
simplifies some duplicate code

simplifies some braces for Elements

Also fix some `this` captures
  • Loading branch information
danngreen committed Nov 11, 2023
1 parent c3c6881 commit 65d4743
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 155 deletions.
40 changes: 20 additions & 20 deletions firmware/src/VCV_adaptor/widget_convert/Befaco.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ namespace MetaModule

template<>
inline Element make_element<::CKSSVert7>(BaseElement b) {
return SlideSwitch{{b}, 7, "SwitchTallVert.png", "SwitchTallVertHandle.png", SlideSwitch::Ascend::UpLeft};
return SlideSwitch{{b, "SwitchTallVert.png"}, 7, "SwitchTallVertHandle.png", SlideSwitch::Ascend::UpLeft};
}

template<>
inline Element make_element<::CKSSHoriz4>(BaseElement b) {
return SlideSwitch{{b}, 4, "SwitchWideHoriz_bg.png", "SwitchWideHoriz_fg.png"};
return SlideSwitch{{b, "SwitchWideHoriz_bg.png"}, 4, "SwitchWideHoriz_fg.png", SlideSwitch::Ascend::DownRight};
}

template<>
inline Element make_element<::CKSSThreeDragable>(BaseElement b) {
return SlideSwitch{{b, "CKSSThree_bg.png"}, 3, "CKSSThree_fg.png", SlideSwitch::Ascend::UpLeft};
}

template<>
Expand All @@ -63,11 +68,6 @@ inline Element make_element<::CKSSNarrow3>(BaseElement b) {
return FlipSwitch{{b}, 3, {"SwitchNarrow_0.png", "SwitchNarrow_1.png", "SwitchNarrow_2.png"}};
}

template<>
inline Element make_element<::CKSSThreeDragable>(BaseElement b) {
return SlideSwitch{{b}, 3, "CKSSThree_bg.png", "CKSSThree_fg.png", SlideSwitch::Ascend::UpLeft};
}

template<>
inline Element make_element<::ThreeStateBefacoSwitchMomentary>(BaseElement b) {
return FlipSwitch{
Expand All @@ -81,67 +81,67 @@ inline Element make_element<::Knurlie>(BaseElement b) {

template<>
inline Element make_element<::BefacoTinyKnobWhite>(BaseElement b) {
return Knob{{b}, "BefacoTinyKnobWhite.png"};
return Knob{b, "BefacoTinyKnobWhite.png"};
};

template<>
inline Element make_element<::BefacoTinyKnobRed>(BaseElement b) {
return Knob{{b}, "BefacoTinyKnobRed.png"};
return Knob{b, "BefacoTinyKnobRed.png"};
};

template<>
inline Element make_element<::BefacoTinyKnobDarkGrey>(BaseElement b) {
return Knob{{b}, "BefacoTinyKnobDarkGrey.png"};
return Knob{b, "BefacoTinyKnobDarkGrey.png"};
};

template<>
inline Element make_element<::BefacoTinyKnobLightGrey>(BaseElement b) {
return Knob{{b}, "BefacoTinyKnobLightGrey.png"};
return Knob{b, "BefacoTinyKnobLightGrey.png"};
};

template<>
inline Element make_element<::BefacoTinyKnobBlack>(BaseElement b) {
return Knob{{b}, "BefacoTinyKnobBlack.png"};
return Knob{b, "BefacoTinyKnobBlack.png"};
};

template<>
inline Element make_element<::Davies1900hLargeGreyKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hLargeGrey.png"};
return Knob{b, "Davies1900hLargeGrey.png"};
};

template<>
inline Element make_element<::Davies1900hLightGreyKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hLightGrey.png"};
return Knob{b, "Davies1900hLightGrey.png"};
};

template<>
inline Element make_element<::Davies1900hLargeLightGreyKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hLargeLightGrey.png"};
return Knob{b, "Davies1900hLargeLightGrey.png"};
};

template<>
inline Element make_element<::Davies1900hDarkGreyKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hDarkGrey.png"};
return Knob{b, "Davies1900hDarkGrey.png"};
};

template<>
inline Element make_element<::Crossfader>(BaseElement b) {
return Slider{{b}, "Crossfader.png", "CrossfaderHandle.png"};
return Slider{{b, "Crossfader.png"}, "CrossfaderHandle.png"};
};

template<>
inline Element make_element<::BefacoSlidePotSmall>(BaseElement b) {
return Slider{{b}, "BefacoSlidePotSmall.png", "BefacoSlidePotHandleSmall.png"};
return Slider{{b, "BefacoSlidePotSmall.png"}, "BefacoSlidePotHandleSmall.png"};
};

template<>
inline Element make_element_output<::BananutRed>(BaseElement b) {
return JackOutput{{{b}, "BananutRed.png"}};
return JackOutput{b, "BananutRed.png"};
};

template<>
inline Element make_element_input<::BananutBlack>(BaseElement b) {
return JackInput{{{b}, "BananutBlack.png"}};
return JackInput{b, "BananutBlack.png"};
};

} // namespace MetaModule
70 changes: 35 additions & 35 deletions firmware/src/VCV_adaptor/widget_convert/Rack.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,125 +19,125 @@ inline Element make_element<rack::componentlibrary::CKSS>(BaseElement b) {

template<>
inline Element make_element<rack::componentlibrary::BefacoPush>(BaseElement b) {
return MomentaryButton{{{b}, "BefacoPush_0.png"}};
return MomentaryButton{b, "BefacoPush_0.png"};
};

template<>
inline Element make_element<rack::componentlibrary::CKD6>(BaseElement b) {
return MomentaryButton{{{b}, "CKD6_0.png"}};
return MomentaryButton{b, "CKD6_0.png"};
};

template<>
inline Element make_element<rack::componentlibrary::TL1105>(BaseElement b) {
return MomentaryButton{{{b}, "TL1105.png"}};
return MomentaryButton{b, "TL1105.png"};
};

template<>
inline Element make_element<rack::componentlibrary::LEDBezel>(BaseElement b) {
return MomentaryButton{{{b}, "VCVBezel.png"}};
return MomentaryButton{b, "VCVBezel.png"};
};

template<>
inline Element make_element<rack::componentlibrary::BefacoBigKnob>(BaseElement b) {
return Knob{{b}, "BefacoBigKnob.png"};
return Knob{b, "BefacoBigKnob.png"};
};

template<>
inline Element make_element<rack::componentlibrary::BefacoTinyKnob>(BaseElement b) {
return Knob{{b}, "BefacoTinyKnobWhite.png"};
return Knob{b, "BefacoTinyKnobWhite.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Davies1900hBlackKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hBlack.png"};
return Knob{b, "Davies1900hBlack.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Davies1900hWhiteKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hWhite.png"};
return Knob{b, "Davies1900hWhite.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Davies1900hRedKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hRed.png"};
return Knob{b, "Davies1900hRed.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Davies1900hLargeWhiteKnob>(BaseElement b) {
return Knob{{b}, "Davies1900hLargeWhite.png"};
return Knob{b, "Davies1900hLargeWhite.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan1PSGreen>(BaseElement b) {
return Knob{{b}, "Rogan1PSGreen.png"};
return Knob{b, "Rogan1PSGreen.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan1PSRed>(BaseElement b) {
return Knob{{b}, "Rogan1PSRed.png"};
return Knob{b, "Rogan1PSRed.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan1PSWhite>(BaseElement b) {
return Knob{{b}, "Rogan1PSWhite.png"};
return Knob{b, "Rogan1PSWhite.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan2SGray>(BaseElement b) {
return Knob{{b}, "Rogan2SGray.png"};
return Knob{b, "Rogan2SGray.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan2PSWhite>(BaseElement b) {
return Knob{{b}, "Rogan2PSWhite.png"};
return Knob{b, "Rogan2PSWhite.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan1PRed>(BaseElement b) {
return Knob{{b}, "Rogan1PRed.png"};
return Knob{b, "Rogan1PRed.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan>(BaseElement b) {
return Knob{{b}, "Rogan1PRed.png"};
return Knob{b, "Rogan1PRed.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan2PSRed>(BaseElement b) {
return Knob{{b}, "Rogan2PSRed.png"};
return Knob{b, "Rogan2PSRed.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan2PSGreen>(BaseElement b) {
return Knob{{b}, "Rogan2PSGreen.png"};
return Knob{b, "Rogan2PSGreen.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan3PSWhite>(BaseElement b) {
return Knob{{b}, "Rogan3PSWhite.png"};
return Knob{b, "Rogan3PSWhite.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan3PSRed>(BaseElement b) {
return Knob{{b}, "Rogan3PSRed.png"};
return Knob{b, "Rogan3PSRed.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Rogan3PSGreen>(BaseElement b) {
return Knob{{b}, "Rogan3PSGreen.png"};
return Knob{b, "Rogan3PSGreen.png"};
};

template<>
inline Element make_element<rack::componentlibrary::Trimpot>(BaseElement b) {
return Knob{{b}, "Trimpot.png"};
return Knob{b, "Trimpot.png"};
};

//
// Sliders
//
template<>
inline Element make_element<rack::componentlibrary::BefacoSlidePot>(BaseElement b) {
return Slider{{b}, "BefacoSlidePot.png", "BefacoSlidePotHandle.png"};
return Slider{{b, "BefacoSlidePot.png"}, "BefacoSlidePotHandle.png"};
};

//
Expand All @@ -147,37 +147,37 @@ inline Element make_element<rack::componentlibrary::BefacoSlidePot>(BaseElement
template<>
inline Element
make_element<rack::componentlibrary::VCVLightBezel<rack::componentlibrary::RedGreenBlueLight>>(BaseElement b) {
return RgbLight{{{b}, "VCVBezel.png"}};
return RgbLight{{b, "VCVBezel.png"}};
};

template<>
inline Element make_element<rack::componentlibrary::SmallLight<rack::componentlibrary::RedLight>>(BaseElement b) {
return MonoLight{{{b}, "SmallLight.png"}, 0xF800};
return MonoLight{{b, "SmallLight.png"}, 0xF800};
};

template<>
inline Element make_element<rack::componentlibrary::SmallLight<rack::componentlibrary::GreenLight>>(BaseElement b) {
return MonoLight{{{b}, "SmallLight.png"}, 0x07E0};
return MonoLight{{b, "SmallLight.png"}, 0x07E0};
};

template<>
inline Element make_element<rack::componentlibrary::SmallLight<rack::componentlibrary::GreenRedLight>>(BaseElement b) {
return DualLight{{{b}, "SmallLight.png"}, {0x07E0, 0xF800}};
return DualLight{{b, "SmallLight.png"}, {0x07E0, 0xF800}};
};

template<>
inline Element make_element<rack::componentlibrary::MediumLight<rack::componentlibrary::GreenRedLight>>(BaseElement b) {
return DualLight{{{b}, "MediumLight.png"}, {0x07E0, 0xF800}};
return DualLight{{b, "MediumLight.png"}, {0x07E0, 0xF800}};
};

template<>
inline Element make_element<rack::componentlibrary::MediumLight<rack::componentlibrary::RedLight>>(BaseElement b) {
return MonoLight{{{b}, "MediumLight.png"}, 0xF800};
return MonoLight{{b, "MediumLight.png"}, 0xF800};
};

template<>
inline Element make_element<rack::componentlibrary::MediumLight<rack::componentlibrary::GreenLight>>(BaseElement b) {
return MonoLight{{{b}, "MediumLight.png"}, 0x07E0};
return MonoLight{{b, "MediumLight.png"}, 0x07E0};
};

//
Expand All @@ -188,24 +188,24 @@ inline Element make_element<rack::componentlibrary::MediumLight<rack::componentl

template<>
inline Element make_element_input<rack::componentlibrary::PJ301MPort>(BaseElement b) {
return JackInput{{{b}, "jack_x.png"}};
return JackInput{b, "jack_x.png"};
};

template<>
inline Element make_element_input<rack::componentlibrary::ThemedPJ301MPort>(BaseElement b) {
return JackInput{{{b}, "jack_x.png"}};
return JackInput{b, "jack_x.png"};
};

// Outputs

template<>
inline Element make_element_output<rack::componentlibrary::PJ301MPort>(BaseElement b) {
return JackOutput{{{b}, "jack_x.png"}};
return JackOutput{b, "jack_x.png"};
};

template<>
inline Element make_element_output<rack::componentlibrary::ThemedPJ301MPort>(BaseElement b) {
return JackOutput{{{b}, "jack_x.png"}};
return JackOutput{b, "jack_x.png"};
};

} // namespace MetaModule
4 changes: 2 additions & 2 deletions firmware/src/VCV_adaptor/widget_convert/hetrickcv.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace MetaModule

template<>
inline Element make_element<::CKSSRot>(BaseElement b) {
return MetaModule::SlideSwitch{{b}, 2, "CKSS_rot_bg.png", "CKSS_rot_fg.png"};
return MetaModule::SlideSwitch{{b, "CKSS_rot_bg.png"}, 2, "CKSS_rot_fg.png"};
}

template<>
inline Element make_element<HCVThemedRogan>(BaseElement b) {
return MetaModule::Knob{{b}, "Rogan1PRed.png"};
return MetaModule::Knob{b, "Rogan1PRed.png"};
}

} // namespace MetaModule
Loading

0 comments on commit 65d4743

Please sign in to comment.