Skip to content

Commit 82145cd

Browse files
committed
Clean up touch popup options, remove unused variables
1 parent b31da37 commit 82145cd

6 files changed

Lines changed: 27 additions & 30 deletions

File tree

Source/Components/TouchSelectionHelper.h

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class TouchSelectionHelper final : public Component
6464
}
6565
}
6666

67-
bool active = object != nullptr && !locked;
68-
67+
bool objectSelectedInEdit = object && !locked;
68+
bool connectionSelectedInEdit = selectedConnections.size() && !locked;
6969

7070

7171
TouchPopupMenu touchMenu;
@@ -74,14 +74,14 @@ class TouchSelectionHelper final : public Component
7474
ApplicationCommandTarget::InvocationInfo info(CommandIDs::Cut);
7575
info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromMenu;
7676
editor->commandManager.invoke(info, true);
77-
}, active);
77+
}, objectSelectedInEdit);
7878

7979
touchMenu.addItem("Copy", [this](){
8080
editor->grabKeyboardFocus();
8181
ApplicationCommandTarget::InvocationInfo info(CommandIDs::Copy);
8282
info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromMenu;
8383
editor->commandManager.invoke(info, true);
84-
}, active);
84+
}, objectSelectedInEdit);
8585

8686
touchMenu.addItem("Paste", [this](){
8787
editor->grabKeyboardFocus();
@@ -95,47 +95,47 @@ class TouchSelectionHelper final : public Component
9595
ApplicationCommandTarget::InvocationInfo info(CommandIDs::Duplicate);
9696
info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromMenu;
9797
editor->commandManager.invoke(info, true);
98-
}, active);
98+
}, objectSelectedInEdit);
9999

100100
touchMenu.addItem("Encapsulate", [this](){
101101
editor->grabKeyboardFocus();
102102
ApplicationCommandTarget::InvocationInfo info(CommandIDs::Encapsulate);
103103
info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromMenu;
104104
editor->commandManager.invoke(info, true);
105-
}, active);
105+
}, objectSelectedInEdit);
106106

107107
touchMenu.addItem("Tidy Connection", [this](){
108108
editor->grabKeyboardFocus();
109109
ApplicationCommandTarget::InvocationInfo info(CommandIDs::ConnectionPathfind);
110110
info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromMenu;
111111
editor->commandManager.invoke(info, true);
112-
}, selectedConnections.size());
112+
}, connectionSelectedInEdit);
113113

114114
TouchPopupMenu alignMenu;
115115
alignMenu.addItem("Align left", [cnv](){
116116
cnv->alignObjects(Align::Left);
117-
}, active);
117+
});
118118
alignMenu.addItem("Align centre", [cnv](){
119119
cnv->alignObjects(Align::HCentre);
120-
}, active);
120+
});
121121
alignMenu.addItem("Align right", [cnv](){
122122
cnv->alignObjects(Align::Right);
123-
}, active);
123+
});
124124
alignMenu.addItem("Space horizonally", [cnv](){
125125
cnv->alignObjects(Align::HDistribute);
126-
}, active);
126+
});
127127
alignMenu.addItem("Align top", [cnv](){
128128
cnv->alignObjects(Align::Top);
129-
}, active);
129+
});
130130
alignMenu.addItem("Align middle", [cnv](){
131131
cnv->alignObjects(Align::VCentre);
132-
}, active);
132+
});
133133
alignMenu.addItem("Align bottom", [cnv](){
134134
cnv->alignObjects(Align::Bottom);
135-
}, active);
135+
});
136136
alignMenu.addItem("Space vertically", [cnv](){
137137
cnv->alignObjects(Align::VDistribute);
138-
}, active);
138+
});
139139

140140
TouchPopupMenu orderMenu;
141141
orderMenu.addItem("To Front", [cnv, selectedObjects]{
@@ -152,7 +152,7 @@ class TouchSelectionHelper final : public Component
152152
}
153153
cnv->patch.endUndoSequence("ToFront");
154154
cnv->synchronise();
155-
}, active);
155+
});
156156
orderMenu.addItem("Move forward", [cnv, selectedObjects]{
157157
auto objects = cnv->patch.getObjects();
158158
cnv->patch.startUndoSequence("MoveForward");
@@ -167,7 +167,7 @@ class TouchSelectionHelper final : public Component
167167
}
168168
cnv->patch.endUndoSequence("MoveForward");
169169
cnv->synchronise();
170-
}, active);
170+
});
171171
orderMenu.addItem("Move backward", [cnv, selectedObjects]{
172172
auto objects = cnv->patch.getObjects();
173173

@@ -183,7 +183,8 @@ class TouchSelectionHelper final : public Component
183183
}
184184
cnv->patch.endUndoSequence("MoveBackward");
185185
cnv->synchronise();
186-
}, active);
186+
});
187+
187188
orderMenu.addItem("To Back", [cnv, selectedObjects]{
188189
auto objects = cnv->patch.getObjects();
189190

@@ -199,10 +200,10 @@ class TouchSelectionHelper final : public Component
199200
}
200201
cnv->patch.endUndoSequence("ToBack");
201202
cnv->synchronise();
202-
}, active);
203+
});
203204

204-
touchMenu.addSubMenu("Align", alignMenu, active);
205-
touchMenu.addSubMenu("Order", orderMenu, active);
205+
touchMenu.addSubMenu("Align", alignMenu, objectSelectedInEdit && multiple);
206+
touchMenu.addSubMenu("Order", orderMenu, objectSelectedInEdit);
206207

207208
touchMenu.addItem("Properties", [this](){
208209
showObjectProperties();

Source/Dialogs/Dialogs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void Dialogs::showMainMenu(PluginEditor* editor, Component* centre)
181181

182182
#if !JUCE_IOS
183183
TouchPopupMenu heavyMenu;
184-
heavyMenu.addItem("Toggle compiled mode", [editor]{
184+
heavyMenu.addItem("Toggle compiled mode", []{
185185
auto settingsTree = SettingsFile::getInstance()->getValueTree();
186186
bool const ticked = settingsTree.hasProperty("hvcc_mode") && static_cast<bool>(settingsTree.getProperty("hvcc_mode"));
187187
settingsTree.setProperty("hvcc_mode", !ticked, nullptr);

Source/Dialogs/ObjectBrowserDialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ class ObjectViewer final : public Component {
427427

428428
auto squareIolets = PlugDataLook::getUseSquareIolets();
429429

430-
auto drawIolet = [this, squareIolets](Graphics& g, Rectangle<float> const bounds, bool const type) mutable {
430+
auto drawIolet = [squareIolets](Graphics& g, Rectangle<float> const bounds, bool const type) mutable {
431431
g.setColour(type ? PlugDataColours::signalColour : PlugDataColours::dataColour);
432432

433433
if (squareIolets) {

Source/Dialogs/ObjectReferenceDialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class ObjectReferenceDialog final : public Component {
300300

301301
auto squareIolets = static_cast<bool>(themeTree.getProperty("square_iolets"));
302302

303-
auto drawIolet = [this, squareIolets](Graphics& g, Rectangle<float> const bounds, bool const type) mutable {
303+
auto drawIolet = [squareIolets](Graphics& g, Rectangle<float> const bounds, bool const type) mutable {
304304
g.setColour(type ? PlugDataColours::signalColour : PlugDataColours::dataColour);
305305

306306
if (squareIolets) {

Source/Dialogs/PatchStore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ class PatchFullDisplay final : public Component
945945

946946
auto const hasSizeInfo = currentPatch.size.isNotEmpty();
947947
int extraInfoItemWidth = getWidth() / (hasSizeInfo ? 3 : 2);
948-
auto drawExtraInfo = [this, extraInfoItemWidth, &extraInfoBounds](Graphics& g, String const& icon, String const& label, String const& value) mutable {
948+
auto drawExtraInfo = [extraInfoItemWidth, &extraInfoBounds](Graphics& g, String const& icon, String const& label, String const& value) mutable {
949949
auto infoBounds = extraInfoBounds.removeFromLeft(extraInfoItemWidth).withSizeKeepingCentre(110, 32).translated(-12, 0);
950950

951951
g.setColour(PlugDataColours::panelTextColour);

Source/Standalone/PlugDataWindow.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,10 @@ class StandalonePluginHolder final : private AudioIODeviceCallback
8282
{
8383

8484
createPlugin();
85-
86-
auto const inChannels = channelConfiguration.size() > 0 ? channelConfiguration[0].numIns : processor->getMainBusNumInputChannels();
87-
85+
8886
if (preferredSetupOptions != nullptr)
8987
options = std::make_unique<AudioDeviceManager::AudioDeviceSetup>(*preferredSetupOptions);
9088

91-
auto const audioInputRequired = inChannels > 0;
92-
9389
MessageManager::callAsync([this, preferredDefaultDeviceName](){
9490
if (RuntimePermissions::isRequired(RuntimePermissions::recordAudio) && !RuntimePermissions::isGranted(RuntimePermissions::recordAudio))
9591
RuntimePermissions::request(RuntimePermissions::recordAudio, [this, preferredDefaultDeviceName](bool const granted) { init(granted, preferredDefaultDeviceName); });

0 commit comments

Comments
 (0)