Browse Source

Revamped the introjucer's settings page, making it easier to navigate than the old tabbed layout. Also, tweaked Viewport to be more resilient to changes in its content's size.

tags/2021-05-28
jules 14 years ago
parent
commit
84d438aebc
13 changed files with 716 additions and 557 deletions
  1. +2
    -2
      extras/Introjucer/Builds/Linux/Makefile
  2. +1
    -1
      extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp
  3. +1
    -1
      extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.h
  4. +1
    -1
      extras/Introjucer/Source/BinaryData/jucer_MainConsoleAppTemplate.cpp
  5. +1
    -1
      extras/Introjucer/Source/BinaryData/jucer_WindowTemplate.cpp
  6. +1
    -1
      extras/Introjucer/Source/BinaryData/jucer_WindowTemplate.h
  7. +0
    -14
      extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h
  8. +642
    -459
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp
  9. +12
    -16
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.h
  10. +18
    -36
      modules/juce_graphics/geometry/juce_RectangleList.cpp
  11. +34
    -22
      modules/juce_gui_basics/layout/juce_Viewport.cpp
  12. +1
    -1
      modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp
  13. +2
    -2
      modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp

+ 2
- 2
extras/Introjucer/Builds/Linux/Makefile View File

@@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug)
CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode" CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode"
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0
CXXFLAGS += $(CFLAGS) CXXFLAGS += $(CFLAGS)
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L"/usr/X11R6/lib/" -L"../../../../../juce/bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L"/usr/X11R6/lib/" -L"../../../../../juce/bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext
LDDEPS := LDDEPS :=
RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode" RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode"
TARGET := Introjucer TARGET := Introjucer
@@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release)
CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode" CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode"
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O3 CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O3
CXXFLAGS += $(CFLAGS) CXXFLAGS += $(CFLAGS)
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L"/usr/X11R6/lib/" -L"../../../../../juce/bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L"/usr/X11R6/lib/" -L"../../../../../juce/bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext
LDDEPS := LDDEPS :=
RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode" RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../JuceLibraryCode"
TARGET := Introjucer TARGET := Introjucer


+ 1
- 1
extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp View File

