diff --git a/build/macosx/platform_specific_code/juce_mac_HTTPStream.h b/build/macosx/platform_specific_code/juce_mac_HTTPStream.h index a0ad3e2a32..1029f6bcae 100644 --- a/build/macosx/platform_specific_code/juce_mac_HTTPStream.h +++ b/build/macosx/platform_specific_code/juce_mac_HTTPStream.h @@ -125,7 +125,8 @@ public: lines.addLines (responseHeader); statusCode = responseHeader.fromFirstOccurrenceOf (T(" "), false, false) - .substring (4).getIntValue(); + .substring (0, 3).getIntValue(); + //int contentLength = findHeaderItem (lines, T("Content-Length:")).getIntValue(); //bool isChunked = findHeaderItem (lines, T("Transfer-Encoding:")).equalsIgnoreCase ("chunked"); diff --git a/extras/juce demo/src/binarydata/TableDemo.cpp b/extras/juce demo/src/binarydata/TableDemo.cpp index 7060bb920d..ed8ffa02eb 100644 --- a/extras/juce demo/src/binarydata/TableDemo.cpp +++ b/extras/juce demo/src/binarydata/TableDemo.cpp @@ -71,6 +71,8 @@ public: // un-comment this line to have a go of stretch-to-fit mode // table->getHeader()->setStretchToFitActive (true); + + table->setMultipleSelectionEnabled (true); } ~TableDemoComponent() diff --git a/extras/juce demo/src/demos/TableDemo.cpp b/extras/juce demo/src/demos/TableDemo.cpp index 7060bb920d..ed8ffa02eb 100644 --- a/extras/juce demo/src/demos/TableDemo.cpp +++ b/extras/juce demo/src/demos/TableDemo.cpp @@ -71,6 +71,8 @@ public: // un-comment this line to have a go of stretch-to-fit mode // table->getHeader()->setStretchToFitActive (true); + + table->setMultipleSelectionEnabled (true); } ~TableDemoComponent() diff --git a/extras/the jucer/src/model/jucer_JucerDocument.cpp b/extras/the jucer/src/model/jucer_JucerDocument.cpp index 98cd408a07..12f804a145 100644 --- a/extras/the jucer/src/model/jucer_JucerDocument.cpp +++ b/extras/the jucer/src/model/jucer_JucerDocument.cpp @@ -285,7 +285,7 @@ void JucerDocument::getOptionalMethods (StringArray& baseClasses, addMethod ("Component", "void", "lookAndFeelChanged()", "", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "bool", "hitTest (int x, int y)", "return true;", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "void", "broughtToFront()", "", baseClasses, returnValues, methods, initialContents); - addMethod ("Component", "bool", "filesDropped (const StringArray& filenames, int mouseX, int mouseY)", "return false;", baseClasses, returnValues, methods, initialContents); + addMethod ("Component", "void", "filesDropped (const StringArray& filenames, int mouseX, int mouseY)", "", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "void", "handleCommandMessage (int commandId)", "", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "void", "childrenChanged()", "", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "void", "enablementChanged()", "", baseClasses, returnValues, methods, initialContents); diff --git a/src/juce_appframework/audio/audio_file_formats/juce_FlacAudioFormat.cpp b/src/juce_appframework/audio/audio_file_formats/juce_FlacAudioFormat.cpp index b27e905961..58203aedf2 100644 --- a/src/juce_appframework/audio/audio_file_formats/juce_FlacAudioFormat.cpp +++ b/src/juce_appframework/audio/audio_file_formats/juce_FlacAudioFormat.cpp @@ -78,7 +78,7 @@ public: { FLAC__stream_decoder_process_until_end_of_metadata (decoder); - if (lengthInSamples == 0) + if (lengthInSamples == 0 && sampleRate > 0) { // the length hasn't been stored in the metadata, so we'll need to // work it out the length the hard way, by scanning the whole file.. diff --git a/src/juce_appframework/gui/components/windows/juce_DialogWindow.h b/src/juce_appframework/gui/components/windows/juce_DialogWindow.h index b2d42942ef..e9b151fa67 100644 --- a/src/juce_appframework/gui/components/windows/juce_DialogWindow.h +++ b/src/juce_appframework/gui/components/windows/juce_DialogWindow.h @@ -90,6 +90,16 @@ public: It returns the value that was returned by the dialog box's runModalLoop() call. + To close the dialog programatically, you should call exitModalState (returnValue) on + the DialogWindow that is created. To find a pointer to this window from your + contentComponent, you can do something like this: + @code + Dialogwindow* dw = contentComponent->findParentComponentOfClass ((DialogWindow*) 0); + + if (dw != 0) + dw->exitModalState (1234); + @endcode + @param dialogTitle the dialog box's title @param contentComponent the content component for the dialog box. Make sure that this has been set to the size you want it to diff --git a/src/juce_core/misc/juce_ZipFile.cpp b/src/juce_core/misc/juce_ZipFile.cpp index 496b31f0ae..33b61d4385 100644 --- a/src/juce_core/misc/juce_ZipFile.cpp +++ b/src/juce_core/misc/juce_ZipFile.cpp @@ -73,10 +73,28 @@ public: headerSize = 30 + littleEndianShort (buffer + 26) + littleEndianShort (buffer + 28); } + + if (! file_.isFromCustomStream) + { + source = file_.sourceFile.createInputStream(); + } + else + { + source = 0; +#ifdef JUCE_DEBUG + file_.numOpenStreams++; +#endif + } } ~ZipInputStream() throw() { +#ifdef JUCE_DEBUG + if (source == 0) + file.numOpenStreams--; +#endif + + delete source; } int64 getTotalLength() throw() @@ -90,11 +108,20 @@ public: return 0; howMany = (int) jmin ((int64) howMany, zipEntryInfo.compressedSize - pos); + int num; - const ScopedLock sl (file.lock); + if (source != 0) + { + source->setPosition (pos + zipEntryInfo.streamOffset + headerSize); + num = source->read (buffer, howMany); + } + else + { + const ScopedLock sl (file.lock); - file.source->setPosition (pos + zipEntryInfo.streamOffset + headerSize); - const int num = file.source->read (buffer, howMany); + file.source->setPosition (pos + zipEntryInfo.streamOffset + headerSize); + num = file.source->read (buffer, howMany); + } pos += num; return num; @@ -120,9 +147,10 @@ public: private: //============================================================================== ZipFile& file; - ZipEntryInfo& zipEntryInfo; + ZipEntryInfo zipEntryInfo; int64 pos; int headerSize; + InputStream* source; ZipInputStream (const ZipInputStream&); const ZipInputStream& operator= (const ZipInputStream&); @@ -133,13 +161,22 @@ private: ZipFile::ZipFile (InputStream* const source_, const bool deleteStreamWhenDestroyed_) throw() : source (source_), + isFromCustomStream (true), deleteStreamWhenDestroyed (deleteStreamWhenDestroyed_) +#ifdef JUCE_DEBUG + , numOpenStreams (0) +#endif { init(); } ZipFile::ZipFile (const File& file) - : deleteStreamWhenDestroyed (true) + : sourceFile (file), + isFromCustomStream (false), + deleteStreamWhenDestroyed (true) +#ifdef JUCE_DEBUG + , numOpenStreams (0) +#endif { source = file.createInputStream(); init(); @@ -149,12 +186,21 @@ ZipFile::~ZipFile() throw() { for (int i = entries.size(); --i >= 0;) { - ZipEntryInfo* const zei = (ZipEntryInfo*)(entries [i]); + ZipEntryInfo* const zei = (ZipEntryInfo*) entries [i]; delete zei; } if (deleteStreamWhenDestroyed && (source != 0)) delete source; + +#ifdef JUCE_DEBUG + // If you hit this assertion, it means you've created a stream to read + // one of the items in the zipfile, but you've forgotten to delete that + // stream object before deleting the file.. Streams can't be kept open + // after the file is deleted because they need to share the input + // stream that the file uses to read itself. + jassert (numOpenStreams == 0); +#endif } //============================================================================== @@ -165,7 +211,7 @@ int ZipFile::getNumEntries() const throw() const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw() { - ZipEntryInfo* const zei = (ZipEntryInfo*)(entries [index]); + ZipEntryInfo* const zei = (ZipEntryInfo*) entries [index]; return (zei != 0) ? &(zei->entry) : 0; @@ -187,7 +233,7 @@ const ZipFile::ZipEntry* ZipFile::getEntry (const String& fileName) const throw( InputStream* ZipFile::createStreamForEntry (const int index) { - ZipEntryInfo* const zei = (ZipEntryInfo*) (entries[index]); + ZipEntryInfo* const zei = (ZipEntryInfo*) entries[index]; InputStream* stream = 0; diff --git a/src/juce_core/misc/juce_ZipFile.h b/src/juce_core/misc/juce_ZipFile.h index 1c46623a1d..9efb65b7c3 100644 --- a/src/juce_core/misc/juce_ZipFile.h +++ b/src/juce_core/misc/juce_ZipFile.h @@ -147,9 +147,14 @@ private: friend class ZipInputStream; CriticalSection lock; InputStream* source; - bool deleteStreamWhenDestroyed; + File sourceFile; + bool isFromCustomStream, deleteStreamWhenDestroyed; int numEntries, centralRecStart; +#ifdef JUCE_DEBUG + int numOpenStreams; +#endif + void init(); int findEndOfZipEntryTable();