1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

Work-arounds for compiling with VC6.

This commit is contained in:
Julian Storer 2010-03-11 11:37:40 +00:00
parent d84e47353c
commit 4ed63991e2
15 changed files with 206 additions and 222 deletions

View file

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "../../../bin/intermediate_win32/static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MD /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# ADD CPP /nologo /G6 /MD /GR /GX /O2 /D "NDEBUG" /D "WIN32" /D "_LIB" /D "UNICODE" /D "_UNICODE" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
@ -657,6 +657,10 @@ SOURCE=..\..\..\src\events\juce_InterprocessConnectionServer.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\events\juce_ListenerList.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\events\juce_Message.cpp
# End Source File
# Begin Source File
@ -2432,10 +2436,6 @@ SOURCE=..\..\..\src\threads\juce_CriticalSection.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\threads\juce_InterProcessLock.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\threads\juce_InterProcessLock.h
# End Source File
# Begin Source File

View file

@ -1388,6 +1388,26 @@ const String SystemStats::getJUCEVersion() throw()
+ "." + String (JUCE_BUILDNUMBER);
}
const StringArray SystemStats::getMACAddressStrings()
{
int64 macAddresses [16];
const int numAddresses = getMACAddresses (macAddresses, numElementsInArray (macAddresses), false);
StringArray s;
for (int i = 0; i < numAddresses; ++i)
{
s.add (String::toHexString (0xff & (int) (macAddresses [i] >> 40)).paddedLeft ('0', 2)
+ "-" + String::toHexString (0xff & (int) (macAddresses [i] >> 32)).paddedLeft ('0', 2)
+ "-" + String::toHexString (0xff & (int) (macAddresses [i] >> 24)).paddedLeft ('0', 2)
+ "-" + String::toHexString (0xff & (int) (macAddresses [i] >> 16)).paddedLeft ('0', 2)
+ "-" + String::toHexString (0xff & (int) (macAddresses [i] >> 8)).paddedLeft ('0', 2)
+ "-" + String::toHexString (0xff & (int) (macAddresses [i] >> 0)).paddedLeft ('0', 2));
}
return s;
}
static bool juceInitialisedNonGUI = false;
void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI()
@ -10208,20 +10228,6 @@ int CharacterFunctions::getHexDigitValue (const juce_wchar digit) throw()
return -1;
}
int CharacterFunctions::printf (char* const dest, const int maxLength, const char* const format, ...) throw()
{
va_list list;
va_start (list, format);
return vprintf (dest, maxLength, format, list);
}
int CharacterFunctions::printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw()
{
va_list list;
va_start (list, format);
return vprintf (dest, maxLength, format, list);
}
int CharacterFunctions::vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw()
{
#if JUCE_WIN32
@ -10661,6 +10667,47 @@ namespace IntToCharConverters
return t;
}
static tchar* doubleToString (tchar* buffer, int numChars, double n, int numDecPlaces, int& len) throw()
{
if (numDecPlaces > 0 && n > -1.0e20 && n < 1.0e20)
{
tchar* const end = buffer + numChars;
tchar* t = end;
int64 v = (int64) (pow (10.0, numDecPlaces) * fabs (n) + 0.5);
*--t = (tchar) 0;
while (numDecPlaces >= 0 || v > 0)
{
if (numDecPlaces == 0)
*--t = decimalPoint;
*--t = (tchar) (T('0') + (v % 10));
v /= 10;
--numDecPlaces;
}
if (n < 0)
*--t = T('-');
len = end - t;
return t;
}
else
{
#if JUCE_WIN32
#if _MSC_VER <= 1200
len = (int) _snwprintf (buffer, numChars, L"%.9g", n) + 1;
#else
len = (int) _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n) + 1;
#endif
#else
len = (int) swprintf (buffer, numChars, L"%.9g", n) + 1;
#endif
return buffer;
}
}
}
String::String (const int number) throw()
@ -10711,71 +10758,22 @@ String::String (const uint64 number) throw()
createInternal (IntToCharConverters::uint64ToString (end, number), end);
}
// a double-to-string routine that actually uses the number of dec. places you asked for
// without resorting to exponent notation if the number's too big or small (which is what printf does).
void String::doubleToStringWithDecPlaces (double n, int numDecPlaces) throw()
{
const int bufSize = 80;
tchar buffer [bufSize];
int len;
tchar* t;
if (numDecPlaces > 0 && n > -1.0e20 && n < 1.0e20)
{
int64 v = (int64) (pow (10.0, numDecPlaces) * fabs (n) + 0.5);
t = buffer + bufSize;
*--t = (tchar) 0;
while (numDecPlaces >= 0 || v > 0)
{
if (numDecPlaces == 0)
*--t = decimalPoint;
*--t = (tchar) (T('0') + (v % 10));
v /= 10;
--numDecPlaces;
}
if (n < 0)
*--t = T('-');
len = (int) ((buffer + bufSize) - t);
}
else
{
len = CharacterFunctions::printf (buffer, bufSize, T("%.9g"), n) + 1;
t = buffer;
}
if (len > 1)
{
jassert (len < numElementsInArray (buffer));
createInternal (len - 1);
memcpy (text->text, t, len * sizeof (tchar));
}
else
{
jassert (*t == 0);
text = &emptyString;
emptyString.refCount = safeEmptyStringRefCount;
}
}
String::String (const float number,
const int numberOfDecimalPlaces) throw()
{
doubleToStringWithDecPlaces ((double) number,
numberOfDecimalPlaces);
tchar buffer [48];
int len;
tchar* start = IntToCharConverters::doubleToString (buffer, numElementsInArray (buffer), (double) number, numberOfDecimalPlaces, len);
createInternal (start, start + len);
}
String::String (const double number,
const int numberOfDecimalPlaces) throw()
{
doubleToStringWithDecPlaces (number,
numberOfDecimalPlaces);
tchar buffer [48];
int len;
tchar* start = IntToCharConverters::doubleToString (buffer, numElementsInArray (buffer), number, numberOfDecimalPlaces, len);
createInternal (start, start + len);
}
String::~String() throw()
@ -11432,14 +11430,6 @@ bool String::matchesWildcard (const tchar* wildcard, const bool ignoreCase) cons
}
}
void String::printf (const tchar* const pf, ...) throw()
{
va_list list;
va_start (list, pf);
vprintf (pf, list);
}
const String String::formatted (const tchar* const pf, ...) throw()
{
va_list list;
@ -41581,7 +41571,7 @@ Component::BailOutChecker::BailOutChecker (Component* const component1, Componen
bool Component::BailOutChecker::shouldBailOut() const throw()
{
return safePointer1 == 0 || safePointer2 != component2;
return safePointer1 == 0 || safePointer2.getComponent() != component2;
}
END_JUCE_NAMESPACE
@ -42415,7 +42405,7 @@ void Button::parentHierarchyChanged()
{
Component* const newKeySource = (shortcuts.size() == 0) ? 0 : getTopLevelComponent();
if (newKeySource != keySource)
if (newKeySource != keySource.getComponent())
{
if (keySource != 0)
keySource->removeKeyListener (this);
@ -43529,7 +43519,13 @@ juce_wchar CodeDocument::Iterator::nextChar()
jassert (currentLine == document->lines.getUnchecked (line));
const juce_wchar result = currentLine->line [position - currentLine->lineStartInFile];
skip();
if (++position >= currentLine->lineStartInFile + currentLine->lineLength)
{
++line;
currentLine = document->lines [line];
}
return result;
}
@ -43569,7 +43565,7 @@ juce_wchar CodeDocument::Iterator::peekNextChar() const
return 0;
jassert (currentLine == document->lines.getUnchecked (line));
return currentLine->line [position - currentLine->lineStartInFile];
return const_cast <const String&> (currentLine->line) [position - currentLine->lineStartInFile];
}
void CodeDocument::Iterator::skipWhitespace()
@ -45338,7 +45334,7 @@ void CodeEditorComponent::mouseWheelMove (const MouseEvent& e, float wheelIncrem
horizontalScrollBar->mouseWheelMove (e, wheelIncrementX, 0);
}
void CodeEditorComponent::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart)
void CodeEditorComponent::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart)
{
if (scrollBarThatHasMoved == verticalScrollBar)
scrollToLineInternal ((int) newRangeStart);
@ -60035,7 +60031,7 @@ ComponentAnimator::~ComponentAnimator()
void* ComponentAnimator::findTaskFor (Component* const component) const
{
for (int i = tasks.size(); --i >= 0;)
if (component == ((AnimationTask*) tasks.getUnchecked(i))->component)
if (component == ((AnimationTask*) tasks.getUnchecked(i))->component.getComponent())
return tasks.getUnchecked(i);
return 0;
@ -63176,7 +63172,7 @@ void Viewport::visibleAreaChanged (int, int, int, int)
void Viewport::setViewedComponent (Component* const newViewedComponent)
{
if (contentComp != newViewedComponent)
if (contentComp.getComponent() != newViewedComponent)
{
{
ScopedPointer<Component> oldCompDeleter (contentComp);
@ -63381,7 +63377,7 @@ void Viewport::setScrollBarButtonVisibility (const bool buttonsVisible)
horizontalScrollBar->setButtonVisibility (buttonsVisible);
}
void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart)
void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart)
{
if (scrollBarThatHasMoved == horizontalScrollBar)
{
@ -85493,7 +85489,24 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_GlyphArrangement.cpp ***/
BEGIN_JUCE_NAMESPACE
PositionedGlyph::PositionedGlyph()
PositionedGlyph::PositionedGlyph (const float x_, const float y_, const float w_, const Font& font_,
const juce_wchar character_, const int glyph_)
: x (x_),
y (y_),
w (w_),
font (font_),
character (character_),
glyph (glyph_)
{
}
PositionedGlyph::PositionedGlyph (const PositionedGlyph& other)
: x (other.x),
y (other.y),
w (other.w),
font (other.font),
character (other.character),
glyph (other.glyph)
{
}
@ -85632,16 +85645,14 @@ void GlyphArrangement::addCurtailedLineOfText (const Font& font,
const float maxWidthPixels,
const bool useEllipsis)
{
int textLen = text.length();
if (textLen > 0)
if (text.isNotEmpty())
{
Array <int> newGlyphs;
Array <float> xOffsets;
font.getGlyphPositions (text, newGlyphs, xOffsets);
const int textLen = newGlyphs.size();
const juce_wchar* const unicodeText = (const juce_wchar*) text;
textLen = jmin (textLen, newGlyphs.size());
for (int i = 0; i < textLen; ++i)
{
@ -85658,15 +85669,8 @@ void GlyphArrangement::addCurtailedLineOfText (const Font& font,
}
else
{
PositionedGlyph* const pg = new PositionedGlyph();
pg->x = xOffset + thisX;
pg->y = yOffset;
pg->w = nextX - thisX;
pg->font = font;
pg->glyph = newGlyphs.getUnchecked(i);
pg->character = unicodeText[i];
glyphs.add (pg);
glyphs.add (new PositionedGlyph (xOffset + thisX, yOffset, nextX - thisX,
font, unicodeText[i], newGlyphs.getUnchecked(i)));
}
}
}
@ -85701,16 +85705,9 @@ int GlyphArrangement::insertEllipsis (const Font& font, const float maxXPos,
for (int i = 3; --i >= 0;)
{
PositionedGlyph* const pg = new PositionedGlyph();
pg->x = xOffset;
pg->y = yOffset;
pg->w = dx;
pg->font = font;
pg->character = '.';
pg->glyph = dotGlyphs.getFirst();
glyphs.insert (endIndex++, pg);
glyphs.insert (endIndex++, new PositionedGlyph (xOffset, yOffset, dx,
font, '.', dotGlyphs.getFirst()));
--numDeleted;
xOffset += dx;
if (xOffset > maxXPos)
@ -211418,15 +211415,6 @@ void Logger::outputDebugString (const String& text) throw()
OutputDebugString (text + T("\n"));
}
void Logger::outputDebugPrintf (const tchar* format, ...) throw()
{
String text;
va_list args;
va_start (args, format);
text.vprintf(format, args);
outputDebugString (text);
}
static int64 hiResTicksPerSecond;
static double hiResTicksScaleFactor;
@ -213416,7 +213404,7 @@ static int getMACAddressesViaNetBios (int64* addresses, int maxNum, const bool l
return numFound;
}
int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littleEndian) throw()
int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littleEndian)
{
int numFound = getMACAddressViaGetAdaptersInfo (addresses, maxNum, littleEndian);
@ -229021,7 +229009,7 @@ int NamedPipe::write (const void* sourceBuffer, int numBytesToWrite, int timeOut
// compiled on its own).
#if JUCE_INCLUDED_FILE
int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littleEndian) throw()
int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littleEndian)
{
int numResults = 0;
@ -229469,17 +229457,7 @@ int juce_seekInInternetFile (void* handle, int newPosition)
void Logger::outputDebugString (const String& text) throw()
{
fputs (text.toUTF8(), stdout);
fputs ("\n", stdout);
}
void Logger::outputDebugPrintf (const tchar* format, ...) throw()
{
String text;
va_list args;
va_start (args, format);
text.vprintf(format, args);
outputDebugString(text);
std::cerr << text << std::endl;
}
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() throw()
@ -237209,7 +237187,7 @@ void PlatformUtilities::fpuReset()
// compiled on its own).
#if JUCE_INCLUDED_FILE
int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littleEndian) throw()
int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littleEndian)
{
#ifndef IFT_ETHER
#define IFT_ETHER 6
@ -239299,16 +239277,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle<int> >& monitorCoords, const
void Logger::outputDebugString (const String& text) throw()
{
std::cerr << (const char*) text.toUTF8() << std::endl;
}
void Logger::outputDebugPrintf (const tchar* format, ...) throw()
{
String text;
va_list args;
va_start (args, format);
text.vprintf (format, args);
outputDebugString (text);
std::cerr << text << std::endl;
}
bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger()
@ -239516,7 +239485,7 @@ public:
#if SUPPORT_ONLY_10_4_FONTS
HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast <NSGlyph*> (glyphs.getData()) count: length];
for (int i = 0; i < length; ++i)
x += advances[i].width;
@ -239557,14 +239526,14 @@ public:
#if SUPPORT_ONLY_10_4_FONTS
HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast <NSGlyph*> (glyphs.getData()) count: length];
int x = 0;
for (int i = 0; i < length; ++i)
{
x += advances[i].width;
xOffsets.add (x * unitsToHeightScaleFactor);
resultGlyphs.add (((NSGlyph*) glyphs)[i]);
resultGlyphs.add (reinterpret_cast <NSGlyph*> (glyphs.getData())[i]);
}
#else
@ -239942,6 +239911,7 @@ public:
CoreGraphicsContext (CGContextRef context_, const float flipHeight_)
: context (context_),
flipHeight (flipHeight_),
state (new SavedState()),
numGradientLookupEntries (0)
{
CGContextRetain (context);
@ -239954,7 +239924,7 @@ public:
gradientCallbacks.version = 0;
gradientCallbacks.evaluate = gradientCallback;
gradientCallbacks.releaseInfo = 0;
state = new SavedState();
setFont (Font());
}
~CoreGraphicsContext()
@ -243911,7 +243881,7 @@ public:
#if SUPPORT_ONLY_10_4_FONTS
HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast <NSGlyph*> (glyphs.getData()) count: length];
for (int i = 0; i < length; ++i)
x += advances[i].width;
@ -243952,14 +243922,14 @@ public:
#if SUPPORT_ONLY_10_4_FONTS
HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast <NSGlyph*> (glyphs.getData()) count: length];
int x = 0;
for (int i = 0; i < length; ++i)
{
x += advances[i].width;
xOffsets.add (x * unitsToHeightScaleFactor);
resultGlyphs.add (((NSGlyph*) glyphs)[i]);
resultGlyphs.add (reinterpret_cast <NSGlyph*> (glyphs.getData())[i]);
}
#else
@ -244337,6 +244307,7 @@ public:
CoreGraphicsContext (CGContextRef context_, const float flipHeight_)
: context (context_),
flipHeight (flipHeight_),
state (new SavedState()),
numGradientLookupEntries (0)
{
CGContextRetain (context);
@ -244349,7 +244320,7 @@ public:
gradientCallbacks.version = 0;
gradientCallbacks.evaluate = gradientCallback;
gradientCallbacks.releaseInfo = 0;
state = new SavedState();
setFont (Font());
}
~CoreGraphicsContext()

