From abd8fafa698289b4162574ade161d4844f5e2b18 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 9 May 2017 15:44:19 +0100 Subject: [PATCH] Projucer: Fixed some TextButton size issues --- .../ui/jucer_ResourceEditorPanel.cpp | 16 ++++++++------ .../Source/Project/jucer_ModulesPanel.h | 22 ++++++++++++++----- .../Utility/jucer_ProjucerLookAndFeel.cpp | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.cpp b/extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.cpp index 84a3f7a7f7..6ae64eca2e 100644 --- a/extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.cpp +++ b/extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.cpp @@ -229,16 +229,18 @@ void ResourceEditorPanel::selectedRowsChanged (int /*lastRowSelected*/) void ResourceEditorPanel::resized() { - listBox->setBounds (6, 4, getWidth() - 12, getHeight() - 38); + auto bounds = getLocalBounds(); - addButton.changeWidthToFitText (22); - addButton.setTopLeftPosition (8, getHeight() - 30); + auto buttonSlice = bounds.removeFromBottom (40).reduced (5, 5); - reloadAllButton.changeWidthToFitText (22); - reloadAllButton.setTopLeftPosition (addButton.getRight() + 10, getHeight() - 30); + addButton.setBounds (buttonSlice.removeFromLeft (125)); + buttonSlice.removeFromLeft (10); - delButton.changeWidthToFitText (22); - delButton.setTopRightPosition (getWidth() - 8, getHeight() - 30); + reloadAllButton.setBounds (buttonSlice.removeFromLeft (125)); + + delButton.setBounds (buttonSlice.removeFromRight (125)); + + listBox->setBounds (bounds); } void ResourceEditorPanel::paint (Graphics& g) diff --git a/extras/Projucer/Source/Project/jucer_ModulesPanel.h b/extras/Projucer/Source/Project/jucer_ModulesPanel.h index 6c57ff909c..066e2e224d 100644 --- a/extras/Projucer/Source/Project/jucer_ModulesPanel.h +++ b/extras/Projucer/Source/Project/jucer_ModulesPanel.h @@ -75,15 +75,27 @@ public: bounds.reduce (10, 0); list.setBounds (bounds.removeFromTop (list.getRowPosition (getNumRows() - 1, true).getBottom() + 20)); - auto buttonRow = bounds.removeFromTop (35); - setCopyModeButton.setBounds (buttonRow.removeFromLeft (jmin (200, bounds.getWidth() / 3))); - buttonRow.removeFromLeft (8); - copyPathButton.setBounds (buttonRow.removeFromLeft (jmin (200, bounds.getWidth() / 3))); + if (bounds.getHeight() < 35) + { + parentSizeChanged(); + } + else + { + auto buttonRow = bounds.removeFromTop (35); + setCopyModeButton.setBounds (buttonRow.removeFromLeft (jmin (200, bounds.getWidth() / 3))); + buttonRow.removeFromLeft (8); + copyPathButton.setBounds (buttonRow.removeFromLeft (jmin (200, bounds.getWidth() / 3))); + } } void parentSizeChanged() override { - setSize (jmax (550, getParentWidth()), getParentHeight()); + const auto width = jmax (550, getParentWidth()); + auto y = list.getRowPosition (getNumRows() - 1, true).getBottom() + 100; + + y = jmax (getParentHeight(), y); + + setSize (width, y); } int getNumRows() override diff --git a/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp b/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp index ac4354af3b..0181820d08 100644 --- a/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp +++ b/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp @@ -143,7 +143,7 @@ void ProjucerLookAndFeel::drawButtonText (Graphics& g, TextButton& button, bool .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f)); - auto xIndent = jmin (12, button.getWidth() / 10); + auto xIndent = jmin (8, button.getWidth() / 10); auto yIndent = jmin (3, button.getHeight() / 6); auto textBounds = button.getLocalBounds().reduced (xIndent, yIndent);