Browse Source

Minor introjucer work. Minor fix for binarybuilder.

tags/2021-05-28
jules 13 years ago
parent
commit
a0a500ee4b
6 changed files with 64 additions and 134 deletions
  1. +16
    -92
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp
  2. +4
    -9
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.h
  3. +24
    -23
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp
  4. +17
    -9
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.h
  5. +2
    -0
      extras/Introjucer/Source/Utility/jucer_PresetIDs.h
  6. +1
    -1
      extras/binarybuilder/Source/Main.cpp

+ 16
- 92
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp View File

@@ -722,78 +722,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectSettingsComponent);
};
//==============================================================================
class ProjectInformationComponent::RolloverHelpComp : public Component,
private Timer
{
public:
RolloverHelpComp()
: lastComp (nullptr)
{
startTimer (150);
}
void paint (Graphics& g)
{
AttributedString s;
s.setJustification (Justification::centredLeft);
s.append (lastTip, Font (14.0f), Colour::greyLevel (0.15f));
TextLayout tl;
tl.createLayoutWithBalancedLineLengths (s, getWidth() - 10.0f);
if (tl.getNumLines() > 3)
tl.createLayout (s, getWidth() - 10.0f);
tl.draw (g, getLocalBounds().toFloat());
}
void timerCallback()
{
Component* newComp = Desktop::getInstance().getMainMouseSource().getComponentUnderMouse();
if (newComp != nullptr
&& (newComp->getTopLevelComponent() != getTopLevelComponent()
|| newComp->isCurrentlyBlockedByAnotherModalComponent()))
newComp = nullptr;
if (newComp != lastComp)
{
lastComp = newComp;
String newTip (findTip (newComp));
if (newTip != lastTip)
{
lastTip = newTip;
repaint();
}
}
}
private:
static String findTip (Component* c)
{
while (c != nullptr)
{
TooltipClient* const tc = dynamic_cast <TooltipClient*> (c);
if (tc != nullptr)
{
const String tip (tc->getTooltip());
if (tip.isNotEmpty())
return tip;
}
c = c->getParentComponent();
}
return String::empty;
}
Component* lastComp;
String lastTip;
};
//[/MiscUserDefs]
//==============================================================================
@@ -802,13 +730,13 @@ ProjectInformationComponent::ProjectInformationComponent (Project& project_)
{
//[Constructor_pre]
//[/Constructor_pre]
addChildAndSetID (&viewport, "ykdBpb");
addChildAndSetID (&openProjectButton, "a550a652e2666ee7");
addChildAndSetID (&saveAndOpenButton, "dRGMyYx");
addChildAndSetID (rollover = new RolloverHelpComp(), "QqLJBF");
addChildAndSetID (&rollover, "QqLJBF");
initialiseComponentState();
openProjectButton.addListener (this);
saveAndOpenButton.addListener (this);
@@ -836,12 +764,8 @@ ProjectInformationComponent::ProjectInformationComponent (Project& project_)
ProjectInformationComponent::~ProjectInformationComponent()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[Destructor]
project.removeChangeListener (this);
//[/Destructor_pre]
rollover = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
@@ -868,7 +792,7 @@ void ProjectInformationComponent::buttonClicked (Button* buttonThatWasClicked)
void ProjectInformationComponent::paint (Graphics& g)
{
//[UserPaint] Add your own custom painting code here..
//[UserPaint]
g.setTiledImageFill (ImageCache::getFromMemory (BinaryData::brushed_aluminium_png, BinaryData::brushed_aluminium_pngSize),
0, 0, 1.0f);
g.fillAll();
@@ -876,13 +800,6 @@ void ProjectInformationComponent::paint (Graphics& g)
//[/UserPaint]
}
void ProjectInformationComponent::initialiseComponentState()
{
BinaryData::ImageProvider imageProvider;
ComponentBuilder::initialiseFromValueTree (*this, getComponentState(), &imageProvider);
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void ProjectInformationComponent::changeListenerCallback (ChangeBroadcaster*)
{
@@ -890,7 +807,6 @@ void ProjectInformationComponent::changeListenerCallback (ChangeBroadcaster*)
}
//[/MiscUserCode]
//==============================================================================
//======================= Jucer Information Section ==========================
//==============================================================================
@@ -913,19 +829,27 @@ JUCER_COMPONENT_METADATA_START
text="Save And Open in" createCallback="1" radioGroup="0" connectedLeft="0"
connectedRight="0" connectedTop="0" connectedBottom="0" backgroundColour="FFDDDDFF"/>
<GENERICCOMPONENT id="QqLJBF" memberName="rollover" position="246, parent.height - 68, parent.width - 8, parent.height - 4"
class="RolloverHelpComp"/>
class="RolloverHelpComp" canBeAggregated="1" constructorParams=""/>
</COMPONENTS>
<MARKERS_X/>
<MARKERS_Y/>
<METHODS/>
<METHODS paint="1"/>
</COMPONENT>
JUCER_COMPONENT_METADATA_END
*/
#endif
void ProjectInformationComponent::initialiseComponentState()
{
BinaryData::ImageProvider imageProvider;
ComponentBuilder::initialiseFromValueTree (*this, getComponentState(), &imageProvider);
}
ValueTree ProjectInformationComponent::getComponentState()
{
const unsigned char data[] =
"COMPONENT\0\x01\x08id\0\x01\t\x05tO9EG1a\0""className\0\x01\x1d\x05ProjectInformationComponent\0width\0\x01\x05\x05""808\0height\0\x01\x05\x05""638\0""background\0\x01\x08\x05""f6f9ff\0parentClasses\0\x01)\x05public Component, public ChangeListener\0"
"constructorParams\0\x01\x13\x05Project& project_\0memberInitialisers\0\x01\x14\x05project (project_)\0\x01\x04""COMPONENTS\0\0\x01\x04VIEWPORT\0\x01\x06id\0\x01\x08\x05ykdBpb\0memberName\0\x01\n\x05viewport\0position\0\x01,\x05""8, 8, parent.width - "
@@ -933,8 +857,8 @@ ValueTree ProjectInformationComponent::getComponentState()
"t\0\x01\x12\x05Open Project in \0""createCallback\0\x01\x03\x05""1\0radioGroup\0\x01\x03\x05""0\0""connectedLeft\0\x01\x03\x05""0\0""connectedRight\0\x01\x03\x05""0\0""connectedTop\0\x01\x03\x05""0\0""connectedBottom\0\x01\x03\x05""0\0""backgroundCol"
"our\0\x01\n\x05""FFDDDDFF\0textColour\0\x01\x02\x05\0""backgroundColourOn\0\x01\x02\x05\0textColourOn\0\x01\x02\x05\0position\0\x01-\x05""8, parent.height - 34, left + 227, top + 24\0\0TEXTBUTTON\0\x01\x0cid\0\x01\t\x05""dRGMyYx\0name\0\x01\x02\x05\0"
"memberName\0\x01\x13\x05saveAndOpenButton\0position\0\x01-\x05""8, parent.height - 65, left + 227, top + 24\0text\0\x01\x12\x05Save And Open in\0""createCallback\0\x01\x03\x05""1\0radioGroup\0\x01\x03\x05""0\0""connectedLeft\0\x01\x03\x05""0\0""conne"
"ctedRight\0\x01\x03\x05""0\0""connectedTop\0\x01\x03\x05""0\0""connectedBottom\0\x01\x03\x05""0\0""backgroundColour\0\x01\n\x05""FFDDDDFF\0\0GENERICCOMPONENT\0\x01\x04id\0\x01\x08\x05QqLJBF\0memberName\0\x01\n\x05rollover\0position\0\x01>\x05""246, p"
"arent.height - 68, parent.width - 8, parent.height - 4\0""class\0\x01\x12\x05RolloverHelpComp\0\0MARKERS_X\0\0\0MARKERS_Y\0\0\0METHODS\0\0\0";
"ctedRight\0\x01\x03\x05""0\0""connectedTop\0\x01\x03\x05""0\0""connectedBottom\0\x01\x03\x05""0\0""backgroundColour\0\x01\n\x05""FFDDDDFF\0\0GENERICCOMPONENT\0\x01\x06id\0\x01\x08\x05QqLJBF\0memberName\0\x01\n\x05rollover\0position\0\x01>\x05""246, p"
"arent.height - 68, parent.width - 8, parent.height - 4\0""class\0\x01\x12\x05RolloverHelpComp\0""canBeAggregated\0\x01\x03\x05""1\0""constructorParams\0\x01\x02\x05\0\0MARKERS_X\0\0\0MARKERS_Y\0\0\0METHODS\0\x01\x01paint\0\x01\x03\x05""1\0\0";
return ValueTree::readFromData (data, sizeof (data));
}

+ 4
- 9
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.h View File

@@ -41,35 +41,30 @@ public:
~ProjectInformationComponent();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
//[UserMethods]
void changeListenerCallback (ChangeBroadcaster*);
//[/UserMethods]
void buttonClicked (Button* buttonThatWasClicked);
void paint (Graphics& g);
private:
//==============================================================================
//[UserVariables] -- You can add your own custom variables in this section.
//[UserVariables]
Project& project;
class RolloverHelpComp;
//[/UserVariables]
//==============================================================================
Viewport viewport;
TextButton openProjectButton;
TextButton saveAndOpenButton;
ScopedPointer<RolloverHelpComp> rollover;
RolloverHelpComp rollover;
void initialiseComponentState();
static ValueTree getComponentState();
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectInformationComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectInformationComponent)
};
#endif // __JUCER_PROJECTINFORMATIONCOMPONENT_H_30FFCD07__