View file

@ -43,7 +43,7 @@
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 51
#define JUCE_BUILDNUMBER 9
#define JUCE_BUILDNUMBER 10
#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
@ -362,7 +362,7 @@
#if JUCE_LOG_ASSERTIONS
#define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
#elif defined (JUCE_DEBUG)
#define juce_LogCurrentAssertion fprintf (stderr, "JUCE Assertion failure in %s, line %d\n", __FILE__, __LINE__);
#define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
#else
#define juce_LogCurrentAssertion
#endif
@ -373,8 +373,6 @@
#define DBG(dbgtext) Logger::outputDebugString (dbgtext);
#define DBG_PRINTF(dbgprintf) Logger::outputDebugPrintf dbgprintf;
// Assertions..
#if JUCE_WINDOWS || DOXYGEN
@ -423,7 +421,6 @@
// If debugging is disabled, these dummy debug and assertion macros are used..
#define DBG(dbgtext)
#define DBG_PRINTF(dbgprintf)
#define jassertfalse { juce_LogCurrentAssertion }
@ -496,7 +493,7 @@
// Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
#if JUCE_MSVC
#if (defined(_MSC_VER) && (_MSC_VER <= 1200))
#pragma warning (disable: 4284) // (spurious VC6 warning)
#pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
#endif
#pragma warning (push)
@ -1060,9 +1057,6 @@ public:
static int getHexDigitValue (const juce_wchar digit) throw();
static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
};
@ -1275,8 +1269,6 @@ public:
const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
void printf (const tchar* const format, ...) throw();
static const String formatted (const tchar* const format, ...) throw();
void vprintf (const tchar* const format, va_list& args) throw();
@ -1393,7 +1385,6 @@ private:
void createInternal (const int numChars) throw();
void createInternal (const tchar* const text, const tchar* const textEnd) throw();
void appendInternal (const tchar* const text, const int numExtraChars) throw();
void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
void dupeInternalIfMultiplyReferenced() throw();
};
@ -1457,8 +1448,6 @@ public:
static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
protected:
Logger();
@ -6074,14 +6063,14 @@ public:
void call (void (ListenerClass::*callbackFunction) ())
{
callChecked (DummyBailOutChecker(), callbackFunction);
callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
}
template <class BailOutCheckerType>
void callChecked (const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ())
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) ();
}
@ -6089,7 +6078,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1),
P2& param1)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1);
}
@ -6098,7 +6087,7 @@ public:
void (ListenerClass::*callbackFunction) (P1),
P2& param1)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1);
}
@ -6106,7 +6095,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2),
P3& param1, P4& param2)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2);
}
@ -6115,7 +6104,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2),
P3& param1, P4& param2)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2);
}
@ -6123,7 +6112,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
P4& param1, P5& param2, P6& param3)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3);
}
@ -6132,7 +6121,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3),
P4& param1, P5& param2, P6& param3)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3);
}
@ -6140,7 +6129,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
P5& param1, P6& param2, P7& param3, P8& param4)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
}
@ -6149,7 +6138,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
P5& param1, P6& param2, P7& param3, P8& param4)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
}
@ -6157,7 +6146,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
@ -6166,7 +6155,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
@ -6176,12 +6165,12 @@ public:
inline bool shouldBailOut() const throw() { return false; }
};
template <class BailOutCheckerType>
template <class BailOutCheckerType, class ListType>
class Iterator
{
public:
Iterator (const ListenerList& list_, const BailOutCheckerType& bailOutChecker_)
Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
: list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
{}
@ -6201,13 +6190,13 @@ public:
return index >= 0;
}
ListenerClass* getListener() const throw()
typename ListType::ListenerType* getListener() const throw()
{
return list.listeners.getUnchecked (index);
return list.getListeners().getUnchecked (index);
}
private:
const ListenerList& list;
const ListType& list;
const BailOutCheckerType& bailOutChecker;
int index;
@ -6215,6 +6204,11 @@ public:
Iterator& operator= (const Iterator&);
};
typedef ListenerList<ListenerClass, ArrayType> ThisType;
typedef ListenerClass ListenerType;
const ArrayType& getListeners() const throw() { return listeners; }
private:
ArrayType listeners;
@ -7311,11 +7305,13 @@ public:
static int getMACAddresses (int64* addresses, int maxNum,
#if JUCE_MAC
const bool littleEndian = true) throw();
const bool littleEndian = true);
#else
const bool littleEndian = false) throw();
const bool littleEndian = false);
#endif
static const StringArray getMACAddressStrings();
// not-for-public-use platform-specific method gets called at startup to initialise things.
static void initialiseStats() throw();
};
@ -12591,6 +12587,8 @@ public:
operator ComponentType*() const throw() { return comp; }
ComponentType* getComponent() const throw() { return comp; }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
@ -12616,7 +12614,8 @@ public:
bool shouldBailOut() const throw();
private:
Component::SafePointer<Component> safePointer1, safePointer2;
typedef SafePointer<Component> SafeComponentPtr;
SafeComponentPtr safePointer1, safePointer2;
Component* const component2;
BailOutChecker (const BailOutChecker&);
@ -15983,7 +15982,7 @@ public:
virtual ~ScrollBarListener() {}
virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
const double newRangeStart) = 0;
double newRangeStart) = 0;
};
class JUCE_API ScrollBar : public Component,
@ -16140,7 +16139,7 @@ public:
juce_UseDebuggingNewOperator
void resized();
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
bool keyPressed (const KeyPress& key);
void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
@ -20858,7 +20857,7 @@ public:
void mouseDoubleClick (const MouseEvent& e);
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
void timerCallback();
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
void handleAsyncUpdate();
void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
const CodeDocument::Position& affectedTextEnd);
@ -22984,7 +22983,8 @@ private:
juce_wchar character;
int glyph;
PositionedGlyph();
PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
PositionedGlyph (const PositionedGlyph& other);
};
class JUCE_API GlyphArrangement

View file

@ -66,7 +66,7 @@
// Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
#if JUCE_MSVC
#if (defined(_MSC_VER) && (_MSC_VER <= 1200))
#pragma warning (disable: 4284) // (spurious VC6 warning)
#pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
#endif
#pragma warning (push)

View file

@ -131,7 +131,7 @@ public:
/** Calls a member function on each listener in the list, with no parameters. */
void call (void (ListenerClass::*callbackFunction) ())
{
callChecked (DummyBailOutChecker(), callbackFunction);
callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
}
/** Calls a member function on each listener in the list, with no parameters and a bail-out-checker.
@ -140,7 +140,7 @@ public:
void callChecked (const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ())
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) ();
}
@ -150,7 +150,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1),
P2& param1)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1);
}
@ -161,7 +161,7 @@ public:
void (ListenerClass::*callbackFunction) (P1),
P2& param1)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1);
}
@ -171,7 +171,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2),
P3& param1, P4& param2)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2);
}
@ -182,7 +182,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2),
P3& param1, P4& param2)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2);
}
@ -192,7 +192,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
P4& param1, P5& param2, P6& param3)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3);
}
@ -203,7 +203,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3),
P4& param1, P5& param2, P6& param3)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3);
}
@ -213,7 +213,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
P5& param1, P6& param2, P7& param3, P8& param4)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
}
@ -224,7 +224,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
P5& param1, P6& param2, P7& param3, P8& param4)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
}
@ -234,7 +234,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
{
for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
@ -245,7 +245,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
{
for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
@ -262,12 +262,12 @@ public:
//==============================================================================
/** Iterates the listeners in a ListenerList. */
template <class BailOutCheckerType>
template <class BailOutCheckerType, class ListType>
class Iterator
{
public:
//==============================================================================
Iterator (const ListenerList& list_, const BailOutCheckerType& bailOutChecker_)
Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
: list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
{}
@ -288,14 +288,14 @@ public:
return index >= 0;
}
ListenerClass* getListener() const throw()
typename ListType::ListenerType* getListener() const throw()
{
return list.listeners.getUnchecked (index);
return list.getListeners().getUnchecked (index);
}
//==============================================================================
private:
const ListenerList& list;
const ListType& list;
const BailOutCheckerType& bailOutChecker;
int index;
@ -303,6 +303,11 @@ public:
Iterator& operator= (const Iterator&);
};
typedef ListenerList<ListenerClass, ArrayType> ThisType;
typedef ListenerClass ListenerType;
const ArrayType& getListeners() const throw() { return listeners; }
private:
//==============================================================================
ArrayType listeners;

