Browse Source

Added a button size option to the PreferencesPanel. Added an operator for writing Strings to std::wcout. Fixed a clipping error in audio float to int conversion. Made the introjucer cope with backslashes in filenames when used on unix.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
a493cfee4d
10 changed files with 86 additions and 57 deletions
  1. +2
    -1
      extras/Introjucer/Source/Project/jucer_Project.cpp
  2. +15
    -20
      juce_amalgamated.cpp
  3. +27
    -8
      juce_amalgamated.h
  4. +2
    -2
      src/audio/dsp/juce_AudioDataConverters.h
  5. +4
    -20
      src/containers/juce_ValueTree.cpp
  6. +1
    -1
      src/core/juce_StandardHeader.h
  7. +11
    -0
      src/gui/components/special/juce_PreferencesPanel.cpp
  8. +6
    -0
      src/gui/components/special/juce_PreferencesPanel.h
  9. +5
    -1
      src/memory/juce_Atomic.h
  10. +13
    -4
      src/text/juce_String.h

+ 2
- 1
extras/Introjucer/Source/Project/jucer_Project.cpp View File

@@ -242,7 +242,8 @@ const File Project::resolveFilename (String filename) const
if (filename.isEmpty()) if (filename.isEmpty())
return File::nonexistent; return File::nonexistent;
filename = replacePreprocessorDefs (getPreprocessorDefs(), filename);
filename = replacePreprocessorDefs (getPreprocessorDefs(), filename)
.replaceCharacter ('\\', '/');
if (File::isAbsolutePath (filename)) if (File::isAbsolutePath (filename))
return File (filename); return File (filename);


+ 15
- 20
juce_amalgamated.cpp View File

@@ -17324,13 +17324,9 @@ void ValueTree::SharedObject::sendPropertyChangeMessage (ValueTree& tree, const
void ValueTree::SharedObject::sendPropertyChangeMessage (const Identifier& property) void ValueTree::SharedObject::sendPropertyChangeMessage (const Identifier& property)
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;


while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendPropertyChangeMessage (tree, property); t->sendPropertyChangeMessage (tree, property);
t = t->parent;
}
} }


void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree& child) void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree& child)
@@ -17346,13 +17342,9 @@ void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree&
void ValueTree::SharedObject::sendChildAddedMessage (ValueTree child) void ValueTree::SharedObject::sendChildAddedMessage (ValueTree child)
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;


while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendChildAddedMessage (tree, child); t->sendChildAddedMessage (tree, child);
t = t->parent;
}
} }


void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTree& child) void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTree& child)
@@ -17368,13 +17360,9 @@ void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTre
void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree child) void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree child)
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;


while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendChildRemovedMessage (tree, child); t->sendChildRemovedMessage (tree, child);
t = t->parent;
}
} }


void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree) void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree)
@@ -17390,13 +17378,9 @@ void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree)
void ValueTree::SharedObject::sendChildOrderChangedMessage() void ValueTree::SharedObject::sendChildOrderChangedMessage()
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;


while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendChildOrderChangedMessage (tree); t->sendChildOrderChangedMessage (tree);
t = t->parent;
}
} }


void ValueTree::SharedObject::sendParentChangeMessage() void ValueTree::SharedObject::sendParentChangeMessage()
@@ -76214,6 +76198,17 @@ PreferencesPanel::~PreferencesPanel()
{ {
} }


int PreferencesPanel::getButtonSize() const throw()
{
return buttonSize;
}

void PreferencesPanel::setButtonSize (int newSize)
{
buttonSize = newSize;
resized();
}

void PreferencesPanel::addSettingsPage (const String& title, void PreferencesPanel::addSettingsPage (const String& title,
const Drawable* icon, const Drawable* icon,
const Drawable* overIcon, const Drawable* overIcon,


+ 27
- 8
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53 #define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 59
#define JUCE_BUILDNUMBER 60


/** Current Juce version number. /** Current Juce version number.


@@ -2236,7 +2236,11 @@ public:
/** Implements a memory read/write barrier. */ /** Implements a memory read/write barrier. */
static void memoryBarrier() throw(); static void memoryBarrier() throw();


JUCE_ALIGN(8)
#if JUCE_64BIT
JUCE_ALIGN (8)
#else
JUCE_ALIGN (4)
#endif


/** The raw value that this class operates on. /** The raw value that this class operates on.
This is exposed publically in case you need to manipulate it directly This is exposed publically in case you need to manipulate it directly
@@ -5455,15 +5459,24 @@ JUCE_API bool JUCE_CALLTYPE operator>= (const String& string1, const String& str
/** Case-sensitive comparison of two strings. */ /** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw(); JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();


/** This streaming override allows you to pass a juce String directly into std output streams.
This is very handy for writing strings to std::cout, std::cerr, etc.
/** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::cout, std::cerr, etc.
*/ */
template <class charT, class traits>
std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
template <class traits>
std::basic_ostream <char, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <char, traits>& stream, const String& stringToWrite)
{ {
return stream << stringToWrite.toUTF8().getAddress(); return stream << stringToWrite.toUTF8().getAddress();
} }


/** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::wcout, std::wcerr, etc.
*/
template <class traits>
std::basic_ostream <wchar_t, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <wchar_t, traits>& stream, const String& stringToWrite)
{
return stream << stringToWrite.toWideCharPointer();
}

