Browse Source

Projucer: Selected colour scheme is now stored and recalled. Multiple fixes for unreadable text in the GUI editor

tags/2021-05-28
ed 8 years ago
parent
commit
cf0e97fcc7
13 changed files with 151 additions and 69 deletions
  1. +43
    -26
      extras/Projucer/Source/Application/jucer_Application.cpp
  2. +2
    -0
      extras/Projucer/Source/Application/jucer_Application.h
  3. +9
    -1
      extras/Projucer/Source/Application/jucer_AutoUpdater.cpp
  4. +43
    -21
      extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp
  5. +5
    -0
      extras/Projucer/Source/Application/jucer_GlobalPreferences.h
  6. +9
    -10
      extras/Projucer/Source/ComponentEditor/properties/jucer_PositionPropertyBase.h
  7. +7
    -1
      extras/Projucer/Source/ComponentEditor/ui/jucer_JucerDocumentEditor.cpp
  8. +14
    -3
      extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.cpp
  9. +2
    -0
      extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.h
  10. +4
    -2
      extras/Projucer/Source/Project Saving/jucer_TextWithDefaultPropertyComponent.h
  11. +10
    -4
      extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.cpp
  12. +2
    -0
      extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.h
  13. +1
    -1
      extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp

+ 43
- 26
extras/Projucer/Source/Application/jucer_Application.cpp View File

@@ -117,6 +117,8 @@ void ProjucerApplication::initialise (const String& commandLine)
settings->appearance.refreshPresetSchemeList(); settings->appearance.refreshPresetSchemeList();
setColourScheme (settings->getGlobalProperties().getIntValue ("COLOUR SCHEME"), false);
// do further initialisation in a moment when the message loop has started // do further initialisation in a moment when the message loop has started
triggerAsyncUpdate(); triggerAsyncUpdate();
} }
@@ -499,32 +501,7 @@ void ProjucerApplication::handleMainMenuCommand (int menuItemID)
} }
else if (menuItemID >= colourSchemeBaseID && menuItemID < colourSchemeBaseID + 3) else if (menuItemID >= colourSchemeBaseID && menuItemID < colourSchemeBaseID + 3)
{ {
auto& appearanceSettings = getAppSettings().appearance;
if (menuItemID == colourSchemeBaseID)
{
lookAndFeel.setColourScheme (LookAndFeel_V4::getDarkColourScheme());
appearanceSettings.selectPresetScheme (0);
}
else if (menuItemID == colourSchemeBaseID + 1)
{
lookAndFeel.setColourScheme (LookAndFeel_V4::getGreyColourScheme());
appearanceSettings.selectPresetScheme (0);
}
else if (menuItemID == colourSchemeBaseID + 2)
{
lookAndFeel.setColourScheme (LookAndFeel_V4::getLightColourScheme());
appearanceSettings.selectPresetScheme (1);
}
lookAndFeel.setupColours();
mainWindowList.sendLookAndFeelChange();
if (utf8Window != nullptr) utf8Window->sendLookAndFeelChange();
if (svgPathWindow != nullptr) svgPathWindow->sendLookAndFeelChange();
if (globalPreferencesWindow != nullptr) globalPreferencesWindow->sendLookAndFeelChange();
if (aboutWindow != nullptr) aboutWindow->sendLookAndFeelChange();
if (applicationUsageDataWindow != nullptr) applicationUsageDataWindow->sendLookAndFeelChange();
setColourScheme (menuItemID - colourSchemeBaseID, true);
} }
else else
{ {
@@ -801,3 +778,43 @@ void ProjucerApplication::initCommandManager()
registerGUIEditorCommands(); registerGUIEditorCommands();
} }
void ProjucerApplication::setColourScheme (int index, bool saveSetting)
{
auto& appearanceSettings = getAppSettings().appearance;
if (index == 0)
{
lookAndFeel.setColourScheme (LookAndFeel_V4::getDarkColourScheme());
appearanceSettings.selectPresetScheme (0);
}
else if (index == 1)
{
lookAndFeel.setColourScheme (LookAndFeel_V4::getGreyColourScheme());
appearanceSettings.selectPresetScheme (0);
}
else if (index == 2)
{
lookAndFeel.setColourScheme (LookAndFeel_V4::getLightColourScheme());
appearanceSettings.selectPresetScheme (1);
}
lookAndFeel.setupColours();
mainWindowList.sendLookAndFeelChange();
if (utf8Window != nullptr) utf8Window->sendLookAndFeelChange();
if (svgPathWindow != nullptr) svgPathWindow->sendLookAndFeelChange();
if (globalPreferencesWindow != nullptr) globalPreferencesWindow->sendLookAndFeelChange();
if (aboutWindow != nullptr) aboutWindow->sendLookAndFeelChange();
if (applicationUsageDataWindow != nullptr) applicationUsageDataWindow->sendLookAndFeelChange();
auto* mcm = ModalComponentManager::getInstance();
for (auto i = 0; i < mcm->getNumModalComponents(); ++i)
mcm->getModalComponent (i)->sendLookAndFeelChange();
if (saveSetting)
{
auto& properties = settings->getGlobalProperties();
properties.setValue ("COLOUR SCHEME", index);
}
}

+ 2
- 0
extras/Projucer/Source/Application/jucer_Application.h View File

@@ -148,4 +148,6 @@ private:
void handleAsyncUpdate() override; void handleAsyncUpdate() override;
void initCommandManager(); void initCommandManager();
void setColourScheme (int index, bool saveSetting);
}; };

+ 9
- 1
extras/Projucer/Source/Application/jucer_AutoUpdater.cpp View File

@@ -264,7 +264,6 @@ public:
addAndMakeVisible (cancelButton = new TextButton ("Cancel Button")); addAndMakeVisible (cancelButton = new TextButton ("Cancel Button"));
cancelButton->setButtonText (TRANS("Cancel")); cancelButton->setButtonText (TRANS("Cancel"));
cancelButton->addListener (this); cancelButton->addListener (this);
cancelButton->setColour (TextButton::buttonColourId, findColour (secondaryButtonBackgroundColourId));
addAndMakeVisible (changeLogLabel = new Label ("Change Log Label", addAndMakeVisible (changeLogLabel = new Label ("Change Log Label",
TRANS("Release Notes:"))); TRANS("Release Notes:")));
@@ -303,6 +302,8 @@ public:
BinaryData::juce_icon_pngSize); BinaryData::juce_icon_pngSize);
setSize (518, overwritePath ? 345 : 269); setSize (518, overwritePath ? 345 : 269);
lookAndFeelChanged();
} }
~UpdateUserDialog() ~UpdateUserDialog()
@@ -394,6 +395,13 @@ private:
ScopedPointer<TextButton> overwriteButton; ScopedPointer<TextButton> overwriteButton;
ScopedPointer<Drawable> juceIcon; ScopedPointer<Drawable> juceIcon;
void lookAndFeelChanged() override
{
cancelButton->setColour (TextButton::buttonColourId,
findColour (secondaryButtonBackgroundColourId));
changeLog->applyFontToAllText (changeLog->getFont());
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UpdateUserDialog) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UpdateUserDialog)
}; };


+ 43
- 21
extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp View File

@@ -34,7 +34,7 @@ PathSettingsTab::PathSettingsTab (DependencyPathOS os)
{ {
const int maxChars = 1024; const int maxChars = 1024;
StoredSettings& settings = getAppSettings();
auto& settings = getAppSettings();
vst3PathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::vst3Path, os), "VST3 SDK", maxChars, false)); vst3PathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::vst3Path, os), "VST3 SDK", maxChars, false));
@@ -46,11 +46,11 @@ PathSettingsTab::PathSettingsTab (DependencyPathOS os)
androidSdkPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::androidSDKPath, os), "Android SDK", maxChars, false)); androidSdkPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::androidSDKPath, os), "Android SDK", maxChars, false));
androidNdkPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::androidNDKPath, os), "Android NDK", maxChars, false)); androidNdkPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::androidNDKPath, os), "Android NDK", maxChars, false));
for (TextPropertyComponent** component = pathComponents.begin(); component != pathComponents.end(); ++component)
for (auto component : pathComponents)
{ {
addAndMakeVisible (**component);
(*component)->addListener (this);
textPropertyComponentChanged (*component);
addAndMakeVisible (component);
component->addListener (this);
textPropertyComponentChanged (component);
} }
} }
@@ -60,9 +60,9 @@ PathSettingsTab::~PathSettingsTab()
void PathSettingsTab::textPropertyComponentChanged (TextPropertyComponent* textPropertyComponent) void PathSettingsTab::textPropertyComponentChanged (TextPropertyComponent* textPropertyComponent)
{ {
Identifier keyName = getKeyForPropertyComponent (textPropertyComponent);
auto keyName = getKeyForPropertyComponent (textPropertyComponent);
Colour textColour = getAppSettings().isGlobalPathValid (File::getCurrentWorkingDirectory(), keyName, textPropertyComponent->getText())
auto textColour = getAppSettings().isGlobalPathValid (File::getCurrentWorkingDirectory(), keyName, textPropertyComponent->getText())
? findColour (widgetTextColourId) ? findColour (widgetTextColourId)
: Colours::red; : Colours::red;
@@ -96,13 +96,18 @@ void PathSettingsTab::resized()
{ {
const int componentHeight = 25; const int componentHeight = 25;
for (TextPropertyComponent** component = pathComponents.begin(); component != pathComponents.end(); ++component)
for (auto component : pathComponents)
{ {
const int elementNumber = pathComponents.indexOf (*component);
(*component)->setBounds (0, componentHeight * elementNumber, getWidth(), componentHeight);
const auto elementNumber = pathComponents.indexOf (component);
component->setBounds (10, componentHeight * elementNumber, getWidth() - 20, componentHeight);
} }
} }
void PathSettingsTab::lookAndFeelChanged()
{
for (auto* comp : pathComponents)
textPropertyComponentChanged (comp);
}
//============================================================================== //==============================================================================
struct AppearanceEditor struct AppearanceEditor
@@ -124,7 +129,7 @@ struct AppearanceEditor
g.setColour (findColour (defaultTextColourId)); g.setColour (findColour (defaultTextColourId));
g.drawFittedText ("Scanning for fonts..", getLocalBounds(), Justification::centred, 2); g.drawFittedText ("Scanning for fonts..", getLocalBounds(), Justification::centred, 2);
const int size = 30;
const auto size = 30;
getLookAndFeel().drawSpinningWaitAnimation (g, Colours::white, (getWidth() - size) / 2, getHeight() / 2 - 50, size, size); getLookAndFeel().drawSpinningWaitAnimation (g, Colours::white, (getWidth() - size) / 2, getHeight() / 2 - 50, size, size);
} }
@@ -136,7 +141,7 @@ struct AppearanceEditor
{ {
getAppSettings().monospacedFontNames = fontsFound; getAppSettings().monospacedFontNames = fontsFound;
if (AppearanceSettingsTab* tab = findParentComponentOfClass<AppearanceSettingsTab>())
if (auto* tab = findParentComponentOfClass<AppearanceSettingsTab>())
tab->changeContent (new EditorPanel()); tab->changeContent (new EditorPanel());
} }
else else
@@ -154,7 +159,7 @@ struct AppearanceEditor
{ {
const Font font (name, 20.0f, Font::plain); const Font font (name, 20.0f, Font::plain);
const int width = font.getStringWidth ("....");
const auto width = font.getStringWidth ("....");
return width == font.getStringWidth ("WWWW") return width == font.getStringWidth ("WWWW")
&& width == font.getStringWidth ("0000") && width == font.getStringWidth ("0000")
@@ -185,14 +190,14 @@ struct AppearanceEditor
void rebuildProperties() void rebuildProperties()
{ {
AppearanceSettings& scheme = getAppSettings().appearance;
auto& scheme = getAppSettings().appearance;
Array<PropertyComponent*> props; Array<PropertyComponent*> props;
Value fontValue (scheme.getCodeFontValue());
auto fontValue = scheme.getCodeFontValue();
props.add (FontNameValueSource::createProperty ("Code Editor Font", fontValue)); props.add (FontNameValueSource::createProperty ("Code Editor Font", fontValue));
props.add (FontSizeValueSource::createProperty ("Font Size", fontValue)); props.add (FontSizeValueSource::createProperty ("Font Size", fontValue));
const StringArray colourNames (scheme.getColourNames());
const auto colourNames = scheme.getColourNames();
for (int i = 0; i < colourNames.size(); ++i) for (int i = 0; i < colourNames.size(); ++i)
props.add (new ColourPropertyComponent (nullptr, colourNames[i], props.add (new ColourPropertyComponent (nullptr, colourNames[i],
@@ -205,8 +210,8 @@ struct AppearanceEditor
void resized() override void resized() override
{ {
Rectangle<int> r (getLocalBounds());
panel.setBounds (r.removeFromTop (getHeight() - 28).reduced (4, 2));
auto r = getLocalBounds();
panel.setBounds (r.removeFromTop (getHeight() - 28).reduced (10, 2));
loadButton.setBounds (r.removeFromLeft (getWidth() / 2).reduced (10, 4)); loadButton.setBounds (r.removeFromLeft (getWidth() / 2).reduced (10, 4));
saveButton.setBounds (r.reduced (10, 3)); saveButton.setBounds (r.reduced (10, 3));
} }
@@ -249,6 +254,12 @@ struct AppearanceEditor
rebuildProperties(); rebuildProperties();
} }
void lookAndFeelChanged() override
{
loadButton.setColour (TextButton::buttonColourId,
findColour (secondaryButtonBackgroundColourId));
}
JUCE_DECLARE_NON_COPYABLE (EditorPanel) JUCE_DECLARE_NON_COPYABLE (EditorPanel)
}; };
@@ -264,7 +275,7 @@ struct AppearanceEditor
void setValue (const var& newValue) override void setValue (const var& newValue) override
{ {
Font font (Font::fromString (sourceValue.toString()));
auto font = Font::fromString (sourceValue.toString());
font.setTypefaceName (newValue.toString().isEmpty() ? Font::getDefaultMonospacedFontName() font.setTypefaceName (newValue.toString().isEmpty() ? Font::getDefaultMonospacedFontName()
: newValue.toString()); : newValue.toString());
sourceValue = font.toString(); sourceValue = font.toString();
@@ -272,7 +283,7 @@ struct AppearanceEditor
static ChoicePropertyComponent* createProperty (const String& title, const Value& value) static ChoicePropertyComponent* createProperty (const String& title, const Value& value)
{ {
StringArray fontNames = getAppSettings().monospacedFontNames;
auto fontNames = getAppSettings().monospacedFontNames;
Array<var> values; Array<var> values;
values.add (Font::getDefaultMonospacedFontName()); values.add (Font::getDefaultMonospacedFontName());
@@ -321,7 +332,7 @@ void AppearanceSettings::showGlobalPreferences (ScopedPointer<Component>& ownerP
else else
new FloatingToolWindow ("Preferences", new FloatingToolWindow ("Preferences",
"globalPreferencesEditorPos", "globalPreferencesEditorPos",
new GlobalPreferencesComponent,
new GlobalPreferencesComponent(),
ownerPointer, false, ownerPointer, false,
500, 500, 500, 500, 500, 500); 500, 500, 500, 500, 500, 500);
} }
@@ -369,3 +380,14 @@ GlobalPreferencesComponent::GlobalPreferencesComponent()
for (GlobalPreferencesTab** tab = preferenceTabs.begin(); tab != preferenceTabs.end(); ++tab) for (GlobalPreferencesTab** tab = preferenceTabs.begin(); tab != preferenceTabs.end(); ++tab)
addTab ((*tab)->getName(), findColour (backgroundColourId, true), (*tab)->getContent(), true); addTab ((*tab)->getName(), findColour (backgroundColourId, true), (*tab)->getContent(), true);
} }
void GlobalPreferencesComponent::paint (Graphics& g)
{
g.fillAll (findColour (backgroundColourId));
}
void GlobalPreferencesComponent::lookAndFeelChanged()
{
for (auto* tab : preferenceTabs)
tab->getContent()->sendLookAndFeelChange();
}

+ 5
- 0
extras/Projucer/Source/Application/jucer_GlobalPreferences.h View File

@@ -63,6 +63,8 @@ private:
Identifier getKeyForPropertyComponent (TextPropertyComponent*) const; Identifier getKeyForPropertyComponent (TextPropertyComponent*) const;
void lookAndFeelChanged() override;
OwnedArray<TextPropertyComponent> pathComponents; OwnedArray<TextPropertyComponent> pathComponents;
TextPropertyComponent* vst3PathComponent; TextPropertyComponent* vst3PathComponent;
@@ -103,8 +105,11 @@ class GlobalPreferencesComponent : public TabbedComponent
{ {
public: public:
GlobalPreferencesComponent(); GlobalPreferencesComponent();
void paint (Graphics&) override;
private: private:
void lookAndFeelChanged() override;
OwnedArray<GlobalPreferencesTab> preferenceTabs; OwnedArray<GlobalPreferencesTab> preferenceTabs;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GlobalPreferencesComponent) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GlobalPreferencesComponent)


+ 9
- 10
extras/Projucer/Source/ComponentEditor/properties/jucer_PositionPropertyBase.h View File

@@ -419,17 +419,10 @@ protected:
owner (owner_) owner (owner_)
{ {
setEditable (true, true, false); setEditable (true, true, false);
setColour (backgroundColourId, Colours::white);
setColour (textColourId, Colours::black);
setColour (outlineColourId, findColour (ComboBox::outlineColourId));
setColour (TextEditor::textColourId, Colours::black);
setColour (TextEditor::backgroundColourId, Colours::white);
setColour (TextEditor::outlineColourId, findColour (ComboBox::outlineColourId));
lookAndFeelChanged();
} }
TextEditor* createEditorComponent()
TextEditor* createEditorComponent() override
{ {
TextEditor* ed = Label::createEditorComponent(); TextEditor* ed = Label::createEditorComponent();
ed->setInputRestrictions (14, "0123456789.-%"); ed->setInputRestrictions (14, "0123456789.-%");
@@ -437,10 +430,16 @@ protected:
return ed; return ed;
} }
void textWasEdited()
void textWasEdited() override
{ {
owner.textWasEdited(); owner.textWasEdited();
} }
void lookAndFeelChanged() override
{
setColour (backgroundColourId, findColour (widgetBackgroundColourId));
setColour (textColourId, findColour (widgetTextColourId));
}
}; };
ComponentLayout* layout; ComponentLayout* layout;


+ 7
- 1
extras/Projucer/Source/ComponentEditor/ui/jucer_JucerDocumentEditor.cpp View File

@@ -71,9 +71,15 @@ public:
return; return;
if (rowIsSelected) if (rowIsSelected)
{
g.fillAll (findColour (TextEditor::highlightColourId)); g.fillAll (findColour (TextEditor::highlightColourId));
g.setColour (findColour (defaultHighlightedTextColourId));
}
else
{
g.setColour (findColour (defaultTextColourId));
}
g.setColour (findColour (defaultTextColourId));
g.setFont (height * 0.6f); g.setFont (height * 0.6f);
g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row], g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row],
30, 0, width - 32, height, 30, 0, width - 32, height,


+ 14
- 3
extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.cpp View File

@@ -93,13 +93,13 @@ ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc)
listBox->getHeader().addColumn ("reload", 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable); listBox->getHeader().addColumn ("reload", 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable);
listBox->getHeader().setStretchToFitActive (true); listBox->getHeader().setStretchToFitActive (true);
listBox->setColour (ListBox::backgroundColourId, findColour (secondaryBackgroundColourId));
listBox->setColour (ListBox::outlineColourId, Colours::transparentBlack);
listBox->setOutlineThickness (1); listBox->setOutlineThickness (1);
listBox->updateContent(); listBox->updateContent();
document.addChangeListener (this); document.addChangeListener (this);
handleCommandMessage (1); handleCommandMessage (1);
lookAndFeelChanged();
} }
ResourceEditorPanel::~ResourceEditorPanel() ResourceEditorPanel::~ResourceEditorPanel()
@@ -120,7 +120,7 @@ void ResourceEditorPanel::paintRowBackground (Graphics& g, int /*rowNumber*/,
} }
void ResourceEditorPanel::paintCell (Graphics& g, int rowNumber, int columnId, int width, int height, void ResourceEditorPanel::paintCell (Graphics& g, int rowNumber, int columnId, int width, int height,
bool /*rowIsSelected*/)
bool rowIsSelected)
{ {
if (const BinaryResources::BinaryResource* const r = document.getResources() [rowNumber]) if (const BinaryResources::BinaryResource* const r = document.getResources() [rowNumber])
{ {
@@ -133,6 +133,11 @@ void ResourceEditorPanel::paintCell (Graphics& g, int rowNumber, int columnId, i
else if (columnId == 3) else if (columnId == 3)
text = File::descriptionOfSizeInBytes ((int64) r->data.getSize()); text = File::descriptionOfSizeInBytes ((int64) r->data.getSize());
if (rowIsSelected)
g.setColour (findColour (defaultHighlightedTextColourId));
else
g.setColour (findColour (defaultTextColourId));
g.setFont (13.0f); g.setFont (13.0f);
g.drawText (text, 4, 0, width - 6, height, Justification::centredLeft, true); g.drawText (text, 4, 0, width - 6, height, Justification::centredLeft, true);
} }
@@ -179,6 +184,12 @@ int ResourceEditorPanel::getColumnAutoSizeWidth (int columnId)
return widest + 10; return widest + 10;
} }
void ResourceEditorPanel::lookAndFeelChanged()
{
listBox->setColour (ListBox::backgroundColourId, findColour (secondaryBackgroundColourId));
listBox->setColour (ListBox::outlineColourId, Colours::transparentBlack);
}
//============================================================================== //==============================================================================
class ResourceSorter class ResourceSorter
{ {


+ 2
- 0
extras/Projucer/Source/ComponentEditor/ui/jucer_ResourceEditorPanel.h View File

@@ -53,6 +53,8 @@ public:
void selectedRowsChanged (int lastRowSelected) override; void selectedRowsChanged (int lastRowSelected) override;
private: private:
void lookAndFeelChanged() override;
JucerDocument& document; JucerDocument& document;
ScopedPointer<TableListBox> listBox; ScopedPointer<TableListBox> listBox;
TextButton addButton, reloadAllButton, delButton; TextButton addButton, reloadAllButton, delButton;


+ 4
- 2
extras/Projucer/Source/Project Saving/jucer_TextWithDefaultPropertyComponent.h View File

@@ -123,9 +123,9 @@ public:
void refresh() override void refresh() override
{ {
if (cachedValue.isUsingDefault()) if (cachedValue.isUsingDefault())
setColour (textColourId, Colours::grey);
setColour (textColourId, findColour (widgetTextColourId).withMultipliedAlpha (0.5f));
else else
setColour (textColourId, Colours::black);
setColour (textColourId, findColour (widgetTextColourId));
textEditor->setText (getText(), dontSendNotification); textEditor->setText (getText(), dontSendNotification);
} }
@@ -164,5 +164,7 @@ private:
void editorHidden (Label*, TextEditor&) override {} void editorHidden (Label*, TextEditor&) override {}
void lookAndFeelChanged() override { refresh(); }
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent)
}; };

+ 10
- 4
extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.cpp View File

@@ -77,12 +77,13 @@ try : TextPropertyComponent (propertyName, 1024, false),
getValue().setValue (String()); getValue().setValue (String());
getValue().addListener (this); getValue().addListener (this);
setColour (textColourId, getTextColourToDisplay());
if (Label* label = dynamic_cast<Label*> (getChildComponent (0))) if (Label* label = dynamic_cast<Label*> (getChildComponent (0)))
label->addListener (this); label->addListener (this);
else else
jassertfalse; jassertfalse;
lookAndFeelChanged();
} }
catch (const std::bad_cast&) catch (const std::bad_cast&)
{ {
@@ -109,10 +110,10 @@ void DependencyPathPropertyComponent::textWasEdited()
Colour DependencyPathPropertyComponent::getTextColourToDisplay() const Colour DependencyPathPropertyComponent::getTextColourToDisplay() const
{ {
if (! pathValueSource.isUsingProjectSettings()) if (! pathValueSource.isUsingProjectSettings())
return pathValueSource.isValidPath (pathRelativeTo) ? Colours::grey
: Colours::lightpink;
return pathValueSource.isValidPath (pathRelativeTo) ? findColour (widgetTextColourId).withMultipliedAlpha (0.5f)
: Colours::red.withMultipliedAlpha (0.5f);
return pathValueSource.isValidPath (pathRelativeTo) ? Colours::black
return pathValueSource.isValidPath (pathRelativeTo) ? findColour (widgetTextColourId)
: Colours::red; : Colours::red;
} }
@@ -129,3 +130,8 @@ void DependencyPathPropertyComponent::editorShown (Label* /*label*/, TextEditor&
void DependencyPathPropertyComponent::editorHidden (Label*, TextEditor&) void DependencyPathPropertyComponent::editorHidden (Label*, TextEditor&)
{ {
} }
void DependencyPathPropertyComponent::lookAndFeelChanged()
{
textWasEdited();
}

+ 2
- 0
extras/Projucer/Source/Project/jucer_DependencyPathPropertyComponent.h View File

@@ -177,5 +177,7 @@ private:
void editorShown (Label*, TextEditor&) override; void editorShown (Label*, TextEditor&) override;
void editorHidden (Label*, TextEditor&) override; void editorHidden (Label*, TextEditor&) override;
void lookAndFeelChanged() override;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DependencyPathPropertyComponent) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DependencyPathPropertyComponent)
}; };

+ 1
- 1
extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp View File

@@ -554,7 +554,7 @@ void ProjucerLookAndFeel::setupColours()
} }
setColour (Label::textColourId, findColour (defaultTextColourId)); setColour (Label::textColourId, findColour (defaultTextColourId));
setColour (Label::textColourId, findColour (defaultTextColourId));
setColour (Label::textWhenEditingColourId, findColour (widgetTextColourId));
setColour (TextEditor::highlightColourId, findColour (defaultHighlightColourId)); setColour (TextEditor::highlightColourId, findColour (defaultHighlightColourId));
setColour (TextEditor::highlightedTextColourId, findColour (defaultHighlightedTextColourId)); setColour (TextEditor::highlightedTextColourId, findColour (defaultHighlightedTextColourId));
setColour (TextEditor::outlineColourId, Colours::transparentBlack); setColour (TextEditor::outlineColourId, Colours::transparentBlack);


Loading…
Cancel
Save