@@ -1,7 +1,7 @@
/* /*
============================================================================== ==============================================================================
This file was auto-generated by the Jucer!
This file was auto-generated!
It contains the basic startup code for a Juce application. It contains the basic startup code for a Juce application.


+ 1
- 1
extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.h View File

@@ -1,7 +1,7 @@
/* /*
============================================================================== ==============================================================================
This file was auto-generated by the Jucer!
This file was auto-generated!
It contains the basic startup code for a Juce application. It contains the basic startup code for a Juce application.


+ 1
- 1
extras/Introjucer/Source/BinaryData/jucer_MainConsoleAppTemplate.cpp View File

@@ -1,7 +1,7 @@
/* /*
============================================================================== ==============================================================================
This file was auto-generated by the Jucer!
This file was auto-generated!
It contains the basic startup code for a Juce application. It contains the basic startup code for a Juce application.


+ 1
- 1
extras/Introjucer/Source/BinaryData/jucer_WindowTemplate.cpp View File

@@ -1,7 +1,7 @@
/* /*
============================================================================== ==============================================================================
This file was auto-generated by the Jucer!
This file was auto-generated!
It contains the basic outline for a simple desktop window. It contains the basic outline for a simple desktop window.


+ 1
- 1
extras/Introjucer/Source/BinaryData/jucer_WindowTemplate.h View File

@@ -1,7 +1,7 @@
/* /*
============================================================================== ==============================================================================
This file was auto-generated by the Jucer!
This file was auto-generated!
It contains the basic outline for a simple desktop window. It contains the basic outline for a simple desktop window.


+ 0
- 14
extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h View File

@@ -213,20 +213,6 @@ private:
if (xml != nullptr) if (xml != nullptr)
{ {
#if JUCE_DEBUG
{
MemoryOutputStream mo;
project.getProjectRoot().writeToStream (mo);
MemoryInputStream mi (mo.getData(), mo.getDataSize(), false);
ValueTree v = ValueTree::readFromStream (mi);
ScopedPointer <XmlElement> xml2 (v.createXml());
// This bit just tests that ValueTree save/load works reliably.. Let me know if this asserts for you!
jassert (xml->isEquivalentTo (xml2, true));
}
#endif
MemoryOutputStream mo; MemoryOutputStream mo;
xml->writeToStream (mo, String::empty); xml->writeToStream (mo, String::empty);
replaceFileIfDifferent (projectFile, mo); replaceFileIfDifferent (projectFile, mo);


+ 642
- 459
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp
File diff suppressed because it is too large
View File


+ 12
- 16
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.h View File

@@ -1,23 +1,23 @@
/* /*
============================================================================== ==============================================================================
This is an automatically generated file created by the Jucer!
This is an automatically generated file!
Be careful when adding custom code to these files, as only the code within Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved. and re-saved.
Created for JUCE version: JUCE v1.53.8
Created for JUCE version: JUCE v2.0.9
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd.
JUCE is copyright 2004-11 by Raw Material Software ltd.
============================================================================== ==============================================================================
*/ */
#ifndef __JUCER_PROJECTINFORMATIONCOMPONENT_H_2F89B0AC__
#define __JUCER_PROJECTINFORMATIONCOMPONENT_H_2F89B0AC__
#ifndef __JUCER_PROJECTINFORMATIONCOMPONENT_H_30FFCD07__
#define __JUCER_PROJECTINFORMATIONCOMPONENT_H_30FFCD07__
//[Headers] -- You can add your own extra header files here -- //[Headers] -- You can add your own extra header files here --
#include "jucer_Project.h" #include "jucer_Project.h"
@@ -33,7 +33,7 @@
*/ */
class ProjectInformationComponent : public Component, class ProjectInformationComponent : public Component,
public ChangeListener, public ChangeListener,
public ButtonListener
public Button::Listener
{ {
public: public:
//============================================================================== //==============================================================================
@@ -43,7 +43,6 @@ public:
//============================================================================== //==============================================================================
//[UserMethods] -- You can add your own custom methods in this section. //[UserMethods] -- You can add your own custom methods in this section.
void changeListenerCallback (ChangeBroadcaster*); void changeListenerCallback (ChangeBroadcaster*);
void rebuildConfigTabs();
//[/UserMethods] //[/UserMethods]
void resized(); void resized();
@@ -51,27 +50,24 @@ public:
void paint (Graphics& g); void paint (Graphics& g);
private: private:
//============================================================================== //==============================================================================
//[UserVariables] -- You can add your own custom variables in this section. //[UserVariables] -- You can add your own custom variables in this section.
Project& project; Project& project;
var lastProjectType;
void updateConfigTabs();
void showConfigMenu();
void showExporterMenu();
class RolloverHelpComp;
//[/UserVariables] //[/UserVariables]
//============================================================================== //==============================================================================
TabbedComponent configTabBox;
TextButton editConfigsButton;
Viewport viewport;
TextButton openProjectButton; TextButton openProjectButton;
TextButton editExportersButton;
TextButton saveAndOpenButton; TextButton saveAndOpenButton;
ScopedPointer<RolloverHelpComp> rollover;
//============================================================================== //==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectInformationComponent); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectInformationComponent);
}; };
#endif // __JUCER_PROJECTINFORMATIONCOMPONENT_H_2F89B0AC__
#endif // __JUCER_PROJECTINFORMATIONCOMPONENT_H_30FFCD07__

+ 18
- 36
modules/juce_graphics/geometry/juce_RectangleList.cpp View File

