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

Method resized

Source/Panels/ControlPanel/BandPanel.cpp:266–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void BandPanel::resized()
267{
268 const float scale = this->scale; // Get the scale factor
269 const int scaledKnobSize = static_cast<int>(KNOB_SIZE * scale);
270
271 auto mainArea = getLocalBounds().reduced(10 * scale);
272
273 const float switchColumnProportion = 0.15f;
274 const float knobsColumnProportion = 0.35f;
275 const float graphColumnProportion = 0.3f;
276
277 // Define the four main columns
278 auto layoutArea = mainArea;
279 auto switchColumnArea = layoutArea.removeFromLeft(mainArea.getWidth() * switchColumnProportion);
280 auto knobsColumnArea = layoutArea.removeFromLeft(mainArea.getWidth() * knobsColumnProportion);
281 auto graphColumnArea = layoutArea.removeFromLeft(mainArea.getWidth() * graphColumnProportion);
282 auto outputColumnArea = layoutArea;
283
284 tabAreaRect = switchColumnArea.getUnion(knobsColumnArea);
285 graphAreaRect = graphColumnArea;
286 outputAreaRect = outputColumnArea;
287
288 // --- Column 1: Layout Switches (unchanged) ---
289 juce::FlexBox switchColumnBox;
290 switchColumnBox.flexDirection = juce::FlexBox::Direction::column;
291 switchColumnBox.justifyContent = juce::FlexBox::JustifyContent::spaceAround;
292 switchColumnBox.items.add(juce::FlexItem(oscSwitch).withFlex(1.0f));
293 switchColumnBox.items.add(juce::FlexItem(shapeSwitch).withFlex(1.0f));
294 switchColumnBox.items.add(juce::FlexItem(compressorSwitch).withFlex(1.0f));
295 switchColumnBox.items.add(juce::FlexItem(widthSwitch).withFlex(1.0f));
296 switchColumnBox.performLayout(switchColumnArea);
297
298 auto layoutBypassButton = [&](juce::ToggleButton& bypass, const juce::TextButton& parentSwitch)
299 {
300 auto parentBounds = parentSwitch.getBounds();
301 const int bypassSize = (int) (KNOB_FONT_SIZE * 2.0f * scale);
302
303 bypass.setBounds(parentBounds.getX(),
304 parentBounds.getCentreY() - (bypassSize / 2),
305 bypassSize,
306 bypassSize);
307 bypass.toFront(false);
308 };
309
310 layoutBypassButton(driveBypassButton, oscSwitch);
311 layoutBypassButton(shapeBypassButton, shapeSwitch);
312 layoutBypassButton(compressorBypassButton, compressorSwitch);
313 layoutBypassButton(widthBypassButton, widthSwitch);
314
315 // --- Column 2: Manual Layout for Main Knobs Area ---
316 if (oscSwitch.getToggleState())
317 {
318 // Center the single Drive knob
319 modulatableSliderComponents.at(DRIVE_NAME)->setBounds(knobsColumnArea.withSizeKeepingCentre(scaledKnobSize * 2, scaledKnobSize * 2));
320 }
321 else if (shapeSwitch.getToggleState())
322 {
323 // --- Step 1: Center the main row of three knobs vertically ---

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected