Skip to content

Commit a7804eb

Browse files
committed
Apply formatting
1 parent e518b69 commit a7804eb

File tree

106 files changed

+1420
-1524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1420
-1524
lines changed

Source/Canvas.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ Canvas::Canvas(PluginEditor* parent, pd::Patch::Ptr p, Component* parentGraph)
332332
addAndMakeVisible(*graphArea);
333333
graphArea->setAlwaysOnTop(true);
334334
}
335-
336-
if(!isGraph) {
335+
336+
if (!isGraph) {
337337
editor->nvgSurface.addBufferedObject(this);
338338
}
339339

@@ -384,8 +384,8 @@ Canvas::Canvas(PluginEditor* parent, pd::Patch::Ptr p, Component* parentGraph)
384384
repaint();
385385
};
386386

387-
parameters.addParamInt("Width", cDimensions, &patchWidth, 527, true, 0, 1<<30, onInteractionFn);
388-
parameters.addParamInt("Height", cDimensions, &patchHeight, 327, true, 0, 1<<30, onInteractionFn);
387+
parameters.addParamInt("Width", cDimensions, &patchWidth, 527, true, 0, 1 << 30, onInteractionFn);
388+
parameters.addParamInt("Height", cDimensions, &patchHeight, 327, true, 0, 1 << 30, onInteractionFn);
389389

390390
if (!isGraph) {
391391
patch.setVisible(true);
@@ -399,8 +399,8 @@ Canvas::~Canvas()
399399
for (auto* object : objects) {
400400
object->hideEditor();
401401
}
402-
403-
if(!isGraph) {
402+
403+
if (!isGraph) {
404404
editor->nvgSurface.removeBufferedObject(this);
405405
}
406406

@@ -485,7 +485,7 @@ void Canvas::lookAndFeelChanged()
485485
sigColBrighter = convertColour(sigColJuce.brighter());
486486
gemColBrigher = convertColour(gemColJuce.brighter());
487487
baseColBrigher = convertColour(baseColJuce.brighter());
488-
488+
489489
dotsLargeImage.setDirty(); // Make sure bg colour actually gets updated
490490
}
491491

@@ -609,13 +609,11 @@ void Canvas::performRender(NVGcontext* nvg, Rectangle<int> invalidRegion)
609609
nvgScale(nvg, zoom, zoom);
610610
invalidRegion = invalidRegion.translated(viewport->getViewPositionX(), viewport->getViewPositionY());
611611
invalidRegion /= zoom;
612-
613-
if(isLocked)
614-
{
612+
613+
if (isLocked) {
615614
nvgFillColor(nvg, canvasBackgroundCol);
616615
nvgFillRect(nvg, invalidRegion.getX(), invalidRegion.getY(), invalidRegion.getWidth(), invalidRegion.getHeight());
617-
}
618-
else {
616+
} else {
619617
nvgBeginPath(nvg);
620618
nvgRect(nvg, 0, 0, infiniteCanvasSize, infiniteCanvasSize);
621619

@@ -634,7 +632,7 @@ void Canvas::performRender(NVGcontext* nvg, Rectangle<int> invalidRegion)
634632
}
635633
}
636634
}
637-
635+
638636
currentRenderArea = invalidRegion;
639637

640638
auto drawBorder = [this, nvg, zoom](bool const bg, bool const fg) {
@@ -893,7 +891,8 @@ void Canvas::settingsChanged(String const& name, var const& value)
893891
updateOverlays();
894892
break;
895893
}
896-
default: break;
894+
default:
895+
break;
897896
}
898897
}
899898

@@ -1261,11 +1260,11 @@ void Canvas::updateDrawables()
12611260
void Canvas::shiftKeyChanged(bool const isHeld)
12621261
{
12631262
shiftDown = isHeld;
1264-
1263+
12651264
if (!isGraph) {
12661265
SettingsFile::getInstance()->getValueTree().getChildWithName("Overlays").setProperty("alt_mode", altDown && shiftDown, nullptr);
12671266
}
1268-
1267+
12691268
if (!isHeld)
12701269
return;
12711270

@@ -1311,7 +1310,7 @@ void Canvas::shiftKeyChanged(bool const isHeld)
13111310
pd::Interface::shiftAutopatch(x.get(), inObj, inletIndex, outObj, outletIndex, selectedObjects, connection);
13121311
}
13131312
}
1314-
1313+
13151314
synchronise();
13161315
}
13171316
}
@@ -1329,7 +1328,7 @@ void Canvas::middleMouseChanged(bool isHeld)
13291328
void Canvas::altKeyChanged(bool const isHeld)
13301329
{
13311330
altDown = isHeld;
1332-
1331+
13331332
if (!isGraph) {
13341333
SettingsFile::getInstance()->getValueTree().getChildWithName("Overlays").setProperty("alt_mode", altDown && shiftDown, nullptr);
13351334
}
@@ -2682,7 +2681,7 @@ void Canvas::findLassoItemsInArea(Array<WeakReference<Component>>& itemsFound, R
26822681
{
26832682
auto const lassoBounds = area.withWidth(jmax(2, area.getWidth())).withHeight(jmax(2, area.getHeight()));
26842683

2685-
if(!altDown) { // Alt enable connection only mode
2684+
if (!altDown) { // Alt enable connection only mode
26862685
for (auto* object : objects) {
26872686
if (lassoBounds.intersects(object->getSelectableBounds())) {
26882687
itemsFound.add(object);
@@ -2801,7 +2800,8 @@ void Canvas::receiveMessage(t_symbol* symbol, SmallArray<pd::Atom> const& atoms)
28012800
synchroniseSplitCanvas();
28022801
break;
28032802
}
2804-
default: break;
2803+
default:
2804+
break;
28052805
}
28062806
}
28072807

Source/Canvas.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ class Canvas final : public Component
234234
bool needsSearchUpdate : 1 = false;
235235
bool altDown : 1 = false;
236236
bool shiftDown : 1 = false;
237-
237+
238238
Rectangle<int> currentRenderArea;
239-
239+
240240
Value isGraphChild = SynchronousValue(var(false));
241241
Value hideNameAndArgs = SynchronousValue(var(false));
242242
Value xRange = SynchronousValue();

Source/CanvasViewport.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ class CanvasViewport final : public Viewport
488488
addAndMakeVisible(vbar);
489489
addAndMakeVisible(hbar);
490490

491-
setCachedComponentImage(new NVGSurface::InvalidationListener(editor->nvgSurface, this, [this]{
491+
setCachedComponentImage(new NVGSurface::InvalidationListener(editor->nvgSurface, this, [this] {
492492
return editor->getTabComponent().getVisibleCanvases().contains(this->cnv);
493493
}));
494494

@@ -547,7 +547,8 @@ class CanvasViewport final : public Viewport
547547
lerpAnimation += animationSpeed;
548548
break;
549549
}
550-
default: break;
550+
default:
551+
break;
551552
}
552553
}
553554

@@ -685,7 +686,7 @@ class CanvasViewport final : public Viewport
685686
{
686687
if (editor->isInPluginMode())
687688
return;
688-
689+
689690
Viewport::componentMovedOrResized(c, moved, resized);
690691
adjustScrollbarBounds();
691692
}
@@ -700,7 +701,7 @@ class CanvasViewport final : public Viewport
700701
onScroll();
701702
adjustScrollbarBounds();
702703
minimap.updateMinimap(r);
703-
704+
704705
cnv->getParentComponent()->setSize(getWidth(), getHeight());
705706
}
706707

@@ -738,10 +739,10 @@ class CanvasViewport final : public Viewport
738739

739740
auto const offset = currentCentre - newCentre;
740741
setViewPosition(getViewPosition() + offset);
741-
742+
742743
// This fixes some graphical glitches on macOS, but causes terrible glitches anywhere else
743744
#if JUCE_MAC
744-
if(!scaleChanged) {
745+
if (!scaleChanged) {
745746
editor->nvgSurface.renderAll();
746747
}
747748
#endif
@@ -773,5 +774,5 @@ class CanvasViewport final : public Viewport
773774
MousePanner panner = MousePanner(this);
774775
ViewportScrollBar vbar = ViewportScrollBar(true, this);
775776
ViewportScrollBar hbar = ViewportScrollBar(false, this);
776-
bool scaleChanged:1 = false;
777+
bool scaleChanged : 1 = false;
777778
};

Source/Components/Buttons.cpp

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,23 @@ String MainToolbarButton::getTooltip()
2929
return setTooltip;
3030
}
3131

32-
3332
void MainToolbarButton::paint(Graphics& g)
3433
{
3534
bool const active = isOver() || isDown() || getToggleState();
36-
35+
3736
auto constexpr cornerSize = Corners::defaultCornerRadius;
3837
auto const backgroundColour = active ? findColour(PlugDataColour::toolbarHoverColourId) : Colours::transparentBlack;
3938
auto bounds = getLocalBounds().reduced(3, 4).toFloat();
40-
39+
4140
g.setColour(backgroundColour);
4241
g.fillRoundedRectangle(bounds, cornerSize);
43-
42+
4443
auto const textColour = findColour(PlugDataColour::toolbarTextColourId).withMultipliedAlpha(isEnabled() ? 1.0f : 0.5f);
45-
44+
4645
#if JUCE_MAC
4746
bounds = bounds.withTrimmedBottom(2);
4847
#endif
49-
48+
5049
g.setFont(Fonts::getIconFont().withHeight(getHeight() / 2.7));
5150
g.setColour(textColour);
5251
g.drawText(getButtonText(), bounds, Justification::centred);
@@ -88,28 +87,28 @@ void ToolbarRadioButton::paint(Graphics& g)
8887
{
8988
bool const mouseOver = isOver();
9089
bool const active = mouseOver || isDown() || getToggleState();
91-
90+
9291
auto const flatOnLeft = isConnectedOnLeft();
9392
auto const flatOnRight = isConnectedOnRight();
9493
auto const flatOnTop = isConnectedOnTop();
9594
auto const flatOnBottom = isConnectedOnBottom();
96-
95+
9796
auto const backgroundColour = findColour(active ? PlugDataColour::toolbarHoverColourId : PlugDataColour::toolbarBackgroundColourId).contrasting(mouseOver && !getToggleState() ? 0.0f : 0.035f);
98-
97+
9998
auto bounds = getLocalBounds().toFloat();
10099
bounds = bounds.reduced(0.0f, bounds.proportionOfHeight(0.17f));
101-
100+
102101
g.setColour(backgroundColour);
103102
Path p;
104103
p.addRoundedRectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), Corners::defaultCornerRadius, Corners::defaultCornerRadius,
105-
!(flatOnLeft || flatOnTop),
106-
!(flatOnRight || flatOnTop),
107-
!(flatOnLeft || flatOnBottom),
108-
!(flatOnRight || flatOnBottom));
104+
!(flatOnLeft || flatOnTop),
105+
!(flatOnRight || flatOnTop),
106+
!(flatOnLeft || flatOnBottom),
107+
!(flatOnRight || flatOnBottom));
109108
g.fillPath(p);
110-
109+
111110
auto const textColour = findColour(PlugDataColour::toolbarTextColourId).withMultipliedAlpha(isEnabled() ? 1.0f : 0.5f);
112-
111+
113112
g.setFont(Fonts::getIconFont().withHeight(getHeight() / 2.8));
114113
g.setColour(textColour);
115114
g.drawText(getButtonText(), getLocalBounds(), Justification::centred);
@@ -138,13 +137,11 @@ void ToolbarRadioButton::mouseExit(MouseEvent const& e)
138137
}
139138
#endif
140139

141-
142-
143140
bool SmallIconButton::hitTest(int const x, int const y)
144141
{
145142
if (getLocalBounds().reduced(2).contains(x, y))
146143
return true;
147-
144+
148145
return false;
149146
}
150147

@@ -161,22 +158,23 @@ void SmallIconButton::mouseExit(MouseEvent const& e)
161158
void SmallIconButton::paint(Graphics& g)
162159
{
163160
auto colour = findColour(PlugDataColour::toolbarTextColourId);
164-
161+
165162
if (!isEnabled()) {
166163
colour = Colours::grey;
167164
} else if (getToggleState()) {
168165
colour = findColour(PlugDataColour::toolbarActiveColourId);
169166
} else if (isMouseOver()) {
170167
colour = findColour(PlugDataColour::toolbarTextColourId).brighter(0.8f);
171168
}
172-
169+
173170
Fonts::drawIcon(g, getButtonText(), getLocalBounds(), colour, 12);
174171
}
175172

176-
177173
WidePanelButton::WidePanelButton(String const& icon, int const iconSize)
178-
: icon(icon)
179-
, iconSize(iconSize) { }
174+
: icon(icon)
175+
, iconSize(iconSize)
176+
{
177+
}
180178

181179
void WidePanelButton::mouseEnter(MouseEvent const& e)
182180
{
@@ -194,31 +192,31 @@ void WidePanelButton::paint(Graphics& g)
194192
bool const flatOnRight = isConnectedOnRight();
195193
bool const flatOnTop = isConnectedOnTop();
196194
bool const flatOnBottom = isConnectedOnBottom();
197-
195+
198196
float const width = getWidth() - 1.0f;
199197
float const height = getHeight() - 1.0f;
200-
198+
201199
constexpr float cornerSize = Corners::largeCornerRadius;
202200
Path outline;
203201
outline.addRoundedRectangle(0.5f, 0.5f, width, height, cornerSize, cornerSize,
204-
!(flatOnLeft || flatOnTop),
205-
!(flatOnRight || flatOnTop),
206-
!(flatOnLeft || flatOnBottom),
207-
!(flatOnRight || flatOnBottom));
208-
202+
!(flatOnLeft || flatOnTop),
203+
!(flatOnRight || flatOnTop),
204+
!(flatOnLeft || flatOnBottom),
205+
!(flatOnRight || flatOnBottom));
206+
209207
g.setColour(findColour(isMouseOver() ? PlugDataColour::panelActiveBackgroundColourId : PlugDataColour::panelForegroundColourId));
210208
g.fillPath(outline);
211-
209+
212210
g.setColour(findColour(PlugDataColour::outlineColourId));
213211
g.strokePath(outline, PathStrokeType(1));
214-
212+
215213
Fonts::drawText(g, getButtonText(), getLocalBounds().reduced(12, 2), findColour(PlugDataColour::panelTextColourId), 15);
216214
Fonts::drawIcon(g, icon, getLocalBounds().reduced(12, 2).removeFromRight(24), findColour(PlugDataColour::panelTextColourId), iconSize);
217215
}
218216

219217
SettingsToolbarButton::SettingsToolbarButton(String iconToUse, String textToShow)
220-
: icon(std::move(iconToUse))
221-
, text(std::move(textToShow))
218+
: icon(std::move(iconToUse))
219+
, text(std::move(textToShow))
222220
{
223221
setClickingTogglesState(true);
224222
setConnectedEdges(12);
@@ -227,30 +225,29 @@ SettingsToolbarButton::SettingsToolbarButton(String iconToUse, String textToShow
227225
void SettingsToolbarButton::paint(Graphics& g)
228226
{
229227
auto const b = getLocalBounds().reduced(2.0f, 4.0f);
230-
228+
231229
if (isMouseOver() || getToggleState()) {
232230
auto background = findColour(PlugDataColour::toolbarHoverColourId);
233231
if (getToggleState())
234232
background = background.darker(0.025f);
235-
233+
236234
g.setColour(background);
237235
g.fillRoundedRectangle(b.toFloat(), Corners::defaultCornerRadius);
238236
}
239-
237+
240238
auto const textColour = findColour(PlugDataColour::toolbarTextColourId);
241239
auto const boldFont = Fonts::getBoldFont().withHeight(13.5f);
242240
auto const iconFont = Fonts::getIconFont().withHeight(13.5f);
243-
241+
244242
AttributedString attrStr;
245243
attrStr.setJustification(Justification::centred);
246244
attrStr.append(icon, iconFont, textColour);
247245
attrStr.append(" " + text, boldFont, textColour);
248246
attrStr.draw(g, b.toFloat());
249247
}
250248

251-
252249
ReorderButton::ReorderButton()
253-
: SmallIconButton(Icons::Reorder)
250+
: SmallIconButton(Icons::Reorder)
254251
{
255252
setSize(25, 25);
256253
}

0 commit comments

Comments
 (0)