@@ -32,8 +32,7 @@ RectangleList::RectangleList() noexcept
RectangleList::RectangleList (const Rectangle<int>& rect) RectangleList::RectangleList (const Rectangle<int>& rect)
{ {
if (! rect.isEmpty())
rects.add (rect);
addWithoutMerging (rect);
} }
RectangleList::RectangleList (const RectangleList& other) RectangleList::RectangleList (const RectangleList& other)
@@ -99,7 +98,7 @@ bool RectangleList::Iterator::next() noexcept
{ {
if (--index >= 0) if (--index >= 0)
{ {
current = & (owner.rects.getReference (index));
current = &(owner.rects.getReference (index));
return true; return true;
} }
@@ -120,15 +119,14 @@ void RectangleList::add (const Rectangle<int>& rect)
{ {
bool anyOverlaps = false; bool anyOverlaps = false;
int i;
for (i = rects.size(); --i >= 0;)
for (int j = rects.size(); --j >= 0;)
{ {
Rectangle<int>& ourRect = rects.getReference (i);
Rectangle<int>& ourRect = rects.getReference (j);
if (rect.intersects (ourRect)) if (rect.intersects (ourRect))
{ {
if (rect.contains (ourRect)) if (rect.contains (ourRect))
rects.remove (i);
rects.remove (j);
else if (! ourRect.reduceIfPartlyContainedIn (rect)) else if (! ourRect.reduceIfPartlyContainedIn (rect))
anyOverlaps = true; anyOverlaps = true;
} }
@@ -138,7 +136,7 @@ void RectangleList::add (const Rectangle<int>& rect)
{ {
RectangleList r (rect); RectangleList r (rect);
for (i = rects.size(); --i >= 0;)
for (int i = rects.size(); --i >= 0;)
{ {
const Rectangle<int>& ourRect = rects.getReference (i); const Rectangle<int>& ourRect = rects.getReference (i);
@@ -151,8 +149,7 @@ void RectangleList::add (const Rectangle<int>& rect)
} }
} }
for (i = r.getNumRectangles(); --i >= 0;)
rects.add (r.rects.getReference (i));
rects.addArray (r.rects);
} }
else else
{ {
@@ -170,15 +167,7 @@ void RectangleList::addWithoutMerging (const Rectangle<int>& rect)
void RectangleList::add (const int x, const int y, const int w, const int h) void RectangleList::add (const int x, const int y, const int w, const int h)
{ {
if (rects.size() == 0)
{
if (w > 0 && h > 0)
rects.add (Rectangle<int> (x, y, w, h));
}
else
{
add (Rectangle<int> (x, y, w, h));
}
add (Rectangle<int> (x, y, w, h));
} }
void RectangleList::add (const RectangleList& other) void RectangleList::add (const RectangleList& other)
@@ -220,8 +209,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
r.x = x1; r.x = x1;
r.w = rx2 - x1; r.w = rx2 - x1;
rects.insert (i + 1, Rectangle<int> (rx1, ry1, x1 - rx1, ry2 - ry1));
i += 2;
rects.insert (++i, Rectangle<int> (rx1, ry1, x1 - rx1, ry2 - ry1));
++i;
} }
} }
else if (x2 > rx1 && x2 < rx2) else if (x2 > rx1 && x2 < rx2)
@@ -231,8 +220,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
if (y1 > ry1 || y2 < ry2 || x1 > rx1) if (y1 > ry1 || y2 < ry2 || x1 > rx1)
{ {
rects.insert (i + 1, Rectangle<int> (rx1, ry1, x2 - rx1, ry2 - ry1));
i += 2;
rects.insert (++i, Rectangle<int> (rx1, ry1, x2 - rx1, ry2 - ry1));
++i;
} }
} }
else if (y1 > ry1 && y1 < ry2) else if (y1 > ry1 && y1 < ry2)
@@ -246,8 +235,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
r.y = y1; r.y = y1;
r.h = ry2 - y1; r.h = ry2 - y1;
rects.insert (i + 1, Rectangle<int> (rx1, ry1, rx2 - rx1, y1 - ry1));
i += 2;
rects.insert (++i, Rectangle<int> (rx1, ry1, rx2 - rx1, y1 - ry1));
++i;
} }
} }
else if (y2 > ry1 && y2 < ry2) else if (y2 > ry1 && y2 < ry2)
@@ -257,8 +246,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
if (x1 > rx1 || x2 < rx2 || y1 > ry1) if (x1 > rx1 || x2 < rx2 || y1 > ry1)
{ {
rects.insert (i + 1, Rectangle<int> (rx1, ry1, rx2 - rx1, y2 - ry1));
i += 2;
rects.insert (++i, Rectangle<int> (rx1, ry1, rx2 - rx1, y2 - ry1));
++i;
} }
} }
else else
@@ -522,15 +511,8 @@ Path RectangleList::toPath() const
{ {
Path p; Path p;
for (int i = rects.size(); --i >= 0;)
{
const Rectangle<int>& r = rects.getReference (i);
p.addRectangle ((float) r.x,
(float) r.y,
(float) r.w,
(float) r.h);
}
for (int i = 0; i < rects.size(); ++i)
p.addRectangle (rects.getReference (i));
return p; return p;
} }


+ 34
- 22
modules/juce_gui_basics/layout/juce_Viewport.cpp View File

@@ -68,7 +68,6 @@ void Viewport::deleteContentComp()
// This sets the content comp to a null pointer before deleting the old one, in case // This sets the content comp to a null pointer before deleting the old one, in case
// anything tries to use the old one while it's in mid-deletion.. // anything tries to use the old one while it's in mid-deletion..
ScopedPointer<Component> oldCompDeleter (contentComp); ScopedPointer<Component> oldCompDeleter (contentComp);
contentComp = nullptr;
} }
else else
{ {
@@ -186,36 +185,49 @@ void Viewport::updateVisibleArea()
const bool canShowHBar = showHScrollbar && canShowAnyBars; const bool canShowHBar = showHScrollbar && canShowAnyBars;
const bool canShowVBar = showVScrollbar && canShowAnyBars; const bool canShowVBar = showVScrollbar && canShowAnyBars;
bool hBarVisible = canShowHBar && ! horizontalScrollBar.autoHides();
bool vBarVisible = canShowVBar && ! verticalScrollBar.autoHides();
Rectangle<int> contentArea (getLocalBounds());
bool hBarVisible, vBarVisible;
Rectangle<int> contentArea;
if (contentComp != nullptr && ! contentArea.contains (contentComp->getBounds()))
for (int i = 3; --i >= 0;)
{ {
hBarVisible = canShowHBar && (hBarVisible || contentComp->getX() < 0 || contentComp->getRight() > contentArea.getWidth());
vBarVisible = canShowVBar && (vBarVisible || contentComp->getY() < 0 || contentComp->getBottom() > contentArea.getHeight());
hBarVisible = canShowHBar && ! horizontalScrollBar.autoHides();
vBarVisible = canShowVBar && ! verticalScrollBar.autoHides();
contentArea = getLocalBounds();
if (vBarVisible)
contentArea.setWidth (getWidth() - scrollbarWidth);
if (contentComp != nullptr && ! contentArea.contains (contentComp->getBounds()))
{
hBarVisible = canShowHBar && (hBarVisible || contentComp->getX() < 0 || contentComp->getRight() > contentArea.getWidth());
vBarVisible = canShowVBar && (vBarVisible || contentComp->getY() < 0 || contentComp->getBottom() > contentArea.getHeight());
if (hBarVisible)
contentArea.setHeight (getHeight() - scrollbarWidth);
if (vBarVisible)
contentArea.setWidth (getWidth() - scrollbarWidth);
if (! contentArea.contains (contentComp->getBounds()))
{
hBarVisible = canShowHBar && (hBarVisible || contentComp->getRight() > contentArea.getWidth());
vBarVisible = canShowVBar && (vBarVisible || contentComp->getBottom() > contentArea.getHeight());
if (hBarVisible)
contentArea.setHeight (getHeight() - scrollbarWidth);
if (! contentArea.contains (contentComp->getBounds()))
{
hBarVisible = canShowHBar && (hBarVisible || contentComp->getRight() > contentArea.getWidth());
vBarVisible = canShowVBar && (vBarVisible || contentComp->getBottom() > contentArea.getHeight());
}
} }
}
if (vBarVisible)
contentArea.setWidth (getWidth() - scrollbarWidth);
if (vBarVisible) contentArea.setWidth (getWidth() - scrollbarWidth);
if (hBarVisible) contentArea.setHeight (getHeight() - scrollbarWidth);
if (hBarVisible)
contentArea.setHeight (getHeight() - scrollbarWidth);
if (contentComp == nullptr)
{
contentHolder.setBounds (contentArea);
break;
}
const Rectangle<int> oldContentBounds (contentComp->getBounds());
contentHolder.setBounds (contentArea);
contentHolder.setBounds (contentArea);
// If the content has changed its size, that might affect our scrollbars, so go round again and re-caclulate..
if (oldContentBounds == contentComp->getBounds())
break;
}
Rectangle<int> contentBounds; Rectangle<int> contentBounds;
if (contentComp != nullptr) if (contentComp != nullptr)


+ 1
- 1
modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp View File

@@ -223,7 +223,7 @@ public:
getComponent().setBounds (newBounds); getComponent().setBounds (newBounds);
} }
jassertfalse; // must be a recursive reference!
jassertfalse; // Seems to be a recursive reference!
} }
void applyNewBounds (const Rectangle<int>& newBounds) void applyNewBounds (const Rectangle<int>& newBounds)


+ 2
- 2
modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp View File

@@ -611,7 +611,7 @@ public:
void setColour (const float alpha) noexcept void setColour (const float alpha) noexcept
{ {
const uint8 v = jmin (255, (int) (alpha * 255.0f));
const uint8 v = (uint8) jmin (255, (int) (alpha * 255.0f));
setColour (PixelARGB (v, v, v, v)); setColour (PixelARGB (v, v, v, v));
} }
@@ -727,7 +727,7 @@ public:
{ {
GLint t = 0; GLint t = 0;
glGetIntegerv (GL_TEXTURE_BINDING_2D, &t); glGetIntegerv (GL_TEXTURE_BINDING_2D, &t);
jassert (t == textureID);
jassert (t == (GLint) textureID);
} }
} }


Loading…
Cancel
Save