|
6 | 6 |
|
7 | 7 | #include <juce_gui_basics/juce_gui_basics.h> |
8 | 8 | #include <juce_audio_processors/juce_audio_processors.h> |
| 9 | +#include <juce_animation/juce_animation.h> |
9 | 10 |
|
10 | 11 | #include "Utility/Config.h" |
11 | 12 | #include "Utility/Fonts.h" |
|
26 | 27 | #include "Canvas.h" |
27 | 28 | #include "Connection.h" |
28 | 29 | #include "Components/ConnectionMessageDisplay.h" |
| 30 | +#include "Components/ConsoleMessageDisplay.h" |
29 | 31 | #include "Dialogs/Dialogs.h" |
30 | 32 | #include "Statusbar.h" |
31 | 33 | #include "Toolbar.h" |
@@ -104,6 +106,7 @@ PluginEditor::PluginEditor(PluginProcessor& p) |
104 | 106 | return true; }) |
105 | 107 | , tabComponent(this) |
106 | 108 | , pluginMode(nullptr) |
| 109 | + , consoleMessageDisplay(std::make_unique<ConsoleMessageDisplay>(this)) |
107 | 110 | , touchSelectionHelper(std::make_unique<TouchSelectionHelper>(this)) |
108 | 111 | , recentlyOpenedPanelSelector(Icons::Home, "Home") |
109 | 112 | , libraryPanelSelector(Icons::ItemGrid, "Library") |
@@ -260,6 +263,9 @@ PluginEditor::PluginEditor(PluginProcessor& p) |
260 | 263 | statusbar->setAlwaysOnTop(true); |
261 | 264 | addAndMakeVisible(statusbar.get()); |
262 | 265 |
|
| 266 | + consoleMessageDisplay->setAlwaysOnTop(true); |
| 267 | + addAndMakeVisible(consoleMessageDisplay.get()); |
| 268 | + |
263 | 269 | audioToolbar = std::make_unique<AudioToolbar>(pd, this); |
264 | 270 | audioToolbar->setAlwaysOnTop(true); |
265 | 271 | addAndMakeVisible(audioToolbar.get()); |
@@ -449,19 +455,27 @@ void PluginEditor::renderArea(NVGcontext* nvg, Rectangle<int> const area) |
449 | 455 | } else { |
450 | 456 | tabComponent.renderArea(nvg, area); |
451 | 457 |
|
| 458 | + if(sidebar->isHidden()) |
| 459 | + sidebar->renderButtonsOnCanvas(nvg); |
| 460 | + |
| 461 | + Graphics g(*getNanoLLGC()); |
452 | 462 | if (touchSelectionHelper && touchSelectionHelper->getParentComponent() && touchSelectionHelper->isVisible() && area.intersects(touchSelectionHelper->getBounds() - nvgSurface.getPosition())) { |
453 | 463 | NVGScopedState scopedState(nvg); |
454 | 464 | nvgTranslate(nvg, touchSelectionHelper->getX() - nvgSurface.getX(), touchSelectionHelper->getY() - nvgSurface.getY()); |
455 | | - touchSelectionHelper->render(nvg); |
| 465 | + touchSelectionHelper->paintEntireComponent(g, false); |
456 | 466 | } |
457 | 467 |
|
458 | | - if(sidebar->isHidden()) |
459 | | - sidebar->renderButtonsOnCanvas(nvg); |
460 | | - |
461 | 468 | { |
462 | 469 | NVGScopedState scopedState(nvg); |
463 | 470 | nvgTranslate(nvg, statusbar->getX() - nvgSurface.getX(), statusbar->getY() - nvgSurface.getY()); |
464 | | - statusbar->render(nvg); |
| 471 | + statusbar->paintEntireComponent(g, false); |
| 472 | + } |
| 473 | + |
| 474 | + if(consoleMessageDisplay->isVisible()) |
| 475 | + { |
| 476 | + NVGScopedState scopedState(nvg); |
| 477 | + nvgTranslate(nvg, consoleMessageDisplay->getX() - nvgSurface.getX(), consoleMessageDisplay->getY() - nvgSurface.getY()); |
| 478 | + consoleMessageDisplay->paintEntireComponent(g, false); |
465 | 479 | } |
466 | 480 | } |
467 | 481 | } |
@@ -590,14 +604,15 @@ void PluginEditor::resized() |
590 | 604 | redoButton.setBounds(2 * buttonDistance + offset, 0, buttonSize, buttonSize); |
591 | 605 | addObjectMenuButton.setBounds(3 * buttonDistance + offset, 0, buttonSize, buttonSize); |
592 | 606 |
|
| 607 | + auto statusbarBounds = getLocalBounds().removeFromBottom(46).translated(0, -12); |
593 | 608 | if (SettingsFile::getInstance()->isUsingTouchMode()) { |
594 | | - auto statusbarBounds = getLocalBounds().removeFromBottom(48).translated(0, -12); |
595 | | - touchSelectionHelper->setBounds(statusbarBounds.withSizeKeepingCentre(192, 48)); |
| 609 | + touchSelectionHelper->setBounds(statusbarBounds.withSizeKeepingCentre(192, 46)); |
596 | 610 | statusbar->setBounds(statusbarBounds.removeFromLeft(208).translated(4, 0)); |
| 611 | + consoleMessageDisplay->setBounds(statusbarBounds.removeFromRight(consoleMessageDisplay->getDesiredWidth() + 2).translated(-8, 0)); |
597 | 612 | } |
598 | 613 | else { |
599 | | - auto statusbarBounds = getLocalBounds().removeFromBottom(48).withSizeKeepingCentre(204, 48).translated(0, -12); |
600 | | - statusbar->setBounds(statusbarBounds); |
| 614 | + statusbar->setBounds(statusbarBounds.withSizeKeepingCentre(204, 46)); |
| 615 | + consoleMessageDisplay->setBounds(statusbarBounds.removeFromRight(consoleMessageDisplay->getDesiredWidth() + 2).translated(-8, 0)); |
601 | 616 | } |
602 | 617 |
|
603 | 618 | #if JUCE_IOS |
@@ -878,6 +893,12 @@ void PluginEditor::installPackage(File const& file) |
878 | 893 | } |
879 | 894 | } |
880 | 895 |
|
| 896 | +void PluginEditor::updateConsole(SmallString const& message, bool messageIsWarning, int numMessages, bool newWarning) |
| 897 | +{ |
| 898 | + sidebar->updateConsole(numMessages, newWarning); |
| 899 | + if(sidebar->isHidden()) |
| 900 | + consoleMessageDisplay->showMessage(message, messageIsWarning); |
| 901 | +} |
881 | 902 |
|
882 | 903 | TabComponent& PluginEditor::getTabComponent() |
883 | 904 | { |
|
0 commit comments