mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
parent
1e5113086a
commit
6d4d2b26a9
8 changed files with 78 additions and 12 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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..
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue