kopia lustrzana https://github.com/jameshball/osci-render
Add message when the Lua console is empty
rodzic
d38fcaced5
commit
6f73dd8940
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M19 19H5V5H19V19M13 16V8H15V16H13M9 16V8H11V16H9" /></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,16V8H15V16H13M9,16V8H11V16H9M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>
|
Przed Szerokość: | Wysokość: | Rozmiar: 218 B Po Szerokość: | Wysokość: | Rozmiar: 254 B |
|
@ -18,10 +18,13 @@ LuaConsole::LuaConsole() {
|
|||
addAndMakeVisible(console);
|
||||
addAndMakeVisible(clearConsoleButton);
|
||||
addAndMakeVisible(pauseConsoleButton);
|
||||
addAndMakeVisible(emptyConsoleLabel);
|
||||
|
||||
pauseConsoleButton.onClick = [this] {
|
||||
console.setScrollbarThickness(pauseConsoleButton.getToggleState() ? 10 : 0);
|
||||
};
|
||||
|
||||
emptyConsoleLabel.setJustificationType(juce::Justification::centred);
|
||||
}
|
||||
|
||||
LuaConsole::~LuaConsole() {}
|
||||
|
@ -42,6 +45,11 @@ void LuaConsole::clear() {
|
|||
document.clearUndoHistory();
|
||||
consoleLines = 0;
|
||||
buffer.clear();
|
||||
|
||||
juce::MessageManager::callAsync([this] {
|
||||
console.setVisible(false);
|
||||
emptyConsoleLabel.setVisible(true);
|
||||
});
|
||||
}
|
||||
|
||||
void LuaConsole::timerCallback() {
|
||||
|
@ -62,6 +70,11 @@ void LuaConsole::timerCallback() {
|
|||
console.moveCaretToTop(false);
|
||||
console.moveCaretToEnd(false);
|
||||
console.scrollDown();
|
||||
|
||||
if (consoleLines > 0) {
|
||||
console.setVisible(true);
|
||||
emptyConsoleLabel.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,6 +94,7 @@ void LuaConsole::resized() {
|
|||
auto topBar = getLocalBounds().removeFromTop(30);
|
||||
auto area = getLocalBounds().withTrimmedTop(30);
|
||||
console.setBounds(area);
|
||||
emptyConsoleLabel.setBounds(area);
|
||||
|
||||
clearConsoleButton.setBounds(topBar.removeFromRight(30).withSizeKeepingCentre(20, 20));
|
||||
pauseConsoleButton.setBounds(topBar.removeFromRight(30).withSizeKeepingCentre(20, 20));
|
||||
|
|
|
@ -24,6 +24,7 @@ private:
|
|||
std::string buffer;
|
||||
juce::CodeDocument document;
|
||||
juce::CodeEditorComponent console = { document, nullptr };
|
||||
juce::Label emptyConsoleLabel = { "emptyConsoleLabel", "Console is empty" };
|
||||
int consoleLines = 0;
|
||||
|
||||
SvgButton clearConsoleButton { "clearConsole", juce::String(BinaryData::delete_svg), juce::Colours::red };
|
||||
|
|
Ładowanie…
Reference in New Issue