View file

@ -477,7 +477,7 @@ void Button::parentHierarchyChanged()
{
Component* const newKeySource = (shortcuts.size() == 0) ? 0 : getTopLevelComponent();
if (newKeySource != keySource)
if (newKeySource != keySource.getComponent())
{
if (keySource != 0)
keySource->removeKeyListener (this);

View file

@ -1070,7 +1070,7 @@ void CodeEditorComponent::mouseWheelMove (const MouseEvent& e, float wheelIncrem
horizontalScrollBar->mouseWheelMove (e, wheelIncrementX, 0);
}
void CodeEditorComponent::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart)
void CodeEditorComponent::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart)
{
if (scrollBarThatHasMoved == verticalScrollBar)
scrollToLineInternal ((int) newRangeStart);

View file

@ -237,7 +237,7 @@ public:
/** @internal */
void timerCallback();
/** @internal */
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
/** @internal */
void handleAsyncUpdate();
/** @internal */

View file

@ -3193,7 +3193,7 @@ Component::BailOutChecker::BailOutChecker (Component* const component1, Componen
bool Component::BailOutChecker::shouldBailOut() const throw()
{
return safePointer1 == 0 || safePointer2 != component2;
return safePointer1 == 0 || safePointer2.getComponent() != component2;
}

View file

@ -1933,6 +1933,9 @@ public:
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
operator ComponentType*() const throw() { return comp; }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
ComponentType* getComponent() const throw() { return comp; }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */
ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
@ -1972,7 +1975,8 @@ public:
bool shouldBailOut() const throw();
private:
Component::SafePointer<Component> safePointer1, safePointer2;
typedef SafePointer<Component> SafeComponentPtr;
SafeComponentPtr safePointer1, safePointer2;
Component* const component2;
BailOutChecker (const BailOutChecker&);

View file

@ -115,7 +115,7 @@ ComponentAnimator::~ComponentAnimator()
void* ComponentAnimator::findTaskFor (Component* const component) const
{
for (int i = tasks.size(); --i >= 0;)
if (component == ((AnimationTask*) tasks.getUnchecked(i))->component)
if (component == ((AnimationTask*) tasks.getUnchecked(i))->component.getComponent())
return tasks.getUnchecked(i);
return 0;

View file

@ -53,7 +53,7 @@ public:
@param newRangeStart the new range start of this bar
*/
virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
const double newRangeStart) = 0;
double newRangeStart) = 0;
};

View file

@ -76,7 +76,7 @@ void Viewport::visibleAreaChanged (int, int, int, int)
//==============================================================================
void Viewport::setViewedComponent (Component* const newViewedComponent)
{
if (contentComp != newViewedComponent)
if (contentComp.getComponent() != newViewedComponent)
{
{
ScopedPointer<Component> oldCompDeleter (contentComp);
@ -284,7 +284,7 @@ void Viewport::setScrollBarButtonVisibility (const bool buttonsVisible)
horizontalScrollBar->setButtonVisibility (buttonsVisible);
}
void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart)
void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart)
{
if (scrollBarThatHasMoved == horizontalScrollBar)
{

View file

@ -231,7 +231,7 @@ public:
/** @internal */
void resized();
/** @internal */
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
/** @internal */
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
/** @internal */

View file

@ -352,7 +352,11 @@ namespace IntToCharConverters
else
{
#if JUCE_WIN32
#if _MSC_VER <= 1200
len = (int) _snwprintf (buffer, numChars, L"%.9g", n) + 1;
#else
len = (int) _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n) + 1;
#endif
#else
len = (int) swprintf (buffer, numChars, L"%.9g", n) + 1;
#endif