mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: simple pop-up menu to copy diagnostic messages to clipboard
This commit is contained in:
parent
26e0aa735c
commit
b36b64a482
2 changed files with 31 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<int> area) override
|
||||
{
|
||||
getIcon().draw (g, area.toFloat(), isIconCrossedOut());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue