1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
jules 2008-01-03 21:25:17 +00:00
parent 5f98c1a6b9
commit 5ff699eee1
11 changed files with 41 additions and 22 deletions

View file

@ -1261,7 +1261,7 @@ void Slider::mouseDrag (const MouseEvent& e)
if (sliderBeingDragged == 0)
{
setValue (snapValue (valueWhenLastDragged, true),
! sendChangeOnlyOnRelease, false);
! sendChangeOnlyOnRelease, true);
}
else if (sliderBeingDragged == 1)
{

View file

@ -597,7 +597,8 @@ void Toolbar::buttonClicked (Button*)
}
//==============================================================================
bool Toolbar::isInterestedInDragSource (const String& sourceDescription)
bool Toolbar::isInterestedInDragSource (const String& sourceDescription,
Component* /*sourceComponent*/)
{
return sourceDescription == toolbarDragDescriptor && isEditingActive;
}

View file

@ -285,7 +285,7 @@ public:
/** @internal */
void mouseDown (const MouseEvent&);
/** @internal */
bool isInterestedInDragSource (const String&);
bool isInterestedInDragSource (const String&, Component*);
/** @internal */
void itemDragMove (const String&, Component*, int, int);
/** @internal */

View file

@ -116,7 +116,7 @@ public:
if (over != 0
&& over->isValidComponent()
&& source->isValidComponent()
&& currentlyOver->isInterestedInDragSource (dragDesc))
&& currentlyOver->isInterestedInDragSource (dragDesc, source))
{
currentlyOver->itemDragExit (dragDesc, source);
}
@ -163,7 +163,7 @@ public:
{
DragAndDropTarget* const ddt = dynamic_cast <DragAndDropTarget*> (hit);
if (ddt != 0 && ddt->isInterestedInDragSource (dragDesc))
if (ddt != 0 && ddt->isInterestedInDragSource (dragDesc, source))
{
relX = screenX;
relY = screenY;
@ -255,7 +255,7 @@ public:
if (over != 0
&& over->isValidComponent()
&& ! (sourceWatcher->hasBeenDeleted())
&& currentlyOver->isInterestedInDragSource (dragDesc))
&& currentlyOver->isInterestedInDragSource (dragDesc, source))
{
currentlyOver->itemDragExit (dragDesc, source);
}
@ -263,12 +263,12 @@ public:
currentlyOver = ddt;
if (currentlyOver != 0
&& currentlyOver->isInterestedInDragSource (dragDesc))
&& currentlyOver->isInterestedInDragSource (dragDesc, source))
currentlyOver->itemDragEnter (dragDesc, source, relX, relY);
}
if (currentlyOver != 0
&& currentlyOver->isInterestedInDragSource (dragDesc))
&& currentlyOver->isInterestedInDragSource (dragDesc, source))
currentlyOver->itemDragMove (dragDesc, source, relX, relY);
if (currentlyOver == 0

View file

@ -62,7 +62,8 @@ public:
@returns true if this component wants to receive the other callbacks regarging this
type of object; if it returns false, no other callbacks will be made.
*/
virtual bool isInterestedInDragSource (const String& sourceDescription) = 0;
virtual bool isInterestedInDragSource (const String& sourceDescription,
Component* sourceComponent) = 0;
/** Callback to indicate that something is being dragged over this component.

View file

@ -131,10 +131,10 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
* if the character is invalid.
*/
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
static PNG_CONST char png_digit[16] = {
/*static PNG_CONST char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'
};
};*/
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
static void /* PRIVATE */

View file

@ -68,13 +68,20 @@ forcedinline uint32 swapByteOrder (uint32 n) throw()
/** Swaps the byte-order of a 16-bit short. */
inline uint16 swapByteOrder (const uint16 n) throw()
{
#if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
// Win32 intrinsics version..
return (uint16) _byteswap_ushort (n2);
#else
return (uint16) ((n << 8) | (n >> 8));
#endif
}
inline uint64 swapByteOrder (const uint64 value) throw()
{
#if JUCE_MAC
return CFSwapInt64 (value);
#elif JUCE_USE_INTRINSICS
return _byteswap_uint64 (value);
#else
return (((int64) swapByteOrder ((uint32) value)) << 32)
| swapByteOrder ((uint32) (value >> 32));

View file

@ -52,7 +52,7 @@ BufferedInputStream::BufferedInputStream (InputStream* const source_,
if (sourceSize >= 0)
bufferSize = jmin (jmax (32, sourceSize), bufferSize);
bufferStart = position + 1;
bufferStart = position;
buffer = (char*) juce_malloc (bufferSize);
}
@ -136,18 +136,20 @@ int BufferedInputStream::read (void* destBuffer, int maxBytesToRead)
else
{
int bytesRead = 0;
char* d = (char*) destBuffer;
while (bytesRead < maxBytesToRead)
while (maxBytesToRead > 0)
{
ensureBuffered();
if (isExhausted())
break;
*d++ = buffer [position - bufferStart];
++position;
++bytesRead;
const int bytesAvailable = jmin (maxBytesToRead, (int) (lastReadPos - position));
memcpy (destBuffer, buffer + (position - bufferStart), bytesAvailable);
maxBytesToRead -= bytesAvailable;
bytesRead += bytesAvailable;
position += bytesAvailable;
destBuffer = (void*) (((char*) destBuffer) + bytesAvailable);
}
return bytesRead;

View file

@ -131,8 +131,10 @@ const int bufferSize = 32768;
GZIPDecompressorInputStream::GZIPDecompressorInputStream (InputStream* const sourceStream_,
const bool deleteSourceWhenDestroyed_,
const bool noWrap_)
const bool noWrap_,
const int64 uncompressedStreamLength_)
: sourceStream (sourceStream_),
uncompressedStreamLength (uncompressedStreamLength_),
deleteSourceWhenDestroyed (deleteSourceWhenDestroyed_),
noWrap (noWrap_),
isEof (false),
@ -150,13 +152,13 @@ GZIPDecompressorInputStream::~GZIPDecompressorInputStream()
if (deleteSourceWhenDestroyed)
delete sourceStream;
GZIPDecompressHelper* const h = (GZIPDecompressHelper*)helper;
GZIPDecompressHelper* const h = (GZIPDecompressHelper*) helper;
delete h;
}
int64 GZIPDecompressorInputStream::getTotalLength()
{
return -1; // unknown..
return uncompressedStreamLength;
}
int GZIPDecompressorInputStream::read (void* destBuffer, int howMany)

View file

@ -56,10 +56,14 @@ public:
when this object is destroyed
@param noWrap this is used internally by the ZipFile class
and should be ignored by user applications
@param uncompressedStreamLength if the creator knows the length that the
uncompressed stream will be, then it can supply this
value, which will be returned by getTotalLength()
*/
GZIPDecompressorInputStream (InputStream* const sourceStream,
const bool deleteSourceWhenDestroyed,
const bool noWrap = false);
const bool noWrap = false,
const int64 uncompressedStreamLength = -1);
/** Destructor. */
~GZIPDecompressorInputStream();
@ -77,6 +81,7 @@ public:
private:
InputStream* const sourceStream;
const int64 uncompressedStreamLength;
const bool deleteSourceWhenDestroyed, noWrap;
bool isEof;
int activeBufferSize;

View file

@ -197,7 +197,8 @@ InputStream* ZipFile::createStreamForEntry (const int index)
if (zei->compressed)
{
stream = new GZIPDecompressorInputStream (stream, true, true);
stream = new GZIPDecompressorInputStream (stream, true, true,
zei->entry.uncompressedSize);
// (much faster to unzip in big blocks using a buffer..)
stream = new BufferedInputStream (stream, 32768, true);