| @@ -124,12 +124,11 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| struct EditorPanel : public Component, | |||
| private Button::Listener | |||
| struct EditorPanel : public Component | |||
| { | |||
| EditorPanel() | |||
| : loadButton ("Load Scheme..."), | |||
| saveButton ("Save Scheme...") | |||
| : loadButton ("Load Scheme..."), | |||
| saveButton ("Save Scheme...") | |||
| { | |||
| rebuildProperties(); | |||
| addAndMakeVisible (panel); | |||
| @@ -137,8 +136,8 @@ private: | |||
| addAndMakeVisible (loadButton); | |||
| addAndMakeVisible (saveButton); | |||
| loadButton.addListener (this); | |||
| saveButton.addListener (this); | |||
| loadButton.onClick = [this] { loadScheme(); }; | |||
| saveButton.onClick = [this] { saveScheme (false); }; | |||
| lookAndFeelChanged(); | |||
| @@ -186,14 +185,6 @@ private: | |||
| Font codeFont; | |||
| Array<var> colourValues; | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == &loadButton) | |||
| loadScheme(); | |||
| else | |||
| saveScheme (false); | |||
| } | |||
| void saveScheme (bool isExit) | |||
| { | |||
| FileChooser fc ("Select a file in which to save this colour-scheme...", | |||
| @@ -30,8 +30,7 @@ | |||
| //============================================================================== | |||
| class SVGPathDataComponent : public Component, | |||
| public FileDragAndDropTarget, | |||
| private TextEditor::Listener, | |||
| private Button::Listener | |||
| private TextEditor::Listener | |||
| { | |||
| public: | |||
| @@ -55,13 +54,7 @@ public: | |||
| userText.setText (getLastText()); | |||
| addAndMakeVisible (copyButton); | |||
| copyButton.addListener (this); | |||
| } | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == ©Button) | |||
| SystemClipboard::copyTextToClipboard (resultText.getText()); | |||
| copyButton.onClick = [this] { SystemClipboard::copyTextToClipboard (resultText.getText()); }; | |||
| } | |||
| void textEditorTextChanged (TextEditor&) override | |||
| @@ -29,8 +29,7 @@ | |||
| #include "../../Utility/Helpers/jucer_TranslationHelpers.h" | |||
| //============================================================================== | |||
| class TranslationToolComponent : public Component, | |||
| public Button::Listener | |||
| class TranslationToolComponent : public Component | |||
| { | |||
| public: | |||
| TranslationToolComponent() | |||
| @@ -64,19 +63,17 @@ public: | |||
| addAndMakeVisible (editorPost); | |||
| addAndMakeVisible (editorResult); | |||
| generateButton.setButtonText (TRANS("Generate")); | |||
| addAndMakeVisible (generateButton); | |||
| scanProjectButton.setButtonText ("Scan Project for TRANS macros"); | |||
| generateButton.onClick = [this] { generate(); }; | |||
| addAndMakeVisible (scanProjectButton); | |||
| scanFolderButton.setButtonText ("Scan Folder for TRANS macros"); | |||
| scanProjectButton.onClick = [this] { scanProject(); }; | |||
| addAndMakeVisible (scanFolderButton); | |||
| loadTranslationButton.setButtonText ("Load existing translation File..."); | |||
| addAndMakeVisible (loadTranslationButton); | |||
| generateButton.addListener (this); | |||
| scanFolderButton.onClick = [this] { scanFolder(); }; | |||
| scanProjectButton.addListener (this); | |||
| scanFolderButton.addListener (this); | |||
| loadTranslationButton.addListener (this); | |||
| addAndMakeVisible (loadTranslationButton); | |||
| loadTranslationButton.onClick = [this] { loadFile(); }; | |||
| } | |||
| void paint (Graphics& g) override | |||
| @@ -120,22 +117,14 @@ public: | |||
| private: | |||
| CodeDocument documentOriginal, documentPre, documentPost, documentResult; | |||
| CodeEditorComponent editorOriginal, editorPre, editorPost, editorResult; | |||
| Label label1, label2, label3, label4; | |||
| TextButton generateButton; | |||
| Label instructionsLabel; | |||
| TextButton scanProjectButton; | |||
| TextButton scanFolderButton; | |||
| TextButton loadTranslationButton; | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == &generateButton) generate(); | |||
| else if (b == &scanProjectButton) scanProject(); | |||
| else if (b == &scanFolderButton) scanFolder(); | |||
| else if (b == &loadTranslationButton) loadFile(); | |||
| else | |||
| jassertfalse; | |||
| } | |||
| TextButton generateButton { TRANS("Generate") }; | |||
| TextButton scanProjectButton { "Scan project for TRANS macros" }; | |||
| TextButton scanFolderButton { "Scan folder for TRANS macros" }; | |||
| TextButton loadTranslationButton { "Load existing translation file..."}; | |||
| void generate() | |||
| { | |||
| @@ -234,8 +234,7 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| class UpdateUserDialog : public Component, | |||
| public Button::Listener | |||
| class UpdateUserDialog : public Component | |||
| { | |||
| public: | |||
| UpdateUserDialog (const LatestVersionChecker::JuceVersionTriple& version, | |||
| @@ -261,11 +260,11 @@ public: | |||
| addAndMakeVisible (okButton = new TextButton ("OK Button")); | |||
| okButton->setButtonText (TRANS(hasOverwriteButton ? "Choose Another Folder..." : "OK")); | |||
| okButton->addListener (this); | |||
| okButton->onClick = [this] { exitParentDialog (2); }; | |||
| addAndMakeVisible (cancelButton = new TextButton ("Cancel Button")); | |||
| cancelButton->setButtonText (TRANS("Cancel")); | |||
| cancelButton->addListener (this); | |||
| cancelButton->onClick = [this] { exitParentDialog (-1); }; | |||
| addAndMakeVisible (changeLogLabel = new Label ("Change Log Label", | |||
| TRANS("Release Notes:"))); | |||
| @@ -297,7 +296,7 @@ public: | |||
| addAndMakeVisible (overwriteButton = new TextButton ("Overwrite Button")); | |||
| overwriteButton->setButtonText (TRANS("Overwrite")); | |||
| overwriteButton->addListener (this); | |||
| overwriteButton->onClick = [this] { exitParentDialog (1); }; | |||
| } | |||
| juceIcon = Drawable::createFromImageData (BinaryData::juce_icon_png, | |||
| @@ -355,14 +354,10 @@ public: | |||
| } | |||
| } | |||
| void buttonClicked (Button* clickedButton) override | |||
| void exitParentDialog (int returnVal) | |||
| { | |||
| if (auto* parentDialog = findParentComponentOfClass<DialogWindow>()) | |||
| { | |||
| if (clickedButton == overwriteButton.get()) parentDialog->exitModalState (1); | |||
| else if (clickedButton == okButton.get()) parentDialog->exitModalState (2); | |||
| else if (clickedButton == cancelButton.get()) parentDialog->exitModalState (-1); | |||
| } | |||
| parentDialog->exitModalState (returnVal); | |||
| else | |||
| jassertfalse; | |||
| } | |||
| @@ -345,8 +345,7 @@ void GenericCodeEditorComponent::removeListener (GenericCodeEditorComponent::Lis | |||
| //============================================================================== | |||
| class GenericCodeEditorComponent::FindPanel : public Component, | |||
| private TextEditor::Listener, | |||
| private Button::Listener | |||
| private TextEditor::Listener | |||
| { | |||
| public: | |||
| FindPanel() | |||
| @@ -364,7 +363,7 @@ public: | |||
| addAndMakeVisible (caseButton); | |||
| caseButton.setColour (ToggleButton::textColourId, Colours::white); | |||
| caseButton.setToggleState (isCaseSensitiveSearch(), dontSendNotification); | |||
| caseButton.addListener (this); | |||
| caseButton.onClick = [this] { setCaseSensitiveSearch (caseButton.getToggleState()); }; | |||
| findPrev.setConnectedEdges (Button::ConnectedOnRight); | |||
| findNext.setConnectedEdges (Button::ConnectedOnLeft); | |||
| @@ -407,11 +406,6 @@ public: | |||
| findPrev.setBounds (getWidth() - 70, y, 30, 22); | |||
| } | |||
| void buttonClicked (Button*) override | |||
| { | |||
| setCaseSensitiveSearch (caseButton.getToggleState()); | |||
| } | |||
| void textEditorTextChanged (TextEditor&) override | |||
| { | |||
| setSearchString (editor.getText()); | |||
| @@ -102,8 +102,7 @@ public: | |||
| setColour (cs->getCurrentColour()); | |||
| } | |||
| class ColourSelectorComp : public Component, | |||
| public Button::Listener | |||
| class ColourSelectorComp : public Component | |||
| { | |||
| public: | |||
| ColourSelectorComp (ColourEditorComponent* owner_, | |||
| @@ -119,7 +118,13 @@ public: | |||
| if (canReset) | |||
| { | |||
| addAndMakeVisible (defaultButton); | |||
| defaultButton.addListener (this); | |||
| defaultButton.onClick = [this] | |||
| { | |||
| owner->resetToDefault(); | |||
| owner->refresh(); | |||
| selector.setCurrentColour (owner->getColour()); | |||
| }; | |||
| } | |||
| setSize (300, 400); | |||
| @@ -139,13 +144,6 @@ public: | |||
| } | |||
| } | |||
| void buttonClicked (Button*) override | |||
| { | |||
| owner->resetToDefault(); | |||
| owner->refresh(); | |||
| selector.setCurrentColour (owner->getColour()); | |||
| } | |||
| private: | |||
| class ColourSelectorWithSwatches : public ColourSelector | |||
| { | |||
| @@ -34,8 +34,7 @@ | |||
| Base class for a property that edits the x, y, w, or h of a PositionedRectangle. | |||
| */ | |||
| class PositionPropertyBase : public PropertyComponent, | |||
| protected ChangeListener, | |||
| private Button::Listener | |||
| protected ChangeListener | |||
| { | |||
| public: | |||
| enum ComponentPositionDimension | |||
| @@ -61,9 +60,13 @@ public: | |||
| allowRelativeOptions (allowRelativeOptions_) | |||
| { | |||
| addAndMakeVisible (button); | |||
| button.addListener (this); | |||
| button.setTriggeredOnMouseDown (true); | |||
| button.setConnectedEdges (TextButton::ConnectedOnLeft | TextButton::ConnectedOnRight); | |||
| button.onClick = [this] | |||
| { | |||
| if (showMenu (layout)) | |||
| refresh(); // (to clear the text editor if it's got focus) | |||
| }; | |||
| addAndMakeVisible (textEditor = new PositionPropLabel (*this)); | |||
| } | |||
| @@ -390,12 +393,6 @@ public: | |||
| textEditor->setText (getText(), dontSendNotification); | |||
| } | |||
| void buttonClicked (Button*) | |||
| { | |||
| if (showMenu (layout)) | |||
| refresh(); // (to clear the text editor if it's got focus) | |||
| } | |||
| void textWasEdited() | |||
| { | |||
| const String newText (textEditor->getText()); | |||
| @@ -28,8 +28,7 @@ | |||
| #include "jucer_ResourceEditorPanel.h" | |||
| //============================================================================== | |||
| class ResourceListButton : public Component, | |||
| private Button::Listener | |||
| class ResourceListButton : public Component | |||
| { | |||
| public: | |||
| ResourceListButton (JucerDocument& doc) | |||
| @@ -37,7 +36,12 @@ public: | |||
| { | |||
| setInterceptsMouseClicks (false, true); | |||
| addAndMakeVisible (reloadButton); | |||
| reloadButton.addListener (this); | |||
| reloadButton.onClick = [this] | |||
| { | |||
| if (auto* r = document.getResources() [row]) | |||
| document.getResources().browseForResource ("Select a file to replace this resource", "*", | |||
| File (r->originalFilename), r->name); | |||
| }; | |||
| } | |||
| void update (int newRow) | |||
| @@ -51,16 +55,6 @@ public: | |||
| reloadButton.setBoundsInset (BorderSize<int> (2)); | |||
| } | |||
| void buttonClicked (Button*) | |||
| { | |||
| if (const BinaryResources::BinaryResource* const r = document.getResources() [row]) | |||
| document.getResources() | |||
| .browseForResource ("Select a file to replace this resource", | |||
| "*", | |||
| File (r->originalFilename), | |||
| r->name); | |||
| } | |||
| private: | |||
| JucerDocument& document; | |||
| TextButton reloadButton; | |||
| @@ -76,14 +70,14 @@ ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc) | |||
| delButton ("Delete selected resources") | |||
| { | |||
| addAndMakeVisible (addButton); | |||
| addButton.addListener (this); | |||
| addButton.onClick = [this] { document.getResources().browseForResource ("Select a file to add as a resource", "*", {}, {}); }; | |||
| addAndMakeVisible (reloadAllButton); | |||
| reloadAllButton.addListener (this); | |||
| reloadAllButton.onClick = [this] { reloadAll(); }; | |||
| addAndMakeVisible (delButton); | |||
| delButton.addListener (this); | |||
| delButton.setEnabled (false); | |||
| delButton.onClick = [this] { document.getResources().remove (listBox->getSelectedRow (0)); }; | |||
| addAndMakeVisible (listBox = new TableListBox (String(), this)); | |||
| listBox->getHeader().addColumn ("name", 1, 150, 80, 400); | |||
| @@ -259,36 +253,21 @@ void ResourceEditorPanel::changeListenerCallback (ChangeBroadcaster*) | |||
| listBox->updateContent(); | |||
| } | |||
| void ResourceEditorPanel::buttonClicked (Button* b) | |||
| void ResourceEditorPanel::reloadAll() | |||
| { | |||
| if (b == &addButton) | |||
| { | |||
| document.getResources() | |||
| .browseForResource ("Select a file to add as a resource", | |||
| "*", | |||
| File(), | |||
| String()); | |||
| } | |||
| else if (b == &delButton) | |||
| StringArray failed; | |||
| for (int i = 0; i < document.getResources().size(); ++i) | |||
| { | |||
| document.getResources().remove (listBox->getSelectedRow (0)); | |||
| if (! document.getResources().reload (i)) | |||
| failed.add (document.getResources().getResourceNames() [i]); | |||
| } | |||
| else if (b == &reloadAllButton) | |||
| { | |||
| StringArray failed; | |||
| for (int i = 0; i < document.getResources().size(); ++i) | |||
| { | |||
| if (! document.getResources().reload (i)) | |||
| failed.add (document.getResources().getResourceNames() [i]); | |||
| } | |||
| if (failed.size() > 0) | |||
| { | |||
| AlertWindow::showMessageBox (AlertWindow::WarningIcon, | |||
| TRANS("Reloading resources"), | |||
| TRANS("The following resources couldn't be reloaded from their original files:\n\n") | |||
| + failed.joinIntoString (", ")); | |||
| } | |||
| if (failed.size() > 0) | |||
| { | |||
| AlertWindow::showMessageBox (AlertWindow::WarningIcon, | |||
| TRANS("Reloading resources"), | |||
| TRANS("The following resources couldn't be reloaded from their original files:\n\n") | |||
| + failed.joinIntoString (", ")); | |||
| } | |||
| } | |||
| @@ -31,8 +31,7 @@ | |||
| //============================================================================== | |||
| class ResourceEditorPanel : public Component, | |||
| private TableListBoxModel, | |||
| private ChangeListener, | |||
| private Button::Listener | |||
| private ChangeListener | |||
| { | |||
| public: | |||
| ResourceEditorPanel (JucerDocument& document); | |||
| @@ -42,7 +41,6 @@ public: | |||
| void paint (Graphics& g) override; | |||
| void visibilityChanged() override; | |||
| void changeListenerCallback (ChangeBroadcaster*) override; | |||
| void buttonClicked (Button*) override; | |||
| int getNumRows() override; | |||
| void paintRowBackground (Graphics& g, int rowNumber, int width, int height, bool rowIsSelected) override; | |||
| @@ -54,6 +52,7 @@ public: | |||
| private: | |||
| void lookAndFeelChanged() override; | |||
| void reloadAll(); | |||
| JucerDocument& document; | |||
| ScopedPointer<TableListBox> listBox; | |||
| @@ -79,15 +79,14 @@ private: | |||
| //============================================================================== | |||
| struct Header : public Component, | |||
| private LicenseController::StateChangedCallback, | |||
| private Button::Listener | |||
| private LicenseController::StateChangedCallback | |||
| { | |||
| Header() : avatarButton ("User Settings", &getIcons().user) | |||
| { | |||
| setOpaque (true); | |||
| addChildComponent (avatarButton); | |||
| avatarButton.addListener (this); | |||
| avatarButton.onClick = [this] { showAvatarWindow(); }; | |||
| if (auto* licenseController = ProjucerApplication::getApp().licenseController.get()) | |||
| { | |||
| @@ -98,8 +97,6 @@ private: | |||
| virtual ~Header() | |||
| { | |||
| avatarButton.removeListener (this); | |||
| if (auto* licenseController = ProjucerApplication::getApp().licenseController.get()) | |||
| licenseController->removeLicenseStatusChangedCallback (this); | |||
| } | |||
| @@ -126,7 +123,7 @@ private: | |||
| avatarButton.repaint(); | |||
| } | |||
| void buttonClicked (Button*) override | |||
| void showAvatarWindow() | |||
| { | |||
| if (auto* licenseController = ProjucerApplication::getApp().licenseController.get()) | |||
| { | |||
| @@ -66,14 +66,17 @@ struct LiveBuildSettingsComponent : public Component | |||
| //============================================================================== | |||
| class LiveBuildTab : public Component, | |||
| private ChangeListener, | |||
| private Button::Listener | |||
| private ChangeListener | |||
| { | |||
| public: | |||
| LiveBuildTab (CompileEngineChildProcess* child, String lastErrorMessage) | |||
| { | |||
| addAndMakeVisible (settingsButton = new IconButton ("Settings", &getIcons().settings)); | |||
| settingsButton->addListener (this); | |||
| settingsButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->showLiveBuildSettings(); | |||
| }; | |||
| if (child != nullptr) | |||
| { | |||
| @@ -96,7 +99,7 @@ public: | |||
| if (showDownloadButton) | |||
| { | |||
| addAndMakeVisible (downloadButton = new TextButton ("Download")); | |||
| downloadButton->addListener (this); | |||
| downloadButton->onClick = [this] { downloadDLL(); }; | |||
| } | |||
| if (showEnableButton) | |||
| @@ -110,7 +113,11 @@ public: | |||
| } | |||
| addAndMakeVisible (enableButton = new TextButton (buttonText)); | |||
| enableButton->addListener (this); | |||
| enableButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->setBuildEnabled (true); | |||
| }; | |||
| } | |||
| } | |||
| } | |||
| @@ -207,35 +214,20 @@ private: | |||
| return String ("Enable compilation to use the live-build engine"); | |||
| } | |||
| void buttonClicked (Button* b) override | |||
| void downloadDLL() | |||
| { | |||
| auto* pcc = findParentComponentOfClass<ProjectContentComponent>(); | |||
| if (b == settingsButton) | |||
| { | |||
| if (pcc != nullptr) | |||
| pcc->showLiveBuildSettings(); | |||
| } | |||
| else if (b == downloadButton) | |||
| if (DownloadCompileEngineThread::downloadAndInstall()) | |||
| { | |||
| if (DownloadCompileEngineThread::downloadAndInstall()) | |||
| if (! CompileEngineDLL::getInstance()->tryLoadDll()) | |||
| { | |||
| if (! CompileEngineDLL::getInstance()->tryLoadDll()) | |||
| { | |||
| AlertWindow::showMessageBox(AlertWindow::WarningIcon, | |||
| "Download and install", | |||
| "Loading the live-build engine failed"); | |||
| return; | |||
| } | |||
| if (pcc != nullptr) | |||
| pcc->rebuildProjectTabs(); | |||
| AlertWindow::showMessageBox(AlertWindow::WarningIcon, | |||
| "Download and install", | |||
| "Loading the live-build engine failed"); | |||
| return; | |||
| } | |||
| } | |||
| else if (b == enableButton) | |||
| { | |||
| if (pcc != nullptr) | |||
| pcc->setBuildEnabled (true); | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->rebuildProjectTabs(); | |||
| } | |||
| } | |||
| @@ -330,8 +330,7 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| class MissingDependenciesComponent : public PropertyComponent, | |||
| public Button::Listener | |||
| class MissingDependenciesComponent : public PropertyComponent | |||
| { | |||
| public: | |||
| MissingDependenciesComponent (Project& p, const String& modID) | |||
| @@ -343,7 +342,7 @@ private: | |||
| addAndMakeVisible (fixButton); | |||
| fixButton.setColour (TextButton::buttonColourId, Colours::red); | |||
| fixButton.setColour (TextButton::textColourOffId, Colours::white); | |||
| fixButton.addListener (this); | |||
| fixButton.onClick = [this] { fixDependencies(); }; | |||
| } | |||
| void refresh() override {} | |||
| @@ -358,7 +357,7 @@ private: | |||
| g.drawFittedText (text, getLocalBounds().reduced (10), Justification::topLeft, 3); | |||
| } | |||
| void buttonClicked (Button*) override | |||
| void fixDependencies() | |||
| { | |||
| ModuleList list; | |||
| @@ -171,8 +171,7 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| class ConcertinaTreeComponent : public Component, | |||
| private Button::Listener | |||
| class ConcertinaTreeComponent : public Component | |||
| { | |||
| public: | |||
| ConcertinaTreeComponent (TreePanelBase* tree, bool hasAddButton = false, | |||
| @@ -182,13 +181,13 @@ public: | |||
| if (hasAddButton) | |||
| { | |||
| addAndMakeVisible (addButton = new IconButton ("Add", &getIcons().plus)); | |||
| addButton->addListener (this); | |||
| addButton->onClick = [this] { showAddMenu(); }; | |||
| } | |||
| if (hasSettingsButton) | |||
| { | |||
| addAndMakeVisible (settingsButton = new IconButton ("Settings", &getIcons().settings)); | |||
| settingsButton->addListener (this); | |||
| settingsButton->onClick = [this] { showSettings(); }; | |||
| } | |||
| if (hasFindPanel) | |||
| @@ -236,14 +235,6 @@ private: | |||
| ScopedPointer<IconButton> addButton, settingsButton; | |||
| ScopedPointer<FindPanel> findPanel; | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == addButton) | |||
| showAddMenu(); | |||
| else if (b == settingsButton) | |||
| showSettings(); | |||
| } | |||
| void showAddMenu() | |||
| { | |||
| auto numSelected = treeToDisplay->tree.getNumSelectedItems(); | |||
| @@ -31,7 +31,6 @@ | |||
| //============================================================================== | |||
| class HeaderComponent : public Component, | |||
| private Button::Listener, | |||
| private ComboBox::Listener, | |||
| private ValueTree::Listener, | |||
| private ChangeListener | |||
| @@ -218,18 +217,6 @@ private: | |||
| int tabsWidth = 200; | |||
| //========================================================================== | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| auto* pcc = findParentComponentOfClass<ProjectContentComponent>(); | |||
| if (b == projectSettingsButton) pcc->showProjectSettings(); | |||
| else if (b == continuousRebuildButton) pcc->setContinuousRebuildEnabled (! pcc->isContinuousRebuildEnabled()); | |||
| else if (b == buildNowButton) pcc->rebuildNow(); | |||
| else if (b == exporterSettingsButton) pcc->showExporterSettings (getSelectedExporterName()); | |||
| else if (b == saveAndOpenInIDEButton) pcc->openInSelectedIDE (true); | |||
| else if (b == userSettingsButton) showUserSettings(); | |||
| } | |||
| void comboBoxChanged (ComboBox* c) override | |||
| { | |||
| if (c == &exporterBox) | |||
| @@ -257,24 +244,48 @@ private: | |||
| auto& icons = getIcons(); | |||
| addAndMakeVisible (projectSettingsButton = new IconButton ("Project Settings", &icons.settings)); | |||
| projectSettingsButton->addListener (this); | |||
| projectSettingsButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->showProjectSettings(); | |||
| }; | |||
| addAndMakeVisible (continuousRebuildButton = new IconButton ("Continuous Rebuild", &icons.continuousBuildStart)); | |||
| continuousRebuildButton->addListener (this); | |||
| continuousRebuildButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->setContinuousRebuildEnabled (! pcc->isContinuousRebuildEnabled()); | |||
| }; | |||
| addAndMakeVisible (buildNowButton = new IconButton ("Build Now", &icons.buildNow)); | |||
| buildNowButton->addListener (this); | |||
| buildNowButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->rebuildNow(); | |||
| }; | |||
| addAndMakeVisible (exporterSettingsButton = new IconButton ("Exporter Settings", &icons.edit)); | |||
| exporterSettingsButton->addListener (this); | |||
| exporterSettingsButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->showExporterSettings (getSelectedExporterName()); | |||
| }; | |||
| addAndMakeVisible (saveAndOpenInIDEButton = new IconButton ("Save and Open in IDE", nullptr)); | |||
| saveAndOpenInIDEButton->addListener (this); | |||
| saveAndOpenInIDEButton->isIDEButton = true; | |||
| saveAndOpenInIDEButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| pcc->openInSelectedIDE (true); | |||
| }; | |||
| addAndMakeVisible (userSettingsButton = new IconButton ("User Settings", &icons.user)); | |||
| userSettingsButton->addListener (this); | |||
| userSettingsButton->isUserButton = true; | |||
| userSettingsButton->onClick = [this] | |||
| { | |||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | |||
| showUserSettings(); | |||
| }; | |||
| updateExporterButton(); | |||
| updateUserAvatar(); | |||
| @@ -30,8 +30,7 @@ | |||
| //============================================================================== | |||
| class ModulesInformationComponent : public Component, | |||
| private ListBoxModel, | |||
| private ValueTree::Listener, | |||
| private Button::Listener | |||
| private ValueTree::Listener | |||
| { | |||
| public: | |||
| ModulesInformationComponent (Project& p) | |||
| @@ -55,13 +54,15 @@ public: | |||
| addAndMakeVisible (header); | |||
| addAndMakeVisible (setCopyModeButton); | |||
| addAndMakeVisible (copyPathButton); | |||
| addAndMakeVisible (globalPathsButton); | |||
| setCopyModeButton.addListener (this); | |||
| setCopyModeButton.setTriggeredOnMouseDown (true); | |||
| copyPathButton.addListener (this); | |||
| setCopyModeButton.onClick = [this] { showCopyModeMenu(); }; | |||
| addAndMakeVisible (copyPathButton); | |||
| copyPathButton.setTriggeredOnMouseDown (true); | |||
| globalPathsButton.addListener (this); | |||
| copyPathButton.onClick = [this] { showSetPathsMenu(); }; | |||
| addAndMakeVisible (globalPathsButton); | |||
| globalPathsButton.onClick = [this] { showGlobalPathsMenu(); }; | |||
| modulesValueTree.addListener (this); | |||
| lookAndFeelChanged(); | |||
| @@ -177,13 +178,6 @@ public: | |||
| project.getModules().removeModule (project.getModules().getModuleID (row)); | |||
| } | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == &setCopyModeButton) showCopyModeMenu(); | |||
| if (b == ©PathButton) showSetPathsMenu(); | |||
| if (b == &globalPathsButton) showGlobalPathsMenu(); | |||
| } | |||
| void lookAndFeelChanged() override | |||
| { | |||
| setCopyModeButton.setColour (TextButton::buttonColourId, findColour (secondaryButtonBackgroundColourId)); | |||
| @@ -140,8 +140,7 @@ private: | |||
| //============================================================================== | |||
| struct PopupColourSelector : public Component, | |||
| public ChangeListener, | |||
| public Value::Listener, | |||
| public Button::Listener | |||
| public Value::Listener | |||
| { | |||
| PopupColourSelector (const Value& colour, | |||
| Colour defaultCol, | |||
| @@ -158,7 +157,11 @@ private: | |||
| if (canResetToDefault) | |||
| { | |||
| addAndMakeVisible (defaultButton); | |||
| defaultButton.addListener (this); | |||
| defaultButton.onClick = [this] | |||
| { | |||
| setColour (defaultColour); | |||
| selector.setCurrentColour (defaultColour); | |||
| }; | |||
| } | |||
| colourValue.addListener (this); | |||
| @@ -198,12 +201,6 @@ private: | |||
| } | |||
| } | |||
| void buttonClicked (Button*) override | |||
| { | |||
| setColour (defaultColour); | |||
| selector.setCurrentColour (defaultColour); | |||
| } | |||
| void changeListenerCallback (ChangeBroadcaster*) override | |||
| { | |||
| if (selector.getCurrentColour() != getColour()) | |||
| @@ -166,7 +166,7 @@ try : TextPropertyComponent (propertyDescription, 1024, false), | |||
| setInterestedInFileDrag (false); | |||
| addAndMakeVisible (browseButton); | |||
| browseButton.addListener (this); | |||
| browseButton.onClick = [this] { browse(); }; | |||
| lookAndFeelChanged(); | |||
| } | |||
| @@ -244,7 +244,7 @@ void DependencyFilePathPropertyComponent::editorShown (Label*, TextEditor& edito | |||
| editor.setText (String(), dontSendNotification); | |||
| } | |||
| void DependencyFilePathPropertyComponent::buttonClicked (Button*) | |||
| void DependencyFilePathPropertyComponent::browse() | |||
| { | |||
| auto currentFile = pathRelativeTo.getChildFile (pathValue.toString()); | |||
| @@ -192,8 +192,7 @@ private: | |||
| class DependencyFilePathPropertyComponent : public TextPropertyComponent, | |||
| public FileDragAndDropTarget, | |||
| private Value::Listener, | |||
| private Label::Listener, | |||
| private Button::Listener | |||
| private Label::Listener | |||
| { | |||
| public: | |||
| DependencyFilePathPropertyComponent (Value& value, | |||
| @@ -223,8 +222,6 @@ private: | |||
| void editorHidden (Label*, TextEditor&) override {} | |||
| void editorShown (Label*, TextEditor&) override; | |||
| void buttonClicked (Button*) override; | |||
| void lookAndFeelChanged() override | |||
| { | |||
| browseButton.setColour (TextButton::buttonColourId, | |||
| @@ -232,6 +229,7 @@ private: | |||
| textWasEdited(); | |||
| } | |||
| void browse(); | |||
| Colour getTextColourToDisplay() const; | |||
| //========================================================================== | |||
| @@ -54,7 +54,6 @@ public: | |||
| private: | |||
| struct InnerComponent : public Component, | |||
| public FileDragAndDropTarget, | |||
| private Button::Listener, | |||
| private TextEditor::Listener | |||
| { | |||
| InnerComponent (Value v, bool isDir, const String& wc, const File& rt, const bool multiplePaths) | |||
| @@ -71,7 +70,7 @@ private: | |||
| textbox.addListener (this); | |||
| addAndMakeVisible (button); | |||
| button.addListener (this); | |||
| button.onClick = [this] { browse(); }; | |||
| lookAndFeelChanged(); | |||
| } | |||
| @@ -111,9 +110,9 @@ private: | |||
| repaint(); | |||
| } | |||
| void buttonClicked (Button*) override | |||
| void browse() | |||
| { | |||
| const File currentFile (root.getChildFile (value.toString())); | |||
| auto currentFile = root.getChildFile (value.toString()); | |||
| if (isDirectory) | |||
| { | |||
| @@ -29,7 +29,6 @@ | |||
| //============================================================================== | |||
| class ModulesFolderPathBox : public Component, | |||
| private Button::Listener, | |||
| private ComboBox::Listener | |||
| { | |||
| public: | |||
| @@ -49,15 +48,22 @@ public: | |||
| currentPathBox.addListener (this); | |||
| addAndMakeVisible (openFolderButton); | |||
| openFolderButton.addListener (this); | |||
| openFolderButton.setTooltip (TRANS ("Select JUCE modules folder")); | |||
| openFolderButton.onClick = [this] { selectJuceFolder(); }; | |||
| addAndMakeVisible (modulesLabel); | |||
| modulesLabel.attachToComponent (¤tPathBox, true); | |||
| addAndMakeVisible (useGlobalPathsToggle); | |||
| useGlobalPathsToggle.addListener (this); | |||
| useGlobalPathsToggle.setToggleState (true, sendNotification); | |||
| useGlobalPathsToggle.onClick = [this] | |||
| { | |||
| isUsingGlobalPaths = useGlobalPathsToggle.getToggleState(); | |||
| currentPathBox.setEnabled (! isUsingGlobalPaths); | |||
| openFolderButton.setEnabled (! isUsingGlobalPaths); | |||
| modulesLabel.setEnabled (! isUsingGlobalPaths); | |||
| }; | |||
| } | |||
| void resized() override | |||
| @@ -115,23 +121,6 @@ public: | |||
| } | |||
| } | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == &openFolderButton) | |||
| { | |||
| selectJuceFolder(); | |||
| } | |||
| else if (b == &useGlobalPathsToggle) | |||
| { | |||
| isUsingGlobalPaths = useGlobalPathsToggle.getToggleState(); | |||
| currentPathBox.setEnabled (! isUsingGlobalPaths); | |||
| openFolderButton.setEnabled (! isUsingGlobalPaths); | |||
| modulesLabel.setEnabled (! isUsingGlobalPaths); | |||
| } | |||
| } | |||
| void comboBoxChanged (ComboBox*) override | |||
| { | |||
| setModulesFolder (File::getCurrentWorkingDirectory().getChildFile (currentPathBox.getText())); | |||
| @@ -296,7 +285,6 @@ private: | |||
| a list box of platform targets to generate. | |||
| */ | |||
| class WizardComp : public Component, | |||
| private Button::Listener, | |||
| private ComboBox::Listener, | |||
| private TextEditor::Listener, | |||
| private FileBrowserListener | |||
| @@ -336,11 +324,11 @@ public: | |||
| fileBrowser.addListener (this); | |||
| addChildAndSetID (&createButton, "createButton"); | |||
| createButton.addListener (this); | |||
| createButton.onClick = [this] { createProject(); }; | |||
| addChildAndSetID (&cancelButton, "cancelButton"); | |||
| cancelButton.addShortcut (KeyPress (KeyPress::escapeKey)); | |||
| cancelButton.addListener (this); | |||
| cancelButton.onClick = [this] { returnToTemplatesPage(); }; | |||
| addChildAndSetID (&modulesPathBox, "modulesPathBox"); | |||
| @@ -387,18 +375,6 @@ public: | |||
| platformTargets.setBounds (right.reduced (25)); | |||
| } | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == &createButton) | |||
| { | |||
| createProject(); | |||
| } | |||
| else if (b == &cancelButton) | |||
| { | |||
| returnToTemplatesPage(); | |||
| } | |||
| } | |||
| void returnToTemplatesPage() | |||
| { | |||
| if (auto* parent = findParentComponentOfClass<SlidingPanelComponent>()) | |||
| @@ -162,8 +162,8 @@ public: | |||
| addAndMakeVisible (exampleProjectButton = new TemplateOptionButton ("Open Example Project", TemplateOptionButton::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg)); | |||
| addAndMakeVisible (openProjectButton = new TemplateOptionButton ("Open Existing Project", TemplateOptionButton::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg)); | |||
| blankProjectButton->addListener (this); | |||
| exampleProjectButton->addListener (this); | |||
| blankProjectButton->onClick = [this] { createBlankProject(); }; | |||
| exampleProjectButton->onClick = [this] { openExampleProject(); }; | |||
| openProjectButton->setCommandToTrigger (&commandManager, CommandIDs::open, true); | |||
| newProjectWizard = projectWizard; | |||
| @@ -264,11 +264,7 @@ private: | |||
| void buttonClicked (Button* b) override | |||
| { | |||
| if (b == blankProjectButton) | |||
| createBlankProject(); | |||
| else if (b == exampleProjectButton) | |||
| openExampleProject(); | |||
| else if (dynamic_cast<TemplateOptionButton*> (b) != nullptr) | |||
| if (dynamic_cast<TemplateOptionButton*> (b) != nullptr) | |||
| showWizard (b->getButtonText()); | |||
| } | |||