aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasb2m10 <asb2m10@gmail.com>2021-02-20 21:49:46 -0500
committerasb2m10 <asb2m10@gmail.com>2021-02-20 21:49:46 -0500
commit8b2f5ac6ec8c334290b5ef40852a150d6b842080 (patch)
tree7edfd34364d36e6c4a0b34f773c055c264755845
parentb29c31edf5239a36e0eefe7d3d6369d0df719ca8 (diff)
downloaddexed-8b2f5ac6ec8c334290b5ef40852a150d6b842080.tar.gz
Avoid scaling if the window cannot be fully shown. Fix #239
-rw-r--r--Source/PluginEditor.cpp4
-rw-r--r--Source/PluginEditor.h3
-rw-r--r--Source/PluginProcessor.cpp14
3 files changed, 19 insertions, 2 deletions
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
index fab0ba9..c1c73b5 100644
--- a/Source/PluginEditor.cpp
+++ b/Source/PluginEditor.cpp
@@ -36,7 +36,7 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner
midiKeyboard (ownerFilter->keyboardState, MidiKeyboardComponent::horizontalKeyboard),
cartManager(this)
{
- setSize(866, (ownerFilter->showKeyboard ? 674 : 581));
+ setSize(WINDOW_SIZE_X, (ownerFilter->showKeyboard ? WINDOW_SIZE_Y : 581));
processor = ownerFilter;
@@ -212,7 +212,7 @@ void DexedAudioProcessorEditor::parmShow() {
this->processor->savePreference();
this->setScaleFactor(this->processor->dpiScaleFactor);
- this->setSize(866, (processor->showKeyboard ? 674 : 581));
+ this->setSize(WINDOW_SIZE_X, (processor->showKeyboard ? WINDOW_SIZE_Y : 581));
this->midiKeyboard.repaint();
if ( ret == false ) {
diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h
index 7f1aad4..3c72b79 100644
--- a/Source/PluginEditor.h
+++ b/Source/PluginEditor.h
@@ -62,6 +62,9 @@ public:
virtual bool isInterestedInFileDrag (const StringArray &files) override;
virtual void filesDropped (const StringArray &files, int x, int y ) override;
+
+ static const int WINDOW_SIZE_X = 866;
+ static const int WINDOW_SIZE_Y = 674;
};
diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp
index bf40593..7a113b0 100644
--- a/Source/PluginProcessor.cpp
+++ b/Source/PluginProcessor.cpp
@@ -772,6 +772,20 @@ AudioProcessorEditor* DexedAudioProcessor::createEditor() {
dpiScaleFactor = 1.0;
}
}
+
+ const juce::Rectangle rect(DexedAudioProcessorEditor::WINDOW_SIZE_X * dpiScaleFactor,DexedAudioProcessorEditor::WINDOW_SIZE_Y * dpiScaleFactor);
+ bool displayFound = false;
+
+ // validate if there is really a display that can show the complete plugin size
+ for (auto& display : Desktop::getInstance().getDisplays().displays) {
+ if ( display.userArea.getHeight() > rect.getHeight() && display.userArea.getWidth() > rect.getWidth() )
+ displayFound = true;
+ }
+
+ // no display found, scaling to default value
+ if ( ! displayFound )
+ dpiScaleFactor = 1.0;
+
// The scale factor needs to be done after object creation otherwise Bitwig, Live and REAPER can't render the
// plugin window.
editor->setScaleFactor(dpiScaleFactor);
Un proyecto texto-plano.xyz