mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added blank project and made examples button work
This commit is contained in:
parent
a4e437d0df
commit
4c87324e86
24 changed files with 156 additions and 37 deletions
|
|
@ -594,6 +594,10 @@
|
|||
<Option compile="0"/>
|
||||
<Option link="0"/>
|
||||
</Unit>
|
||||
<Unit filename="../../Source/Wizards/jucer_ProjectWizard_Blank.h">
|
||||
<Option compile="0"/>
|
||||
<Option link="0"/>
|
||||
</Unit>
|
||||
<Unit filename="../../Source/Wizards/jucer_ProjectWizard_Console.h">
|
||||
<Option compile="0"/>
|
||||
<Option link="0"/>
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@
|
|||
0D1C432D74433308E05942AD = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_TextDiff.cpp"; path = "../../../../modules/juce_core/text/juce_TextDiff.cpp"; sourceTree = "SOURCE_ROOT"; };
|
||||
0DB0A9E30EEDDEA720BC5A03 = {isa = PBXFileReference; lastKnownFileType = file.svg; name = "wizard_StaticLibrary.svg"; path = "../../Source/BinaryData/wizard_StaticLibrary.svg"; sourceTree = "SOURCE_ROOT"; };
|
||||
0E80EFDB550393DB1C94F291 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Font.h"; path = "../../../../modules/juce_graphics/fonts/juce_Font.h"; sourceTree = "SOURCE_ROOT"; };
|
||||
0F01067432AC314EAC213C1C = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ProjectWizard_Blank.h"; path = "../../Source/Wizards/jucer_ProjectWizard_Blank.h"; sourceTree = "SOURCE_ROOT"; };
|
||||
0F249640243FBD5717F6ADD9 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_MiscUtilities.cpp"; path = "../../Source/Utility/jucer_MiscUtilities.cpp"; sourceTree = "SOURCE_ROOT"; };
|
||||
0F2505BCD0232EB95D5199F2 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Process.h"; path = "../../../../modules/juce_core/threads/juce_Process.h"; sourceTree = "SOURCE_ROOT"; };
|
||||
0F382FC6B16658EF02D2C4F0 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MessageListener.cpp"; path = "../../../../modules/juce_events/messages/juce_MessageListener.cpp"; sourceTree = "SOURCE_ROOT"; };
|
||||
|
|
@ -1134,6 +1135,7 @@
|
|||
3C95FA2AA91EBA19ADDD5C29,
|
||||
8A825FDDC00DD253F44D2C3A,
|
||||
4A4EBDAD8D098F72CE053235,
|
||||
0F01067432AC314EAC213C1C,
|
||||
A44A774EFC020D3D046A9249,
|
||||
9992E6950C64322A11E39ADF,
|
||||
05D67B5A8D64947C067C0945,
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@
|
|||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_Animated.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_AudioApp.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_Console.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_DLL.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_GUIApp.h"/>
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@
|
|||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_Animated.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_AudioApp.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_Console.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_DLL.h"/>
|
||||
<File RelativePath="..\..\Source\Wizards\jucer_ProjectWizard_GUIApp.h"/>
|
||||
|
|
|
|||
|
|
@ -1159,6 +1159,7 @@
|
|||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Animated.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioApp.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Console.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_DLL.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_GUIApp.h"/>
|
||||
|
|
|
|||
|
|
@ -1674,6 +1674,9 @@
|
|||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Console.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -1165,6 +1165,7 @@
|
|||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Animated.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioApp.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Console.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_DLL.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_GUIApp.h"/>
|
||||
|
|
|
|||
|
|
@ -1674,6 +1674,9 @@
|
|||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Console.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -1165,6 +1165,7 @@
|
|||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Animated.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioApp.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Console.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_DLL.h"/>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_GUIApp.h"/>
|
||||
|
|
|
|||
|
|
@ -1674,6 +1674,9 @@
|
|||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_AudioPlugin.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Blank.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Source\Wizards\jucer_ProjectWizard_Console.h">
|
||||
<Filter>The Introjucer\Wizards</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -488,6 +488,8 @@
|
|||
resource="0" file="Source/Wizards/jucer_ProjectWizard_AudioApp.h"/>
|
||||
<FILE id="VslsJm" name="jucer_ProjectWizard_AudioPlugin.h" compile="0"
|
||||
resource="0" file="Source/Wizards/jucer_ProjectWizard_AudioPlugin.h"/>
|
||||
<FILE id="YnNfnf" name="jucer_ProjectWizard_Blank.h" compile="0" resource="0"
|
||||
file="Source/Wizards/jucer_ProjectWizard_Blank.h"/>
|
||||
<FILE id="ZGv05z" name="jucer_ProjectWizard_Console.h" compile="0"
|
||||
resource="0" file="Source/Wizards/jucer_ProjectWizard_Console.h"/>
|
||||
<FILE id="MSY7Sv" name="jucer_ProjectWizard_DLL.h" compile="0" resource="0"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ static const unsigned char temp_binary_data_0[] =
|
|||
" //==============================================================================\r\n"
|
||||
" MainContentComponent()\r\n"
|
||||
" {\r\n"
|
||||
" setSize (500, 400);\r\n"
|
||||
" setSize (800, 600);\r\n"
|
||||
" setFramesPerSecond (60);\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
|
|
@ -109,7 +109,7 @@ static const unsigned char temp_binary_data_1[] =
|
|||
" //==============================================================================\r\n"
|
||||
" MainContentComponent()\r\n"
|
||||
" {\r\n"
|
||||
" setSize (500, 400);\r\n"
|
||||
" setSize (800, 600);\r\n"
|
||||
"\r\n"
|
||||
" // specify the number of input and output channels that we want to open\r\n"
|
||||
" setAudioChannels (2, 2);\r\n"
|
||||
|
|
@ -707,7 +707,7 @@ static const unsigned char temp_binary_data_8[] =
|
|||
"//==============================================================================\r\n"
|
||||
"CONTENTCOMPCLASS::CONTENTCOMPCLASS()\r\n"
|
||||
"{\r\n"
|
||||
" setSize (500, 400);\r\n"
|
||||
" setSize (600, 400);\r\n"
|
||||
"}\r\n"
|
||||
"\r\n"
|
||||
"CONTENTCOMPCLASS::~CONTENTCOMPCLASS()\r\n"
|
||||
|
|
@ -1343,7 +1343,7 @@ static const unsigned char temp_binary_data_20[] =
|
|||
" //==============================================================================\r\n"
|
||||
" MainContentComponent()\r\n"
|
||||
" {\r\n"
|
||||
" setSize (500, 400);\r\n"
|
||||
" setSize (800, 600);\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" ~MainContentComponent()\r\n"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ struct NewProjectWizardClasses
|
|||
#include "jucer_ProjectWizard_openGL.h"
|
||||
#include "jucer_ProjectWizard_Animated.h"
|
||||
#include "jucer_ProjectWizard_AudioApp.h"
|
||||
#include "jucer_ProjectWizard_Blank.h"
|
||||
|
||||
#include "jucer_NewProjectWizardComponent.h"
|
||||
#include "jucer_TemplateThumbnailsComponent.h"
|
||||
|
|
@ -52,7 +53,7 @@ struct NewProjectWizardClasses
|
|||
//==============================================================================
|
||||
static int getNumWizards() noexcept
|
||||
{
|
||||
return 8;
|
||||
return 9;
|
||||
}
|
||||
|
||||
static NewProjectWizard* createWizardType (int index)
|
||||
|
|
@ -67,6 +68,7 @@ struct NewProjectWizardClasses
|
|||
case 5: return new NewProjectWizardClasses::ConsoleAppWizard();
|
||||
case 6: return new NewProjectWizardClasses::StaticLibraryWizard();
|
||||
case 7: return new NewProjectWizardClasses::DynamicLibraryWizard();
|
||||
case 8: return new NewProjectWizardClasses::BlankAppWizard();
|
||||
default: jassertfalse; break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,4 +73,6 @@ struct AnimatedAppWizard : public NewProjectWizard
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AnimatedAppWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -80,4 +80,6 @@ struct AudioAppWizard : public NewProjectWizard
|
|||
s.addIfNotAlreadyThere ("juce_audio_utils");
|
||||
return s;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioAppWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -102,4 +102,6 @@ struct AudioPluginAppWizard : public NewProjectWizard
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAppWizard)
|
||||
};
|
||||
|
|
|
|||
45
extras/Introjucer/Source/Wizards/jucer_ProjectWizard_Blank.h
Normal file
45
extras/Introjucer/Source/Wizards/jucer_ProjectWizard_Blank.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
struct BlankAppWizard : public NewProjectWizard
|
||||
{
|
||||
BlankAppWizard() {}
|
||||
|
||||
String getName() const override { return TRANS("Empty Application"); }
|
||||
String getDescription() const override { return TRANS("Creates a blank JUCE GUI application."); }
|
||||
const char* getIcon() const override { return BinaryData::wizard_GUI_svg; }
|
||||
|
||||
bool initialiseProject (Project& project)
|
||||
{
|
||||
createSourceFolder();
|
||||
project.getProjectTypeValue() = ProjectType::getGUIAppTypeName();
|
||||
Project::Item sourceGroup (createSourceGroup (project));
|
||||
setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BlankAppWizard)
|
||||
};
|
||||
|
|
@ -83,4 +83,6 @@ struct ConsoleAppWizard : public NewProjectWizard
|
|||
|
||||
private:
|
||||
bool createMainCpp;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConsoleAppWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,4 +40,6 @@ struct DynamicLibraryWizard : public NewProjectWizard
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DynamicLibraryWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -118,4 +118,6 @@ struct GUIAppWizard : public NewProjectWizard
|
|||
|
||||
private:
|
||||
bool createMainCpp, createWindow;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GUIAppWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,4 +40,6 @@ struct StaticLibraryWizard : public NewProjectWizard
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StaticLibraryWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -73,4 +73,6 @@ struct OpenGLAppWizard : public NewProjectWizard
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLAppWizard)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ public:
|
|||
addAndMakeVisible (panel);
|
||||
}
|
||||
|
||||
void paint (Graphics& g)
|
||||
void paint (Graphics& g) override
|
||||
{
|
||||
IntrojucerLookAndFeel::fillWithBackgroundTexture (*this, g);
|
||||
}
|
||||
|
||||
void resized()
|
||||
void resized() override
|
||||
{
|
||||
panel.setBounds (getLocalBounds());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,9 @@ class TemplateTileBrowser : public Component,
|
|||
public:
|
||||
TemplateTileBrowser (WizardComp* projectWizard)
|
||||
{
|
||||
for (int i = 0; i < getNumWizards(); ++i)
|
||||
const int numWizardButtons = getNumWizards() - 1; // ( - 1 because the last one is blank)
|
||||
|
||||
for (int i = 0; i < numWizardButtons; ++i)
|
||||
{
|
||||
ScopedPointer<NewProjectWizard> wizard (createWizardType (i));
|
||||
|
||||
|
|
@ -154,49 +156,45 @@ public:
|
|||
// Handle Open Project button functionality
|
||||
ApplicationCommandManager& commandManager = IntrojucerApp::getCommandManager();
|
||||
|
||||
blankProjectButton = new TemplateOptionButton ("Create Blank Project", TemplateOptionButton::ButtonStyle::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg);
|
||||
openProjectButton = new TemplateOptionButton ("Open Existing Project", TemplateOptionButton::ButtonStyle::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg);
|
||||
addAndMakeVisible (blankProjectButton = new TemplateOptionButton ("Create Blank Project", TemplateOptionButton::ButtonStyle::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg));
|
||||
addAndMakeVisible (exampleProjectButton = new TemplateOptionButton ("Open Example Project", TemplateOptionButton::ButtonStyle::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg));
|
||||
addAndMakeVisible (openProjectButton = new TemplateOptionButton ("Open Existing Project", TemplateOptionButton::ButtonStyle::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg));
|
||||
|
||||
blankProjectButton->addListener (this);
|
||||
exampleProjectButton->addListener (this);
|
||||
openProjectButton->setCommandToTrigger (&commandManager, CommandIDs::open, true);
|
||||
|
||||
exampleProjectButton = new TemplateOptionButton ("Open Example Project", TemplateOptionButton::ButtonStyle::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg);
|
||||
exampleProjectButton->setCommandToTrigger (&commandManager, CommandIDs::open, true);
|
||||
|
||||
addAndMakeVisible (blankProjectButton);
|
||||
addAndMakeVisible (openProjectButton);
|
||||
addAndMakeVisible (exampleProjectButton);
|
||||
|
||||
newProjectWizard = projectWizard;
|
||||
}
|
||||
|
||||
void paint (Graphics& g) override
|
||||
{
|
||||
g.setColour (Colours::black.withAlpha (0.2f));
|
||||
g.fillRect (0, 0, getWidth(), 60);
|
||||
g.fillRect (getLocalBounds().removeFromTop (60));
|
||||
|
||||
g.setColour (Colours::white);
|
||||
g.setFont (20);
|
||||
g.setFont (20.0f);
|
||||
g.drawText ("Create New Project", 0, 0, getWidth(), 60, Justification::centred, true);
|
||||
|
||||
// draw the descriptions of each template if hovered;
|
||||
// (repaint is called by the button listener on change state)
|
||||
Rectangle<int> descriptionBox = getBounds().reduced (30, 30);
|
||||
descriptionBox = descriptionBox.removeFromBottom (50);
|
||||
Rectangle<int> descriptionBox (getLocalBounds().reduced (30).removeFromBottom (50));
|
||||
|
||||
g.setColour (Colours::white.withAlpha (0.4f));
|
||||
g.setFont (15);
|
||||
g.setFont (15.0f);
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
if (optionButtons.getUnchecked(i)->getState() == TemplateOptionButton::ButtonState::buttonOver)
|
||||
for (int i = 0; i < optionButtons.size(); ++i)
|
||||
if (optionButtons.getUnchecked(i)->isOver())
|
||||
g.drawFittedText (optionButtons.getUnchecked(i)->getDescription(), descriptionBox, Justification::centred, 5, 1.0f);
|
||||
}
|
||||
|
||||
void resized() override
|
||||
{
|
||||
Rectangle<int> allOpts = getBounds().reduced (40, 60);
|
||||
Rectangle<int> allOpts = getLocalBounds().reduced (40, 60);
|
||||
allOpts.removeFromBottom (allOpts.getHeight() * 0.25);
|
||||
|
||||
const int numHorizIcons = 4;
|
||||
const int optStep = allOpts.getWidth()/numHorizIcons;
|
||||
const int optStep = allOpts.getWidth() / numHorizIcons;
|
||||
|
||||
for (int i = 0; i < optionButtons.size(); ++i)
|
||||
{
|
||||
|
|
@ -208,7 +206,7 @@ public:
|
|||
.reduced (10, 10));
|
||||
}
|
||||
|
||||
Rectangle<int> openButtonBounds = getBounds();
|
||||
Rectangle<int> openButtonBounds = getLocalBounds();
|
||||
openButtonBounds.removeFromBottom (proportionOfHeight (0.12f));
|
||||
openButtonBounds = openButtonBounds.removeFromBottom (120);
|
||||
openButtonBounds.reduce (50, 40);
|
||||
|
|
@ -218,24 +216,45 @@ public:
|
|||
openProjectButton->setBounds (openButtonBounds.reduced (18, 0));
|
||||
}
|
||||
|
||||
void buttonClicked (Button* b) override
|
||||
void showWizard (const String& name)
|
||||
{
|
||||
newProjectWizard->projectType.setText (b->getButtonText());
|
||||
newProjectWizard->projectType.setText (name);
|
||||
|
||||
if (SlidingPanelComponent* parent = findParentComponentOfClass<SlidingPanelComponent>())
|
||||
{
|
||||
if (parent->getNumTabs() > 0 && b->getButtonText() != "Open Existing Project")
|
||||
parent->goToTab (parent->getCurrentTabIndex() + 1);
|
||||
}
|
||||
parent->goToTab (1);
|
||||
else
|
||||
{
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
|
||||
void buttonStateChanged (Button*) override
|
||||
void createBlankProject()
|
||||
{
|
||||
repaint();
|
||||
showWizard (BlankAppWizard().getName());
|
||||
}
|
||||
|
||||
void openExampleProject()
|
||||
{
|
||||
FileChooser fc ("Open File", findExamplesFolder());
|
||||
|
||||
if (fc.browseForFileToOpen())
|
||||
IntrojucerApp::getApp().openFile (fc.getResult());
|
||||
}
|
||||
|
||||
static File findExamplesFolder()
|
||||
{
|
||||
File appFolder (File::getSpecialLocation (File::currentApplicationFile));
|
||||
|
||||
while (appFolder.exists()
|
||||
&& appFolder.getParentDirectory() != appFolder)
|
||||
{
|
||||
File examples (appFolder.getSiblingFile ("examples"));
|
||||
|
||||
if (examples.exists())
|
||||
return examples;
|
||||
|
||||
appFolder = appFolder.getParentDirectory();
|
||||
}
|
||||
|
||||
return File::nonexistent;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -243,6 +262,21 @@ private:
|
|||
NewProjectWizardClasses::WizardComp* newProjectWizard;
|
||||
ScopedPointer<TemplateOptionButton> blankProjectButton, openProjectButton, exampleProjectButton;
|
||||
|
||||
void buttonClicked (Button* b) override
|
||||
{
|
||||
if (b == blankProjectButton)
|
||||
createBlankProject();
|
||||
else if (b == exampleProjectButton)
|
||||
openExampleProject();
|
||||
else if (dynamic_cast<TemplateOptionButton*> (b) != nullptr)
|
||||
showWizard (b->getButtonText());
|
||||
}
|
||||
|
||||
void buttonStateChanged (Button*) override
|
||||
{
|
||||
repaint();
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemplateTileBrowser)
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue