Browse Source

Minor Jucer tweaks.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
cc5e15b37d
8 changed files with 39 additions and 46 deletions
  1. +5
    -5
      extras/Jucer (experimental)/Source/Code Editor/jucer_SourceCodeEditor.cpp
  2. +1
    -1
      extras/Jucer (experimental)/Source/Code Editor/jucer_SourceCodeEditor.h
  3. +22
    -29
      extras/Jucer (experimental)/Source/Project/jucer_GroupInformationComponent.cpp
  4. +1
    -1
      extras/Jucer (experimental)/Source/Project/jucer_GroupInformationComponent.h
  5. +2
    -2
      extras/Jucer (experimental)/Source/Project/jucer_ProjectInformationComponent.cpp
  6. +5
    -6
      extras/Jucer (experimental)/Source/Utility/jucer_MiscUtilities.cpp
  7. +2
    -2
      extras/Jucer (experimental)/Source/Utility/jucer_MiscUtilities.h
  8. +1
    -0
      extras/Jucer (experimental)/Source/Utility/jucer_PresetIDs.h

+ 5
- 5
extras/Jucer (experimental)/Source/Code Editor/jucer_SourceCodeEditor.cpp View File

@@ -31,9 +31,10 @@
SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* document_, SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* document_,
CodeDocument& codeDocument, CodeDocument& codeDocument,
CodeTokeniser* const codeTokeniser) CodeTokeniser* const codeTokeniser)
: DocumentEditorComponent (document_)
: DocumentEditorComponent (document_),
editor (codeDocument, codeTokeniser)
{ {
addAndMakeVisible (editor = new CodeEditorComponent (codeDocument, codeTokeniser));
addAndMakeVisible (&editor);
#if JUCE_MAC #if JUCE_MAC
Font font (10.6f); Font font (10.6f);
@@ -42,17 +43,16 @@ SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* document_,
Font font (10.0f); Font font (10.0f);
font.setTypefaceName (Font::getDefaultMonospacedFontName()); font.setTypefaceName (Font::getDefaultMonospacedFontName());
#endif #endif
editor->setFont (font);
editor.setFont (font);
} }
SourceCodeEditor::~SourceCodeEditor() SourceCodeEditor::~SourceCodeEditor()
{ {
deleteAllChildren();
} }
void SourceCodeEditor::resized() void SourceCodeEditor::resized()
{ {
editor->setBounds (0, 0, getWidth(), getHeight());
editor.setBounds (0, 0, getWidth(), getHeight());
} }
bool SourceCodeEditor::isTextFile (const File& file) bool SourceCodeEditor::isTextFile (const File& file)


+ 1
- 1
extras/Jucer (experimental)/Source/Code Editor/jucer_SourceCodeEditor.h View File

@@ -52,7 +52,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
private: private:
CodeEditorComponent* editor;
CodeEditorComponent editor;
}; };


+ 22
- 29
extras/Jucer (experimental)/Source/Project/jucer_GroupInformationComponent.cpp View File

@@ -30,21 +30,21 @@
GroupInformationComponent::GroupInformationComponent (const Project::Item& item_) GroupInformationComponent::GroupInformationComponent (const Project::Item& item_)
: 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); item.getNode().addListener (this);
} }
GroupInformationComponent::~GroupInformationComponent() GroupInformationComponent::~GroupInformationComponent()
{ {
item.getNode().removeListener (this); item.getNode().removeListener (this);
deleteAllChildren();
} }
void GroupInformationComponent::resized() void GroupInformationComponent::resized()
{ {
list->setSize (getWidth(), getHeight());
list.setSize (getWidth(), getHeight());
} }
int GroupInformationComponent::getNumRows() int GroupInformationComponent::getNumRows()
@@ -59,17 +59,17 @@ void GroupInformationComponent::paintListBoxItem (int rowNumber, Graphics& g, in
//============================================================================== //==============================================================================
void GroupInformationComponent::valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property) void GroupInformationComponent::valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property)
{ {
list->updateContent();
list.updateContent();
} }
void GroupInformationComponent::valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) void GroupInformationComponent::valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged)
{ {
list->updateContent();
list.updateContent();
} }
void GroupInformationComponent::valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) void GroupInformationComponent::valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged)
{ {
list->updateContent();
list.updateContent();
} }
//============================================================================== //==============================================================================
@@ -77,23 +77,20 @@ class FileOptionComponent : public Component
{ {
public: public:
FileOptionComponent (const Project::Item& item_) FileOptionComponent (const Project::Item& item_)
: item (item_), compileButton (0), resourceButton (0)
: item (item_),
compileButton ("Compile"),
resourceButton ("Add to Binary Resources")
{ {
if (item.isFile()) 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) void paint (Graphics& g)
{ {
int x = getHeight() + 6; int x = getHeight() + 6;
@@ -104,8 +101,8 @@ public:
g.setColour (Colours::black); g.setColour (Colours::black);
g.setFont (getHeight() * 0.6f); 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); g.drawText (item.getName().toString(), x, 0, x2 - x, getHeight(), Justification::centredLeft, true);
@@ -115,20 +112,16 @@ public:
void resized() 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; Project::Item item;
private: private:
ToggleButton* compileButton;
ToggleButton* resourceButton;
ToggleButton compileButton, resourceButton;
}; };
Component* GroupInformationComponent::refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate) Component* GroupInformationComponent::refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate)


+ 1
- 1
extras/Jucer (experimental)/Source/Project/jucer_GroupInformationComponent.h View File

@@ -57,7 +57,7 @@ public:
private: private:
Project::Item item; Project::Item item;
ListBox* list;
ListBox list;
//============================================================================== //==============================================================================
GroupInformationComponent (const GroupInformationComponent&); GroupInformationComponent (const GroupInformationComponent&);


+ 2
- 2
extras/Jucer (experimental)/Source/Project/jucer_ProjectInformationComponent.cpp View File

@@ -41,7 +41,7 @@ public:
void rebuildProperties() void rebuildProperties()
{ {
getPanel()->clear();
getPanel().clear();
Array <PropertyComponent*> props; Array <PropertyComponent*> props;
if (tabIndex == 0) if (tabIndex == 0)
@@ -90,7 +90,7 @@ public:
props.getUnchecked(i)->setPreferredHeight (22); props.getUnchecked(i)->setPreferredHeight (22);
} }
getPanel()->addProperties (props);
getPanel().addProperties (props);
} }
void visibilityChanged() void visibilityChanged()


+ 5
- 6
extras/Jucer (experimental)/Source/Utility/jucer_MiscUtilities.cpp View File

@@ -219,13 +219,12 @@ int indexOfLineStartingWith (const StringArray& lines, const String& text, int s
PropertyPanelWithTooltips::PropertyPanelWithTooltips() PropertyPanelWithTooltips::PropertyPanelWithTooltips()
: lastComp (0) : lastComp (0)
{ {
addAndMakeVisible (panel = new PropertyPanel());
addAndMakeVisible (&panel);
startTimer (150); startTimer (150);
} }
PropertyPanelWithTooltips::~PropertyPanelWithTooltips() PropertyPanelWithTooltips::~PropertyPanelWithTooltips()
{ {
deleteAllChildren();
} }
void PropertyPanelWithTooltips::paint (Graphics& g) void PropertyPanelWithTooltips::paint (Graphics& g)
@@ -239,14 +238,14 @@ void PropertyPanelWithTooltips::paint (Graphics& g)
if (tl.getNumLines() > 3) if (tl.getNumLines() > 3)
tl.layout (getWidth() - 10, Justification::left, false); // too big, so just squash it in.. 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); Justification::centredLeft);
} }
void PropertyPanelWithTooltips::resized() 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() void PropertyPanelWithTooltips::timerCallback()
@@ -265,7 +264,7 @@ void PropertyPanelWithTooltips::timerCallback()
if (newTip != lastTip) if (newTip != lastTip)
{ {
lastTip = newTip; lastTip = newTip;
repaint (0, panel->getBottom(), getWidth(), getHeight());
repaint (0, panel.getBottom(), getWidth(), getHeight());
} }
} }
} }


+ 2
- 2
extras/Jucer (experimental)/Source/Utility/jucer_MiscUtilities.h View File

@@ -54,14 +54,14 @@ public:
PropertyPanelWithTooltips(); PropertyPanelWithTooltips();
~PropertyPanelWithTooltips(); ~PropertyPanelWithTooltips();
PropertyPanel* getPanel() const { return panel; }
PropertyPanel& getPanel() throw() { return panel; }
void paint (Graphics& g); void paint (Graphics& g);
void resized(); void resized();
void timerCallback(); void timerCallback();
private: private:
PropertyPanel* panel;
PropertyPanel panel;
TextLayout layout; TextLayout layout;
Component* lastComp; Component* lastComp;
String lastTip; String lastTip;


+ 1
- 0
extras/Jucer (experimental)/Source/Utility/jucer_PresetIDs.h View File

@@ -108,6 +108,7 @@ namespace Ids
DECLARE_ID (url); DECLARE_ID (url);
DECLARE_ID (rootItemVisible); DECLARE_ID (rootItemVisible);
DECLARE_ID (openByDefault); DECLARE_ID (openByDefault);
DECLARE_ID (locked);
const Identifier class_ ("class"); const Identifier class_ ("class");
const Identifier id_ ("id"); const Identifier id_ ("id");


Loading…
Cancel
Save