/** Writes a string to an OutputStream as UTF8. */ /** Writes a string to an OutputStream as UTF8. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text); JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);


@@ -34702,8 +34715,8 @@ public:
inline void skip (int numSamples) throw() { data += numSamples; } inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); } inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); } inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) (maxValue * jlimit (-1.0f, 1.0f, newValue))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) (maxValue * jlimit (-1.0f, 1.0f, newValue))); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); } inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); } inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); } inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
@@ -63588,6 +63601,12 @@ public:
/** Changes the current page being displayed. */ /** Changes the current page being displayed. */
void setCurrentPage (const String& pageName); void setCurrentPage (const String& pageName);


/** Returns the size of the buttons shown along the top. */
int getButtonSize() const throw();

/** Changes the size of the buttons shown along the top. */
void setButtonSize (int newSize);

/** @internal */ /** @internal */
void resized(); void resized();
/** @internal */ /** @internal */


+ 2
- 2
src/audio/dsp/juce_AudioDataConverters.h View File

@@ -206,8 +206,8 @@ public:
inline void skip (int numSamples) throw() { data += numSamples; } inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); } inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); } inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) (maxValue * jlimit (-1.0f, 1.0f, newValue))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) (maxValue * jlimit (-1.0f, 1.0f, newValue))); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); } inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); } inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); } inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }


+ 4
- 20
src/containers/juce_ValueTree.cpp View File

@@ -241,13 +241,9 @@ void ValueTree::SharedObject::sendPropertyChangeMessage (ValueTree& tree, const
void ValueTree::SharedObject::sendPropertyChangeMessage (const Identifier& property) void ValueTree::SharedObject::sendPropertyChangeMessage (const Identifier& property)
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;
while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendPropertyChangeMessage (tree, property); t->sendPropertyChangeMessage (tree, property);
t = t->parent;
}
} }
void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree& child) void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree& child)
@@ -263,13 +259,9 @@ void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree&
void ValueTree::SharedObject::sendChildAddedMessage (ValueTree child) void ValueTree::SharedObject::sendChildAddedMessage (ValueTree child)
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;
while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendChildAddedMessage (tree, child); t->sendChildAddedMessage (tree, child);
t = t->parent;
}
} }
void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTree& child) void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTree& child)
@@ -285,13 +277,9 @@ void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTre
void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree child) void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree child)
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;
while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendChildRemovedMessage (tree, child); t->sendChildRemovedMessage (tree, child);
t = t->parent;
}
} }
void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree) void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree)
@@ -307,13 +295,9 @@ void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree)
void ValueTree::SharedObject::sendChildOrderChangedMessage() void ValueTree::SharedObject::sendChildOrderChangedMessage()
{ {
ValueTree tree (this); ValueTree tree (this);
ValueTree::SharedObject* t = this;
while (t != 0)
{
for (ValueTree::SharedObject* t = this; t != 0; t = t->parent)
t->sendChildOrderChangedMessage (tree); t->sendChildOrderChangedMessage (tree);
t = t->parent;
}
} }
void ValueTree::SharedObject::sendParentChangeMessage() void ValueTree::SharedObject::sendParentChangeMessage()


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53 #define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 59
#define JUCE_BUILDNUMBER 60
/** Current Juce version number. /** Current Juce version number.


+ 11
- 0
src/gui/components/special/juce_PreferencesPanel.cpp View File

@@ -43,6 +43,17 @@ PreferencesPanel::~PreferencesPanel()
{ {
} }
int PreferencesPanel::getButtonSize() const throw()
{
return buttonSize;
}
void PreferencesPanel::setButtonSize (int newSize)
{
buttonSize = newSize;
resized();
}
//============================================================================== //==============================================================================
void PreferencesPanel::addSettingsPage (const String& title, void PreferencesPanel::addSettingsPage (const String& title,
const Drawable* icon, const Drawable* icon,


+ 6
- 0
src/gui/components/special/juce_PreferencesPanel.h View File

@@ -124,6 +124,12 @@ public:
/** Changes the current page being displayed. */ /** Changes the current page being displayed. */
void setCurrentPage (const String& pageName); void setCurrentPage (const String& pageName);
/** Returns the size of the buttons shown along the top. */
int getButtonSize() const throw();
/** Changes the size of the buttons shown along the top. */
void setButtonSize (int newSize);
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void resized(); void resized();


+ 5
- 1
src/memory/juce_Atomic.h View File

@@ -137,7 +137,11 @@ public:
static void memoryBarrier() throw(); static void memoryBarrier() throw();
//============================================================================== //==============================================================================
JUCE_ALIGN(8)
#if JUCE_64BIT
JUCE_ALIGN (8)
#else
JUCE_ALIGN (4)
#endif
/** The raw value that this class operates on. /** The raw value that this class operates on.
This is exposed publically in case you need to manipulate it directly This is exposed publically in case you need to manipulate it directly


+ 13
- 4
src/text/juce_String.h View File

@@ -1304,15 +1304,24 @@ JUCE_API bool JUCE_CALLTYPE operator>= (const String& string1, const String& str
JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw(); JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();
//============================================================================== //==============================================================================
/** This streaming override allows you to pass a juce String directly into std output streams.
This is very handy for writing strings to std::cout, std::cerr, etc.
/** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::cout, std::cerr, etc.
*/ */
template <class charT, class traits>
std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
template <class traits>
std::basic_ostream <char, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <char, traits>& stream, const String& stringToWrite)
{ {
return stream << stringToWrite.toUTF8().getAddress(); return stream << stringToWrite.toUTF8().getAddress();
} }
/** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::wcout, std::wcerr, etc.
*/
template <class traits>
std::basic_ostream <wchar_t, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <wchar_t, traits>& stream, const String& stringToWrite)
{
return stream << stringToWrite.toWideCharPointer();
}
/** Writes a string to an OutputStream as UTF8. */ /** Writes a string to an OutputStream as UTF8. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text); JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);


Loading…
Cancel
Save