@@ -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 ();
0 commit comments