diff --git a/extras/Projucer/Source/LiveBuildEngine/projucer_DiagnosticMessage.h b/extras/Projucer/Source/LiveBuildEngine/projucer_DiagnosticMessage.h index b75b1d5018..e3a74b6e2d 100644 --- a/extras/Projucer/Source/LiveBuildEngine/projucer_DiagnosticMessage.h +++ b/extras/Projucer/Source/LiveBuildEngine/projucer_DiagnosticMessage.h @@ -63,6 +63,24 @@ struct DiagnosticMessage bool isWarning() const noexcept { return type == warning; } bool isNote() const noexcept { return type == note; } + String toString() const + { + // todo: copy recursively from root + String res; + + switch (type) + { + case error: res << "error: "; break; + case warning: res << "warning: "; break; + case note: res << "note: "; break; + }; + + res << range.file << ": "; + res << message << "\n"; + + return res; + } + ValueTree toValueTree() const { ValueTree v (MessageTypes::DIAGNOSTIC); diff --git a/extras/Projucer/Source/LiveBuildEngine/projucer_ErrorListComponent.h b/extras/Projucer/Source/LiveBuildEngine/projucer_ErrorListComponent.h index 543e11ad1f..0555e0de26 100644 --- a/extras/Projucer/Source/LiveBuildEngine/projucer_ErrorListComponent.h +++ b/extras/Projucer/Source/LiveBuildEngine/projucer_ErrorListComponent.h @@ -237,6 +237,19 @@ private: } }; + void showPopupMenu() override + { + PopupMenu menu; + menu.addItem (1, "Copy"); + launchPopupMenu (menu); + } + + void handlePopupMenuResult (int resultCode) override + { + if (resultCode == 1) + SystemClipboard::copyTextToClipboard (message.toString()); + } + void paintIcon (Graphics& g, Rectangle area) override { getIcon().draw (g, area.toFloat(), isIconCrossedOut());