@@ -31,9 +31,10 @@ | |||
SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* document_, | |||
CodeDocument& codeDocument, | |||
CodeTokeniser* const codeTokeniser) | |||
: DocumentEditorComponent (document_) | |||
: DocumentEditorComponent (document_), | |||
editor (codeDocument, codeTokeniser) | |||
{ | |||
addAndMakeVisible (editor = new CodeEditorComponent (codeDocument, codeTokeniser)); | |||
addAndMakeVisible (&editor); | |||
#if JUCE_MAC | |||
Font font (10.6f); | |||
@@ -42,17 +43,16 @@ SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* document_, | |||
Font font (10.0f); | |||
font.setTypefaceName (Font::getDefaultMonospacedFontName()); | |||
#endif | |||
editor->setFont (font); | |||
editor.setFont (font); | |||
} | |||
SourceCodeEditor::~SourceCodeEditor() | |||
{ | |||
deleteAllChildren(); | |||
} | |||
void SourceCodeEditor::resized() | |||
{ | |||
editor->setBounds (0, 0, getWidth(), getHeight()); | |||
editor.setBounds (0, 0, getWidth(), getHeight()); | |||
} | |||
bool SourceCodeEditor::isTextFile (const File& file) | |||
@@ -52,7 +52,7 @@ public: | |||
juce_UseDebuggingNewOperator | |||
private: | |||
CodeEditorComponent* editor; | |||
CodeEditorComponent editor; | |||
}; | |||
@@ -30,21 +30,21 @@ | |||
GroupInformationComponent::GroupInformationComponent (const Project::Item& item_) | |||
: item (item_) | |||
{ | |||
addAndMakeVisible (list = new ListBox (String::empty, this)); | |||
list->updateContent(); | |||
list->setRowHeight (20); | |||
list.setModel (this); | |||
addAndMakeVisible (&list); | |||
list.updateContent(); | |||
list.setRowHeight (20); | |||
item.getNode().addListener (this); | |||
} | |||
GroupInformationComponent::~GroupInformationComponent() | |||
{ | |||
item.getNode().removeListener (this); | |||
deleteAllChildren(); | |||
} | |||
void GroupInformationComponent::resized() | |||
{ | |||
list->setSize (getWidth(), getHeight()); | |||
list.setSize (getWidth(), getHeight()); | |||
} | |||
int GroupInformationComponent::getNumRows() | |||
@@ -59,17 +59,17 @@ void GroupInformationComponent::paintListBoxItem (int rowNumber, Graphics& g, in | |||
//============================================================================== | |||
void GroupInformationComponent::valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property) | |||
{ | |||
list->updateContent(); | |||
list.updateContent(); | |||
} | |||
void GroupInformationComponent::valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) | |||
{ | |||
list->updateContent(); | |||
list.updateContent(); | |||
} | |||
void GroupInformationComponent::valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) | |||
{ | |||
list->updateContent(); | |||
list.updateContent(); | |||
} | |||
//============================================================================== | |||
@@ -77,23 +77,20 @@ class FileOptionComponent : public Component | |||
{ | |||
public: | |||
FileOptionComponent (const Project::Item& item_) | |||
: item (item_), compileButton (0), resourceButton (0) | |||
: item (item_), | |||
compileButton ("Compile"), | |||
resourceButton ("Add to Binary Resources") | |||
{ | |||
if (item.isFile()) | |||
{ | |||
addAndMakeVisible (compileButton = new ToggleButton ("Compile")); | |||
compileButton->getToggleStateValue().referTo (item.getShouldCompileValue()); | |||
addAndMakeVisible (&compileButton); | |||
compileButton.getToggleStateValue().referTo (item.getShouldCompileValue()); | |||
addAndMakeVisible (resourceButton = new ToggleButton ("Add to Binary Resources")); | |||
resourceButton->getToggleStateValue().referTo (item.getShouldAddToResourceValue()); | |||
addAndMakeVisible (&resourceButton); | |||
resourceButton.getToggleStateValue().referTo (item.getShouldAddToResourceValue()); | |||
} | |||
} | |||
~FileOptionComponent() | |||
{ | |||
deleteAllChildren(); | |||
} | |||
void paint (Graphics& g) | |||
{ | |||
int x = getHeight() + 6; | |||
@@ -104,8 +101,8 @@ public: | |||
g.setColour (Colours::black); | |||
g.setFont (getHeight() * 0.6f); | |||
const int x2 = compileButton == 0 ? getWidth() - 4 | |||
: compileButton->getX() - 4; | |||
const int x2 = compileButton.isVisible() ? compileButton.getX() - 4 | |||
: getWidth() - 4; | |||
g.drawText (item.getName().toString(), x, 0, x2 - x, getHeight(), Justification::centredLeft, true); | |||
@@ -115,20 +112,16 @@ public: | |||
void resized() | |||
{ | |||
if (resourceButton != 0) | |||
{ | |||
int w = 180; | |||
resourceButton->setBounds (getWidth() - w, 1, w, getHeight() - 2); | |||
w = 100; | |||
compileButton->setBounds (resourceButton->getX() - w, 1, w, getHeight() - 2); | |||
} | |||
int w = 180; | |||
resourceButton.setBounds (getWidth() - w, 1, w, getHeight() - 2); | |||
w = 100; | |||
compileButton.setBounds (resourceButton.getX() - w, 1, w, getHeight() - 2); | |||
} | |||
Project::Item item; | |||
private: | |||
ToggleButton* compileButton; | |||
ToggleButton* resourceButton; | |||
ToggleButton compileButton, resourceButton; | |||
}; | |||
Component* GroupInformationComponent::refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate) | |||
@@ -57,7 +57,7 @@ public: | |||
private: | |||
Project::Item item; | |||
ListBox* list; | |||
ListBox list; | |||
//============================================================================== | |||
GroupInformationComponent (const GroupInformationComponent&); | |||
@@ -41,7 +41,7 @@ public: | |||
void rebuildProperties() | |||
{ | |||
getPanel()->clear(); | |||
getPanel().clear(); | |||
Array <PropertyComponent*> props; | |||
if (tabIndex == 0) | |||
@@ -90,7 +90,7 @@ public: | |||
props.getUnchecked(i)->setPreferredHeight (22); | |||
} | |||
getPanel()->addProperties (props); | |||
getPanel().addProperties (props); | |||
} | |||
void visibilityChanged() | |||
@@ -219,13 +219,12 @@ int indexOfLineStartingWith (const StringArray& lines, const String& text, int s | |||
PropertyPanelWithTooltips::PropertyPanelWithTooltips() | |||
: lastComp (0) | |||
{ | |||
addAndMakeVisible (panel = new PropertyPanel()); | |||
addAndMakeVisible (&panel); | |||
startTimer (150); | |||
} | |||
PropertyPanelWithTooltips::~PropertyPanelWithTooltips() | |||
{ | |||
deleteAllChildren(); | |||
} | |||
void PropertyPanelWithTooltips::paint (Graphics& g) | |||
@@ -239,14 +238,14 @@ void PropertyPanelWithTooltips::paint (Graphics& g) | |||
if (tl.getNumLines() > 3) | |||
tl.layout (getWidth() - 10, Justification::left, false); // too big, so just squash it in.. | |||
tl.drawWithin (g, 5, panel->getBottom() + 2, getWidth() - 10, | |||
getHeight() - panel->getBottom() - 4, | |||
tl.drawWithin (g, 5, panel.getBottom() + 2, getWidth() - 10, | |||
getHeight() - panel.getBottom() - 4, | |||
Justification::centredLeft); | |||
} | |||
void PropertyPanelWithTooltips::resized() | |||
{ | |||
panel->setBounds (0, 0, getWidth(), jmax (getHeight() - 60, proportionOfHeight (0.6f))); | |||
panel.setBounds (0, 0, getWidth(), jmax (getHeight() - 60, proportionOfHeight (0.6f))); | |||
} | |||
void PropertyPanelWithTooltips::timerCallback() | |||
@@ -265,7 +264,7 @@ void PropertyPanelWithTooltips::timerCallback() | |||
if (newTip != lastTip) | |||
{ | |||
lastTip = newTip; | |||
repaint (0, panel->getBottom(), getWidth(), getHeight()); | |||
repaint (0, panel.getBottom(), getWidth(), getHeight()); | |||
} | |||
} | |||
} | |||
@@ -54,14 +54,14 @@ public: | |||
PropertyPanelWithTooltips(); | |||
~PropertyPanelWithTooltips(); | |||
PropertyPanel* getPanel() const { return panel; } | |||
PropertyPanel& getPanel() throw() { return panel; } | |||
void paint (Graphics& g); | |||
void resized(); | |||
void timerCallback(); | |||
private: | |||
PropertyPanel* panel; | |||
PropertyPanel panel; | |||
TextLayout layout; | |||
Component* lastComp; | |||
String lastTip; | |||
@@ -108,6 +108,7 @@ namespace Ids | |||
DECLARE_ID (url); | |||
DECLARE_ID (rootItemVisible); | |||
DECLARE_ID (openByDefault); | |||
DECLARE_ID (locked); | |||
const Identifier class_ ("class"); | |||
const Identifier id_ ("id"); | |||