2 ==============================================================================
4 This is an automatically generated file created by the Jucer!
6 Be careful when adding custom code to these files, as only the code within
7 the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
10 Created for JUCE version: JUCE v1.53.8
12 ------------------------------------------------------------------------------
14 JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd.
16 ==============================================================================
19 //[CppHeaders] You can add your own extra header files here...
20 #include "jucer_ProjectExporter.h"
23 #include "jucer_ProjectInformationComponent.h"
26 //[MiscUserDefs] You can add your own user definitions and misc code here...
27 class PropertiesWithHelpComponent
: public PropertyPanelWithTooltips
30 PropertiesWithHelpComponent (Project
& project_
, int tabIndex_
)
31 : project (project_
), tabIndex (tabIndex_
)
35 void rebuildProperties()
38 Array
<PropertyComponent
*> props
;
42 // The main project tab...
43 project
.createPropertyEditors (props
);
45 else if (tabIndex
== 1)
47 // The Juce options tab...
48 OwnedArray
<Project::JuceConfigFlag
> flags
;
49 project
.getJuceConfigFlags (flags
);
51 StringArray possibleValues
;
52 possibleValues
.add ("(Use default from juce_Config.h)");
53 possibleValues
.add ("Enabled");
54 possibleValues
.add ("Disabled");
57 mappings
.add (Project::configFlagDefault
);
58 mappings
.add (Project::configFlagEnabled
);
59 mappings
.add (Project::configFlagDisabled
);
61 for (int i
= 0; i
< flags
.size(); ++i
)
63 ChoicePropertyComponent
* c
= new ChoicePropertyComponent (flags
[i
]->value
, flags
[i
]->symbol
, possibleValues
, mappings
);
64 c
->setTooltip (flags
[i
]->description
);
65 c
->setPreferredHeight (22);
69 else if (tabIndex
< 2 + project
.getNumConfigurations())
72 project
.getConfiguration (tabIndex
- 2).createPropertyEditors (props
);
77 ScopedPointer
<ProjectExporter
> exp (project
.createExporter (tabIndex
- (2 + project
.getNumConfigurations())));
80 exp
->createPropertyEditors (props
);
82 for (int i
= props
.size(); --i
>= 0;)
83 props
.getUnchecked(i
)->setPreferredHeight (22);
86 getPanel().addProperties (props
);
89 void visibilityChanged()
101 //==============================================================================
102 ProjectInformationComponent::ProjectInformationComponent (Project
& project_
)
103 : project (project_
),
104 configTabBox (TabbedButtonBar::TabsAtTop
)
106 addAndMakeVisible (&configTabBox
);
107 configTabBox
.setBounds ("8, 0, this.left + parent.width - 16, this.top + parent.height - 36");
108 addAndMakeVisible (&editConfigsButton
);
109 editConfigsButton
.setBounds ("8, parent.height - 30, this.left + 192, this.top + 22");
110 editConfigsButton
.setButtonText ("Add/Remove Configurations...");
111 editConfigsButton
.addListener (this);
112 addAndMakeVisible (&openProjectButton
);
113 openProjectButton
.setBounds ("608, parent.height - 30, this.left + 208, this.top + 22");
114 openProjectButton
.setButtonText ("Open Project in ");
115 openProjectButton
.addListener (this);
116 addAndMakeVisible (&editExportersButton
);
117 editExportersButton
.setBounds ("208, parent.height - 30, this.left + 160, this.top + 22");
118 editExportersButton
.setButtonText ("Add/Remove Exporters...");
119 editExportersButton
.addListener (this);
120 addAndMakeVisible (&saveAndOpenButton
);
121 saveAndOpenButton
.setBounds ("391, parent.height - 30, this.left + 208, this.top + 22");
122 saveAndOpenButton
.setButtonText ("Save And Open in");
123 saveAndOpenButton
.addListener (this);
128 #if JUCE_MAC || JUCE_WINDOWS
129 openProjectButton
.setCommandToTrigger (commandManager
, CommandIDs::openInIDE
, true);
130 openProjectButton
.setButtonText (commandManager
->getNameOfCommand (CommandIDs::openInIDE
));
132 saveAndOpenButton
.setCommandToTrigger (commandManager
, CommandIDs::saveAndOpenInIDE
, true);
133 saveAndOpenButton
.setButtonText (commandManager
->getNameOfCommand (CommandIDs::saveAndOpenInIDE
));
135 openProjectButton
.setVisible (false);
136 saveAndOpenButton
.setVisible (false);
142 //[Constructor] You can add your own custom stuff here..
143 configTabBox
.setOutline (1);
144 configTabBox
.setColour (TabbedComponent::outlineColourId
, Colours::black
.withAlpha (0.3f
));
146 editConfigsButton
.setTriggeredOnMouseDown (true);
148 project
.addChangeListener (this);
152 ProjectInformationComponent::~ProjectInformationComponent()
154 //[Destructor_pre]. You can add your own custom destruction code here..
155 project
.removeChangeListener (this);
160 //[Destructor]. You can add your own custom destruction code here..
164 //==============================================================================
165 void ProjectInformationComponent::resized()
173 //[/Userresized_Post]
176 void ProjectInformationComponent::buttonClicked (Button
* buttonThatWasClicked
)
178 //[UserbuttonClicked_Pre]
179 //[/UserbuttonClicked_Pre]
181 if (buttonThatWasClicked
== &editConfigsButton
)
183 //[UserButtonCode_b6625dfcdb1f4755] -- add your button handler code here..
185 //[/UserButtonCode_b6625dfcdb1f4755]
187 else if (buttonThatWasClicked
== &openProjectButton
)
189 //[UserButtonCode_a550a652e2666ee7] -- add your button handler code here..
190 //[/UserButtonCode_a550a652e2666ee7]
192 else if (buttonThatWasClicked
== &editExportersButton
)
194 //[UserButtonCode_c1f6e5f9811b307e] -- add your button handler code here..
196 //[/UserButtonCode_c1f6e5f9811b307e]
198 else if (buttonThatWasClicked
== &saveAndOpenButton
)
200 //[UserButtonCode_dRGMyYx] -- add your button handler code here..
201 //[/UserButtonCode_dRGMyYx]
204 //[UserbuttonClicked_Post]
205 //[/UserbuttonClicked_Post]
208 void ProjectInformationComponent::paint (Graphics
& g
)
210 //[UserPaint] Add your own custom painting code here..
211 g
.setTiledImageFill (ImageCache::getFromMemory (BinaryData::brushed_aluminium_png
, BinaryData::brushed_aluminium_pngSize
),
214 drawRecessedShadows (g
, getWidth(), getHeight(), 14);
220 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
221 void ProjectInformationComponent::rebuildConfigTabs()
223 configTabBox
.clearTabs();
226 PropertiesWithHelpComponent
* panel
= new PropertiesWithHelpComponent (project
, index
++);
227 configTabBox
.addTab ("Project Settings", Colours::lightslategrey
, panel
, true, -1);
229 panel
= new PropertiesWithHelpComponent (project
, index
++);
230 configTabBox
.addTab ("Juce Flags", Colours::lightblue
, panel
, true, -1);
233 for (i
= 0; i
< project
.getNumConfigurations(); ++i
)
235 panel
= new PropertiesWithHelpComponent (project
, index
++);
236 Project::BuildConfiguration
config (project
.getConfiguration (i
));
237 configTabBox
.addTab (config
.getName().toString(), Colour::greyLevel (0.65f
), panel
, true, -1);
240 for (i
= 0; i
< project
.getNumExporters(); ++i
)
242 ScopedPointer
<ProjectExporter
> exp (project
.createExporter (i
));
246 panel
= new PropertiesWithHelpComponent (project
, index
++);
247 configTabBox
.addTab (exp
->getName(), Colours::lightsteelblue
, panel
, true, -1);
251 lastProjectType
= project
.getProjectType().getValue();
254 void ProjectInformationComponent::updateConfigTabs()
256 if (configTabBox
.getNumTabs() != project
.getNumConfigurations() + project
.getNumExporters() + 2
257 || lastProjectType
!= project
.getProjectType().getValue())
263 for (int i
= 0; i
< project
.getNumConfigurations(); ++i
)
265 Project::BuildConfiguration
config (project
.getConfiguration (i
));
266 configTabBox
.setTabName (i
+ 2, config
.getName().toString());
271 void ProjectInformationComponent::showConfigMenu()
274 m
.addItem (1, "Add a new empty configuration");
276 PopupMenu createCopyMenu
, removeMenu
;
278 for (int i
= 0; i
< project
.getNumConfigurations(); ++i
)
280 Project::BuildConfiguration
config (project
.getConfiguration (i
));
281 createCopyMenu
.addItem (i
+ 10000, "Create a copy of '" + config
.getName().toString() + "'");
282 removeMenu
.addItem (i
+ 20000, "Delete configuration '" + config
.getName().toString() + "'");
285 m
.addSubMenu ("Add a copy of an existing configuration", createCopyMenu
);
286 m
.addSubMenu ("Remove configuration", removeMenu
);
288 const int r
= m
.showAt (&editConfigsButton
);
292 project
.deleteConfiguration (r
- 20000);
296 Project::BuildConfiguration
configToCopy (project
.getConfiguration (r
- 10000));
297 project
.addNewConfiguration (&configToCopy
);
301 project
.addNewConfiguration (nullptr);
305 void ProjectInformationComponent::showExporterMenu()
309 PopupMenu createMenu
, removeMenu
;
312 for (i
= 0; i
< project
.getNumExporters(); ++i
)
314 ScopedPointer
<ProjectExporter
> exp (project
.createExporter (i
));
317 removeMenu
.addItem (i
+ 20000, "Delete " + exp
->getName());
320 StringArray
exporters (ProjectExporter::getExporterNames());
322 for (i
= 0; i
< exporters
.size(); ++i
)
323 createMenu
.addItem (i
+ 10000, "Create a new " + exporters
[i
] + " target");
325 m
.addSubMenu ("Create new export target", createMenu
);
326 m
.addSubMenu ("Remove export target", removeMenu
);
328 const int r
= m
.showAt (&editExportersButton
);
331 project
.deleteExporter (r
- 20000);
333 project
.addNewExporter (r
- 10000);
336 void ProjectInformationComponent::changeListenerCallback (ChangeBroadcaster
*)
344 //==============================================================================
345 //======================= Jucer Information Section ==========================
346 //==============================================================================
348 /* This section stores the Jucer's metadata - edit it at your own risk!
350 JUCER_COMPONENT_METADATA_START
352 <COMPONENT id="tO9EG1a" className="ProjectInformationComponent" width="836"
353 height="427" background="f6f9ff" parentClasses="public Component, public ChangeListener"
354 constructorParams="Project& project_" memberInitialisers="project (project_)">
356 <TABBEDCOMPONENT id="962c1575c4142253" memberName="configTabBox" focusOrder="0"
357 position="8, 0, this.left + parent.width - 16, this.top + parent.height - 36"/>
358 <TEXTBUTTON id="b6625dfcdb1f4755" memberName="editConfigsButton" focusOrder="0"
359 text="Add/Remove Configurations..." createCallback="1" radioGroup="0"
360 connectedLeft="0" connectedRight="0" connectedTop="0" connectedBottom="0"
361 backgroundColour="" textColour="" backgroundColourOn="" textColourOn=""
362 position="8, parent.height - 30, this.left + 192, this.top + 22"/>
363 <TEXTBUTTON id="a550a652e2666ee7" memberName="openProjectButton" focusOrder="0"
364 text="Open Project in " createCallback="1" radioGroup="0" connectedLeft="0"
365 connectedRight="0" connectedTop="0" connectedBottom="0" backgroundColour=""
366 textColour="" backgroundColourOn="" textColourOn="" position="608, parent.height - 30, this.left + 208, this.top + 22"/>
367 <TEXTBUTTON id="c1f6e5f9811b307e" memberName="editExportersButton" focusOrder="0"
368 text="Add/Remove Exporters..." createCallback="1" radioGroup="0"
369 connectedLeft="0" connectedRight="0" connectedTop="0" connectedBottom="0"
370 backgroundColour="" textColour="" backgroundColourOn="" textColourOn=""
371 position="208, parent.height - 30, this.left + 160, this.top + 22"/>
372 <TEXTBUTTON id="dRGMyYx" name="" memberName="saveAndOpenButton" position="391, parent.height - 30, this.left + 208, this.top + 22"
373 text="Save And Open in" createCallback="1" radioGroup="0" connectedLeft="0"
374 connectedRight="0" connectedTop="0" connectedBottom="0"/>
381 JUCER_COMPONENT_METADATA_END