+ 24
- 23
extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp View File

@@ -218,18 +218,14 @@ int indexOfLineStartingWith (const StringArray& lines, const String& text, int s
//==============================================================================
PropertyPanelWithTooltips::PropertyPanelWithTooltips()
RolloverHelpComp::RolloverHelpComp()
: lastComp (nullptr)
{
addAndMakeVisible (&panel);
setInterceptsMouseClicks (false, false);
startTimer (150);
}
PropertyPanelWithTooltips::~PropertyPanelWithTooltips()
{
}
void PropertyPanelWithTooltips::paint (Graphics& g)
void RolloverHelpComp::paint (Graphics& g)
{
AttributedString s;
s.setJustification (Justification::centredLeft);
@@ -243,22 +239,13 @@ void PropertyPanelWithTooltips::paint (Graphics& g)
tl.draw (g, getLocalBounds().toFloat());
}
void PropertyPanelWithTooltips::resized()
{
panel.setBounds (0, 0, getWidth(), jmax (getHeight() - 60, proportionOfHeight (0.6f)));
}
Rectangle<int> PropertyPanelWithTooltips::getTipArea() const
{
return Rectangle<int> (5, panel.getBottom() - 50, getWidth() - 10,
getHeight() - (panel.getBottom() - 50) - 4);
}
void PropertyPanelWithTooltips::timerCallback()
void RolloverHelpComp::timerCallback()
{
Component* newComp = Desktop::getInstance().getMainMouseSource().getComponentUnderMouse();
if (newComp != nullptr && newComp->getTopLevelComponent() != getTopLevelComponent())
if (newComp != nullptr
&& (newComp->getTopLevelComponent() != getTopLevelComponent()
|| newComp->isCurrentlyBlockedByAnotherModalComponent()))
newComp = nullptr;
if (newComp != lastComp)
@@ -270,14 +257,14 @@ void PropertyPanelWithTooltips::timerCallback()
if (newTip != lastTip)
{
lastTip = newTip;
repaint (getTipArea());
repaint();
}
}
}
String PropertyPanelWithTooltips::findTip (Component* c)
String RolloverHelpComp::findTip (Component* c)
{
while (c != nullptr && c != this)
while (c != nullptr)
{
TooltipClient* const tc = dynamic_cast <TooltipClient*> (c);
if (tc != nullptr)
@@ -294,6 +281,20 @@ String PropertyPanelWithTooltips::findTip (Component* c)
return String::empty;
}
//==============================================================================
PropertyPanelWithTooltips::PropertyPanelWithTooltips()
{
addAndMakeVisible (&panel);
addAndMakeVisible (&rollover);
}
void PropertyPanelWithTooltips::resized()
{
panel.setBounds (0, 0, getWidth(), jmax (getHeight() - 60, proportionOfHeight (0.6f)));
rollover.setBounds (3, panel.getBottom() - 50, getWidth() - 6,
getHeight() - (panel.getBottom() - 50) - 4);
}
//==============================================================================
FloatingLabelComponent::FloatingLabelComponent()
: font (10.0f)


+ 17
- 9
extras/Introjucer/Source/Utility/jucer_MiscUtilities.h View File

@@ -49,26 +49,34 @@ void showUTF8ToolWindow();
// Start a callout modally, which will delete the content comp when it's dismissed.
void launchAsyncCallOutBox (Component& attachTo, Component* content);
//==============================================================================
class PropertyPanelWithTooltips : public Component,
public Timer
class RolloverHelpComp : public Component,
private Timer
{
public:
PropertyPanelWithTooltips();
~PropertyPanelWithTooltips();
RolloverHelpComp();
void paint (Graphics& g);
void resized();
void timerCallback();
PropertyPanel panel;
private:
static String findTip (Component*);
Component* lastComp;
String lastTip;
};
Rectangle<int> getTipArea() const;
String findTip (Component* c);
//==============================================================================
class PropertyPanelWithTooltips : public Component
{
public:
PropertyPanelWithTooltips();
void resized();
PropertyPanel panel;
RolloverHelpComp rollover;
};
//==============================================================================


+ 2
- 0
extras/Introjucer/Source/Utility/jucer_PresetIDs.h View File

@@ -76,7 +76,9 @@ namespace Ids
DECLARE_ID (createCallback);
DECLARE_ID (parentClasses);
DECLARE_ID (constructorParams);
DECLARE_ID (objectConstructionArgs);
DECLARE_ID (memberInitialisers);
DECLARE_ID (canBeAggregated);
DECLARE_ID (rootItemVisible);
DECLARE_ID (openByDefault);
DECLARE_ID (locked);


+ 1
- 1
extras/binarybuilder/Source/Main.cpp View File

@@ -187,7 +187,7 @@ int main (int argc, char* argv[])
}
}
*header << "};\r\n\r\n"
*header << "}\r\n\r\n"
"#endif\r\n";
header = 0;


Loading…
Cancel
Save