@@ -31,7 +31,8 @@ class OpenInspector final : public Component {
3131 buttonOpenInspector.setColour (TextButton::buttonOnColourId, backgroundColour.contrasting (0 .1f ));
3232 buttonOpenInspector.setColour (ComboBox::outlineColourId, Colours::transparentBlack);
3333 buttonOpenInspector.setButtonText (" Open inspector" );
34- buttonOpenInspector.setTooltip (" Open inspector for object" );
34+ // TODO: something is probably wrong with the presentation of this popup overall, but the tooltip seems redundant
35+ // buttonOpenInspector.setTooltip("Open inspector for object");
3536
3637 addAndMakeVisible (buttonOpenInspector);
3738
@@ -185,11 +186,9 @@ class SearchPanel final : public Component
185186
186187 auto openInspector = std::make_unique<OpenInspector>();
187188 auto * rawOpenInspectorPtr = openInspector.get ();
188- auto & callOutBox = CallOutBox::launchAsynchronously (std::move (openInspector), bounds, nullptr );
189+ currentCalloutBox = &editor-> showCalloutBox (std::move (openInspector), bounds);
189190
190- SafePointer<CallOutBox> callOutBoxSafePtr (&callOutBox);
191-
192- auto onClick = [this , ptr, callOutBoxSafePtr] {
191+ auto onClick = [this , ptr] {
193192 if (auto obj = editor->highlightSearchTarget (ptr, true )) {
194193 // FIXME: We have to wait until EVERYTHING has setup on the new canvas
195194 // So we call it on message thread, which should place this event after the previous
@@ -201,8 +200,8 @@ class SearchPanel final : public Component
201200 };
202201 MessageManager::callAsync (launchInspector);
203202 }
204- if (callOutBoxSafePtr )
205- callOutBoxSafePtr ->dismiss ();
203+ if (currentCalloutBox )
204+ currentCalloutBox ->dismiss ();
206205 };
207206
208207 rawOpenInspectorPtr->setButtonOnClick (onClick);
@@ -278,15 +277,16 @@ class SearchPanel final : public Component
278277 Fonts::drawIcon (g, Icons::Search, 2 , 1 , 32 , colour, 12 );
279278 }
280279
281- static std::unique_ptr<Component> getExtraSettingsComponent ()
280+ std::unique_ptr<Component> getExtraSettingsComponent ()
282281 {
283282 auto * settingsCalloutButton = new SmallIconButton (Icons::More);
283+ auto * pluginEditor = findParentComponentOfClass<PluginEditor>();
284284 settingsCalloutButton->setTooltip (" Show search settings" );
285285 settingsCalloutButton->setConnectedEdges (12 );
286- settingsCalloutButton->onClick = [settingsCalloutButton] {
286+ settingsCalloutButton->onClick = [settingsCalloutButton, pluginEditor ] {
287287 auto const bounds = settingsCalloutButton->getScreenBounds ();
288288 auto docsSettings = std::make_unique<SearchPanelSettings>();
289- CallOutBox::launchAsynchronously (std::move (docsSettings), bounds, nullptr );
289+ pluginEditor-> showCalloutBox (std::move (docsSettings), bounds);
290290 };
291291
292292 return std::unique_ptr<TextButton>(settingsCalloutButton);
@@ -688,4 +688,6 @@ class SearchPanel final : public Component
688688 PluginEditor* editor;
689689 ValueTreeViewerComponent patchTree = ValueTreeViewerComponent(" (Subpatch)" );
690690 SearchEditor input;
691+ private:
692+ static inline SafePointer<CallOutBox> currentCalloutBox = nullptr ;
691693};
0 commit comments