Browse Source

Projucer: simple pop-up menu to copy diagnostic messages to clipboard

tags/2021-05-28
stefan 8 years ago
parent
commit
b36b64a482
2 changed files with 31 additions and 0 deletions
  1. +18
    -0
      extras/Projucer/Source/LiveBuildEngine/projucer_DiagnosticMessage.h
  2. +13
    -0
      extras/Projucer/Source/LiveBuildEngine/projucer_ErrorListComponent.h

+ 18
- 0
extras/Projucer/Source/LiveBuildEngine/projucer_DiagnosticMessage.h View File

@@ -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);


+ 13
- 0
extras/Projucer/Source/LiveBuildEngine/projucer_ErrorListComponent.h View File

@@ -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…
Cancel
Save