MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / mouseUp

Method mouseUp

Source/GUI/ModulatableSlider.cpp:213–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void ModulatableSlider::mouseUp(const juce::MouseEvent& event)
214{
215 if (event.mods.isRightButtonDown() && isModulated && getModulationHandleBounds().contains(event.getPosition().toFloat()))
216 {
217 juce::PopupMenu menu;
218 menu.addItem(1, "Set Value");
219 menu.addItem(2, "Clear LFO");
220 menu.addItem(3, "Invert Depth");
221
222 juce::String bipolarToggleText = isBipolar ? "Switch to Unipolar" : "Switch to Bipolar";
223 menu.addItem(4, bipolarToggleText);
224
225 juce::String bypassToggleText = isBypassed ? "Enable modulation" : "Bypass modulation";
226 menu.addItem(5, bypassToggleText);
227
228 // This is the outer lambda. We create 'safeThis' here.
229 menu.showMenuAsync(juce::PopupMenu::Options().withTargetComponent(this),
230 [safeThis = juce::Component::SafePointer(this)](int result)
231 {
232 if (! safeThis)
233 return;
234
235 switch (result)
236 {
237 case 1: // Set Value
238 {
239 if (safeThis->onSetValueRequested)
240 safeThis->onSetValueRequested(safeThis);
241 break;
242 }
243 case 2: // Clear LFO
244 if (safeThis->onModulationCleared)
245 safeThis->onModulationCleared();
246 break;
247 case 3: // Invert Depth
248 if (safeThis->onModulationInverted)
249 safeThis->onModulationInverted();
250 break;
251 case 4: // Switch Bi/Uni Mode
252 if (safeThis->onBipolarModeToggled)
253 safeThis->onBipolarModeToggled();
254 break;
255 case 5: // Toggle Bypass
256 if (safeThis->onBypassToggled)
257 safeThis->onBypassToggled();
258 break;
259 default:
260 break;
261 }
262 });
263 }
264
265 // Always call the base class mouseUp to ensure proper state cleanup
266 juce::Slider::mouseUp(event);
267
268 // Reset our custom flags regardless of where the mouseUp happened
269 if (isDraggingMainSlider)
270 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected