| @@ -117,6 +117,8 @@ void ProjucerApplication::initialise (const String& commandLine) | |||
| settings->appearance.refreshPresetSchemeList(); | |||
| setColourScheme (settings->getGlobalProperties().getIntValue ("COLOUR SCHEME"), false); | |||
| // do further initialisation in a moment when the message loop has started | |||
| triggerAsyncUpdate(); | |||
| } | |||
| @@ -499,32 +501,7 @@ void ProjucerApplication::handleMainMenuCommand (int menuItemID) | |||
| } | |||
| 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 | |||
| { | |||
| @@ -801,3 +778,43 @@ void ProjucerApplication::initCommandManager() | |||
| 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); | |||
| } | |||
| } | |||
| @@ -148,4 +148,6 @@ private: | |||
| void handleAsyncUpdate() override; | |||
| void initCommandManager(); | |||
| void setColourScheme (int index, bool saveSetting); | |||
| }; | |||
| @@ -264,7 +264,6 @@ public: | |||
| addAndMakeVisible (cancelButton = new TextButton ("Cancel Button")); | |||
| cancelButton->setButtonText (TRANS("Cancel")); | |||
| cancelButton->addListener (this); | |||
| cancelButton->setColour (TextButton::buttonColourId, findColour (secondaryButtonBackgroundColourId)); | |||
| addAndMakeVisible (changeLogLabel = new Label ("Change Log Label", | |||
| TRANS("Release Notes:"))); | |||
| @@ -303,6 +302,8 @@ public: | |||
| BinaryData::juce_icon_pngSize); | |||
| setSize (518, overwritePath ? 345 : 269); | |||
| lookAndFeelChanged(); | |||
| } | |||
| ~UpdateUserDialog() | |||
| @@ -394,6 +395,13 @@ private: | |||
| ScopedPointer<TextButton> overwriteButton; | |||
| ScopedPointer<Drawable> juceIcon; | |||
| void lookAndFeelChanged() override | |||
| { | |||
| cancelButton->setColour (TextButton::buttonColourId, | |||
| findColour (secondaryButtonBackgroundColourId)); | |||
| changeLog->applyFontToAllText (changeLog->getFont()); | |||
| } | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UpdateUserDialog) | |||
| }; | |||
| @@ -34,7 +34,7 @@ PathSettingsTab::PathSettingsTab (DependencyPathOS os) | |||
| { | |||
| const int maxChars = 1024; | |||
| StoredSettings& settings = getAppSettings(); | |||
| auto& settings = getAppSettings(); | |||
| 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)); | |||
| 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) | |||
| { | |||
| 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) | |||
| : Colours::red; | |||
| @@ -96,13 +96,18 @@ void PathSettingsTab::resized() | |||
| { | |||
| 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 | |||
| @@ -124,7 +129,7 @@ struct AppearanceEditor | |||
| g.setColour (findColour (defaultTextColourId)); | |||
| 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); | |||
| } | |||
| @@ -136,7 +141,7 @@ struct AppearanceEditor | |||
| { | |||
| getAppSettings().monospacedFontNames = fontsFound; | |||
| if (AppearanceSettingsTab* tab = findParentComponentOfClass<AppearanceSettingsTab>()) | |||
| if (auto* tab = findParentComponentOfClass<AppearanceSettingsTab>()) | |||
| tab->changeContent (new EditorPanel()); | |||
| } | |||
| else | |||
| @@ -154,7 +159,7 @@ struct AppearanceEditor | |||
| { | |||
| const Font font (name, 20.0f, Font::plain); | |||
| const int width = font.getStringWidth ("...."); | |||
| const auto width = font.getStringWidth ("...."); | |||
| return width == font.getStringWidth ("WWWW") | |||
| && width == font.getStringWidth ("0000") | |||
| @@ -185,14 +190,14 @@ struct AppearanceEditor | |||
| void rebuildProperties() | |||
| { | |||
| AppearanceSettings& scheme = getAppSettings().appearance; | |||
| auto& scheme = getAppSettings().appearance; | |||
| Array<PropertyComponent*> props; | |||
| Value fontValue (scheme.getCodeFontValue()); | |||
| auto fontValue = scheme.getCodeFontValue(); | |||
| props.add (FontNameValueSource::createProperty ("Code Editor Font", 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) | |||
| props.add (new ColourPropertyComponent (nullptr, colourNames[i], | |||
| @@ -205,8 +210,8 @@ struct AppearanceEditor | |||
| 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)); | |||
| saveButton.setBounds (r.reduced (10, 3)); | |||
| } | |||
| @@ -249,6 +254,12 @@ struct AppearanceEditor | |||
| rebuildProperties(); | |||
| } | |||
| void lookAndFeelChanged() override | |||
| { | |||
| loadButton.setColour (TextButton::buttonColourId, | |||
| findColour (secondaryButtonBackgroundColourId)); | |||
| } | |||
| JUCE_DECLARE_NON_COPYABLE (EditorPanel) | |||
| }; | |||
| @@ -264,7 +275,7 @@ struct AppearanceEditor | |||
| 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() | |||
| : newValue.toString()); | |||
| sourceValue = font.toString(); | |||
| @@ -272,7 +283,7 @@ struct AppearanceEditor | |||
| static ChoicePropertyComponent* createProperty (const String& title, const Value& value) | |||
| { | |||
| StringArray fontNames = getAppSettings().monospacedFontNames; | |||
| auto fontNames = getAppSettings().monospacedFontNames; | |||
| Array<var> values; | |||
| values.add (Font::getDefaultMonospacedFontName()); | |||
| @@ -321,7 +332,7 @@ void AppearanceSettings::showGlobalPreferences (ScopedPointer<Component>& ownerP | |||
| else | |||
| new FloatingToolWindow ("Preferences", | |||
| "globalPreferencesEditorPos", | |||
| new GlobalPreferencesComponent, | |||
| new GlobalPreferencesComponent(), | |||
| ownerPointer, false, | |||
| 500, 500, 500, 500, 500, 500); | |||
| } | |||
| @@ -369,3 +380,14 @@ GlobalPreferencesComponent::GlobalPreferencesComponent() | |||
| for (GlobalPreferencesTab** tab = preferenceTabs.begin(); tab != preferenceTabs.end(); ++tab) | |||
| 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(); | |||
| } | |||
| @@ -63,6 +63,8 @@ private: | |||
| Identifier getKeyForPropertyComponent (TextPropertyComponent*) const; | |||
| void lookAndFeelChanged() override; | |||
| OwnedArray<TextPropertyComponent> pathComponents; | |||
| TextPropertyComponent* vst3PathComponent; | |||
| @@ -103,8 +105,11 @@ class GlobalPreferencesComponent : public TabbedComponent | |||
| { | |||
| public: | |||
| GlobalPreferencesComponent(); | |||
| void paint (Graphics&) override; | |||
| private: | |||
| void lookAndFeelChanged() override; | |||
| OwnedArray<GlobalPreferencesTab> preferenceTabs; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GlobalPreferencesComponent) | |||
| @@ -419,17 +419,10 @@ protected: | |||
| owner (owner_) | |||
| { | |||
| 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(); | |||
| ed->setInputRestrictions (14, "0123456789.-%"); | |||
| @@ -437,10 +430,16 @@ protected: | |||
| return ed; | |||
| } | |||
| void textWasEdited() | |||
| void textWasEdited() override | |||
| { | |||
| owner.textWasEdited(); | |||
| } | |||
| void lookAndFeelChanged() override | |||
| { | |||
| setColour (backgroundColourId, findColour (widgetBackgroundColourId)); | |||
| setColour (textColourId, findColour (widgetTextColourId)); | |||
| } | |||
| }; | |||
| ComponentLayout* layout; | |||
| @@ -71,9 +71,15 @@ public: | |||
| return; | |||
| if (rowIsSelected) | |||
| { | |||
| g.fillAll (findColour (TextEditor::highlightColourId)); | |||
| g.setColour (findColour (defaultHighlightedTextColourId)); | |||
| } | |||
| else | |||
| { | |||
| g.setColour (findColour (defaultTextColourId)); | |||
| } | |||
| g.setColour (findColour (defaultTextColourId)); | |||
| g.setFont (height * 0.6f); | |||
| g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row], | |||
| 30, 0, width - 32, height, | |||
| @@ -93,13 +93,13 @@ ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc) | |||
| listBox->getHeader().addColumn ("reload", 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable); | |||
| listBox->getHeader().setStretchToFitActive (true); | |||
| listBox->setColour (ListBox::backgroundColourId, findColour (secondaryBackgroundColourId)); | |||
| listBox->setColour (ListBox::outlineColourId, Colours::transparentBlack); | |||
| listBox->setOutlineThickness (1); | |||
| listBox->updateContent(); | |||
| document.addChangeListener (this); | |||
| handleCommandMessage (1); | |||
| lookAndFeelChanged(); | |||
| } | |||
| 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, | |||
| bool /*rowIsSelected*/) | |||
| bool rowIsSelected) | |||
| { | |||
| 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) | |||
| text = File::descriptionOfSizeInBytes ((int64) r->data.getSize()); | |||
| if (rowIsSelected) | |||
| g.setColour (findColour (defaultHighlightedTextColourId)); | |||
| else | |||
| g.setColour (findColour (defaultTextColourId)); | |||
| g.setFont (13.0f); | |||
| g.drawText (text, 4, 0, width - 6, height, Justification::centredLeft, true); | |||
| } | |||
| @@ -179,6 +184,12 @@ int ResourceEditorPanel::getColumnAutoSizeWidth (int columnId) | |||
| return widest + 10; | |||
| } | |||
| void ResourceEditorPanel::lookAndFeelChanged() | |||
| { | |||
| listBox->setColour (ListBox::backgroundColourId, findColour (secondaryBackgroundColourId)); | |||
| listBox->setColour (ListBox::outlineColourId, Colours::transparentBlack); | |||
| } | |||
| //============================================================================== | |||
| class ResourceSorter | |||
| { | |||
| @@ -53,6 +53,8 @@ public: | |||
| void selectedRowsChanged (int lastRowSelected) override; | |||
| private: | |||
| void lookAndFeelChanged() override; | |||
| JucerDocument& document; | |||
| ScopedPointer<TableListBox> listBox; | |||
| TextButton addButton, reloadAllButton, delButton; | |||
| @@ -123,9 +123,9 @@ public: | |||
| void refresh() override | |||
| { | |||
| if (cachedValue.isUsingDefault()) | |||
| setColour (textColourId, Colours::grey); | |||
| setColour (textColourId, findColour (widgetTextColourId).withMultipliedAlpha (0.5f)); | |||
| else | |||
| setColour (textColourId, Colours::black); | |||
| setColour (textColourId, findColour (widgetTextColourId)); | |||
| textEditor->setText (getText(), dontSendNotification); | |||
| } | |||
| @@ -164,5 +164,7 @@ private: | |||
| void editorHidden (Label*, TextEditor&) override {} | |||
| void lookAndFeelChanged() override { refresh(); } | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent) | |||
| }; | |||
| @@ -77,12 +77,13 @@ try : TextPropertyComponent (propertyName, 1024, false), | |||
| getValue().setValue (String()); | |||
| getValue().addListener (this); | |||
| setColour (textColourId, getTextColourToDisplay()); | |||
| if (Label* label = dynamic_cast<Label*> (getChildComponent (0))) | |||
| label->addListener (this); | |||
| else | |||
| jassertfalse; | |||
| lookAndFeelChanged(); | |||
| } | |||
| catch (const std::bad_cast&) | |||
| { | |||
| @@ -109,10 +110,10 @@ void DependencyPathPropertyComponent::textWasEdited() | |||
| Colour DependencyPathPropertyComponent::getTextColourToDisplay() const | |||
| { | |||
| 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; | |||
| } | |||
| @@ -129,3 +130,8 @@ void DependencyPathPropertyComponent::editorShown (Label* /*label*/, TextEditor& | |||
| void DependencyPathPropertyComponent::editorHidden (Label*, TextEditor&) | |||
| { | |||
| } | |||
| void DependencyPathPropertyComponent::lookAndFeelChanged() | |||
| { | |||
| textWasEdited(); | |||
| } | |||
| @@ -177,5 +177,7 @@ private: | |||
| void editorShown (Label*, TextEditor&) override; | |||
| void editorHidden (Label*, TextEditor&) override; | |||
| void lookAndFeelChanged() override; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DependencyPathPropertyComponent) | |||
| }; | |||
| @@ -554,7 +554,7 @@ void ProjucerLookAndFeel::setupColours() | |||
| } | |||
| setColour (Label::textColourId, findColour (defaultTextColourId)); | |||
| setColour (Label::textColourId, findColour (defaultTextColourId)); | |||
| setColour (Label::textWhenEditingColourId, findColour (widgetTextColourId)); | |||
| setColour (TextEditor::highlightColourId, findColour (defaultHighlightColourId)); | |||
| setColour (TextEditor::highlightedTextColourId, findColour (defaultHighlightedTextColourId)); | |||
| setColour (TextEditor::outlineColourId, Colours::transparentBlack); | |||