| @@ -126,7 +126,7 @@ int main (int argc, char* argv[]) | |||
| << " from files in " << (const char*) sourceDirectory.getFullPathName() | |||
| << "..." << std::endl << std::endl; | |||
| OwnedArray <File> files; | |||
| Array <File> files; | |||
| sourceDirectory.findChildFiles (files, File::findFiles, true, | |||
| (argc > 4) ? argv[4] : "*"); | |||
| @@ -171,7 +171,7 @@ int main (int argc, char* argv[]) | |||
| for (int i = 0; i < files.size(); ++i) | |||
| { | |||
| const File file (*(files[i])); | |||
| const File file (files[i]); | |||
| // (avoid source control files and hidden files..) | |||
| if (! isHiddenFile (file, sourceDirectory)) | |||
| @@ -312,6 +312,7 @@ | |||
| ALWAYS_SEARCH_USER_PATHS = NO; | |||
| DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | |||
| GCC_MODEL_TUNING = G5; | |||
| GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; | |||
| INFOPLIST_FILE = Info.plist; | |||
| INSTALL_PATH = "$(HOME)/Applications"; | |||
| PRODUCT_NAME = jucedemo; | |||
| @@ -5561,7 +5561,7 @@ DirectoryIterator::DirectoryIterator (const File& directory, | |||
| && ((whatToLookFor_ & File::ignoreHiddenFiles) == 0 | |||
| || ! isHidden)) | |||
| { | |||
| dirsFound.add (new File (path + filename, 0)); | |||
| dirsFound.add (File (path + filename, 0)); | |||
| } | |||
| addToList = (whatToLookFor_ & File::findDirectories) != 0; | |||
| @@ -5580,7 +5580,7 @@ DirectoryIterator::DirectoryIterator (const File& directory, | |||
| addToList = ! isHidden; | |||
| if (addToList) | |||
| filesFound.add (new File (path + filename, 0)); | |||
| filesFound.add (File (path + filename, 0)); | |||
| } | |||
| } while (juce_findFileNext (handle, filename, &isDirectory, &isHidden, 0, 0, 0, 0)); | |||
| @@ -5610,7 +5610,7 @@ bool DirectoryIterator::next() | |||
| if (index >= filesFound.size()) | |||
| { | |||
| subIterator = new DirectoryIterator (*(dirsFound [index - filesFound.size()]), | |||
| subIterator = new DirectoryIterator (dirsFound.getReference (index - filesFound.size()), | |||
| true, wildCard, whatToLookFor); | |||
| return next(); | |||
| } | |||
| @@ -5623,10 +5623,7 @@ const File DirectoryIterator::getFile() const | |||
| if (subIterator != 0) | |||
| return subIterator->getFile(); | |||
| const File* const f = filesFound [index]; | |||
| return (f != 0) ? *f | |||
| : File::nonexistent; | |||
| return filesFound [index]; | |||
| } | |||
| float DirectoryIterator::getEstimatedProgress() const | |||
| @@ -5899,11 +5896,11 @@ bool File::setReadOnly (const bool shouldBeReadOnly, | |||
| if (applyRecursively && isDirectory()) | |||
| { | |||
| OwnedArray <File> subFiles; | |||
| Array <File> subFiles; | |||
| findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
| for (int i = subFiles.size(); --i >= 0;) | |||
| worked = subFiles[i]->setReadOnly (shouldBeReadOnly, true) && worked; | |||
| worked = subFiles.getReference(i).setReadOnly (shouldBeReadOnly, true) && worked; | |||
| } | |||
| return juce_setFileReadOnly (fullPath, shouldBeReadOnly) && worked; | |||
| @@ -5921,11 +5918,11 @@ bool File::deleteRecursively() const | |||
| if (isDirectory()) | |||
| { | |||
| OwnedArray<File> subFiles; | |||
| Array<File> subFiles; | |||
| findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
| for (int i = subFiles.size(); --i >= 0;) | |||
| worked = subFiles[i]->deleteRecursively() && worked; | |||
| worked = subFiles.getReference(i).deleteRecursively() && worked; | |||
| } | |||
| return deleteFile() && worked; | |||
| @@ -5960,19 +5957,19 @@ bool File::copyDirectoryTo (const File& newDirectory) const | |||
| { | |||
| if (isDirectory() && newDirectory.createDirectory()) | |||
| { | |||
| OwnedArray<File> subFiles; | |||
| Array<File> subFiles; | |||
| findChildFiles (subFiles, File::findFiles, false); | |||
| int i; | |||
| for (i = 0; i < subFiles.size(); ++i) | |||
| if (! subFiles[i]->copyFileTo (newDirectory.getChildFile (subFiles[i]->getFileName()))) | |||
| if (! subFiles.getReference(i).copyFileTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) | |||
| return false; | |||
| subFiles.clear(); | |||
| findChildFiles (subFiles, File::findDirectories, false); | |||
| for (i = 0; i < subFiles.size(); ++i) | |||
| if (! subFiles[i]->copyDirectoryTo (newDirectory.getChildFile (subFiles[i]->getFileName()))) | |||
| if (! subFiles.getReference(i).copyDirectoryTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) | |||
| return false; | |||
| return true; | |||
| @@ -6247,7 +6244,7 @@ static inline bool fileTypeMatches (const int whatToLookFor, | |||
| || (whatToLookFor & File::ignoreHiddenFiles) == 0); | |||
| } | |||
| int File::findChildFiles (OwnedArray<File>& results, | |||
| int File::findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern) const | |||
| @@ -6276,7 +6273,7 @@ int File::findChildFiles (OwnedArray<File>& results, | |||
| if (fileTypeMatches (whatToLookFor, itemIsDirectory, itemIsHidden) | |||
| && ! filename.containsOnly (T("."))) | |||
| { | |||
| results.add (new File (path + filename, 0)); | |||
| results.add (File (path + filename, 0)); | |||
| ++total; | |||
| } | |||
| @@ -6294,16 +6291,13 @@ int File::findChildFiles (OwnedArray<File>& results, | |||
| // and recurse down if required. | |||
| if (searchRecursively) | |||
| { | |||
| OwnedArray <File> subDirectories; | |||
| Array<File> subDirectories; | |||
| findChildFiles (subDirectories, File::findDirectories, false); | |||
| for (int i = 0; i < subDirectories.size(); ++i) | |||
| { | |||
| total += subDirectories.getUnchecked(i) | |||
| ->findChildFiles (results, | |||
| whatToLookFor, | |||
| true, | |||
| wildCardPattern); | |||
| total += subDirectories.getReference(i).findChildFiles (results, whatToLookFor, | |||
| true, wildCardPattern); | |||
| } | |||
| } | |||
| @@ -6683,12 +6677,12 @@ const String File::getRelativePathFrom (const File& dir) const | |||
| return thisPath; | |||
| } | |||
| void File::findFileSystemRoots (OwnedArray<File>& destArray) | |||
| void File::findFileSystemRoots (Array<File>& destArray) | |||
| { | |||
| const StringArray roots (juce_getFileSystemRoots()); | |||
| for (int i = 0; i < roots.size(); ++i) | |||
| destArray.add (new File (roots[i])); | |||
| destArray.add (File (roots[i])); | |||
| } | |||
| const String File::getVolumeLabel() const | |||
| @@ -7009,7 +7003,7 @@ void FileSearchPath::removeNonExistentPaths() | |||
| directories.remove (i); | |||
| } | |||
| int FileSearchPath::findChildFiles (OwnedArray<File>& results, | |||
| int FileSearchPath::findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern) const | |||
| @@ -19638,36 +19632,36 @@ BEGIN_JUCE_NAMESPACE | |||
| // Mac version doesn't need any native code because it's all done with files.. | |||
| // Windows + Linux versions are in the platform-dependent code sections. | |||
| static void findCDs (OwnedArray<File>& cds) | |||
| static void findCDs (Array<File>& cds) | |||
| { | |||
| File volumes ("/Volumes"); | |||
| volumes.findChildFiles (cds, File::findDirectories, false); | |||
| for (int i = cds.size(); --i >= 0;) | |||
| if (! cds[i]->getChildFile (".TOC.plist").exists()) | |||
| if (! cds.getReference(i).getChildFile (".TOC.plist").exists()) | |||
| cds.remove (i); | |||
| } | |||
| const StringArray AudioCDReader::getAvailableCDNames() | |||
| { | |||
| OwnedArray<File> cds; | |||
| Array<File> cds; | |||
| findCDs (cds); | |||
| StringArray names; | |||
| for (int i = 0; i < cds.size(); ++i) | |||
| names.add (cds[i]->getFileName()); | |||
| names.add (cds.getReference(i).getFileName()); | |||
| return names; | |||
| } | |||
| AudioCDReader* AudioCDReader::createReaderForCD (const int index) | |||
| { | |||
| OwnedArray<File> cds; | |||
| Array<File> cds; | |||
| findCDs (cds); | |||
| if (cds[index] != 0) | |||
| return new AudioCDReader (*cds[index]); | |||
| if (cds[index] != File::nonexistent) | |||
| return new AudioCDReader (cds[index]); | |||
| else | |||
| return 0; | |||
| } | |||
| @@ -19697,10 +19691,10 @@ static int getTrackNumber (const File& file) | |||
| .getIntValue(); | |||
| } | |||
| int AudioCDReader::compareElements (const File* const first, const File* const second) throw() | |||
| int AudioCDReader::compareElements (const File& first, const File& second) | |||
| { | |||
| const int firstTrack = getTrackNumber (*first); | |||
| const int secondTrack = getTrackNumber (*second); | |||
| const int firstTrack = getTrackNumber (first); | |||
| const int secondTrack = getTrackNumber (second); | |||
| jassert (firstTrack > 0 && secondTrack > 0); | |||
| @@ -19722,7 +19716,7 @@ void AudioCDReader::refreshTrackLengths() | |||
| { | |||
| trackStartSamples.add (sample); | |||
| FileInputStream* const in = tracks[i]->createInputStream(); | |||
| FileInputStream* const in = tracks.getReference(i).createInputStream(); | |||
| if (in != 0) | |||
| { | |||
| @@ -19760,22 +19754,19 @@ bool AudioCDReader::readSamples (int** destSamples, int numDestChannels, int sta | |||
| { | |||
| reader = 0; | |||
| if (tracks [track] != 0) | |||
| { | |||
| FileInputStream* const in = tracks [track]->createInputStream(); | |||
| FileInputStream* const in = tracks [track].createInputStream(); | |||
| if (in != 0) | |||
| { | |||
| BufferedInputStream* const bin = new BufferedInputStream (in, 65536, true); | |||
| if (in != 0) | |||
| { | |||
| BufferedInputStream* const bin = new BufferedInputStream (in, 65536, true); | |||
| AiffAudioFormat format; | |||
| reader = format.createReaderFor (bin, true); | |||
| AiffAudioFormat format; | |||
| reader = format.createReaderFor (bin, true); | |||
| if (reader == 0) | |||
| currentReaderTrack = -1; | |||
| else | |||
| currentReaderTrack = track; | |||
| } | |||
| if (reader == 0) | |||
| currentReaderTrack = -1; | |||
| else | |||
| currentReaderTrack = track; | |||
| } | |||
| } | |||
| @@ -19811,7 +19802,7 @@ int AudioCDReader::getPositionOfTrackStart (int trackNum) const | |||
| bool AudioCDReader::isTrackAudio (int trackNum) const | |||
| { | |||
| return tracks [trackNum] != 0; | |||
| return tracks [trackNum] != File::nonexistent; | |||
| } | |||
| void AudioCDReader::enableIndexScanning (bool b) | |||
| @@ -29153,11 +29144,11 @@ void KnownPluginList::scanAndAddDragAndDroppedFiles (const StringArray& files, | |||
| StringArray s; | |||
| { | |||
| OwnedArray <File> subFiles; | |||
| Array<File> subFiles; | |||
| f.findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
| for (int j = 0; j < subFiles.size(); ++j) | |||
| s.add (subFiles.getUnchecked (j)->getFullPathName()); | |||
| s.add (subFiles.getReference(j).getFullPathName()); | |||
| } | |||
| scanAndAddDragAndDroppedFiles (s, typesFound); | |||
| @@ -44742,7 +44733,7 @@ public: | |||
| } | |||
| }; | |||
| class CodeEditorLine | |||
| class CodeEditorComponent::CodeEditorLine | |||
| { | |||
| public: | |||
| CodeEditorLine() throw() | |||
| @@ -44759,11 +44750,12 @@ public: | |||
| const CodeDocument::Position& selectionStart, | |||
| const CodeDocument::Position& selectionEnd) | |||
| { | |||
| OwnedArray <SyntaxToken> newTokens; | |||
| Array <SyntaxToken> newTokens; | |||
| newTokens.ensureStorageAllocated (8); | |||
| if (analyser == 0) | |||
| { | |||
| newTokens.add (new SyntaxToken (document.getLine (lineNum), -1)); | |||
| newTokens.add (SyntaxToken (document.getLine (lineNum), -1)); | |||
| } | |||
| else if (lineNum < document.getNumLines()) | |||
| { | |||
| @@ -44801,7 +44793,7 @@ public: | |||
| for (int i = newTokens.size(); --i >= 0;) | |||
| { | |||
| if (*tokens.getUnchecked(i) != *newTokens.getUnchecked(i)) | |||
| if (tokens.getReference(i) != newTokens.getReference(i)) | |||
| { | |||
| allTheSame = false; | |||
| break; | |||
| @@ -44832,22 +44824,22 @@ public: | |||
| for (int i = 0; i < tokens.size(); ++i) | |||
| { | |||
| SyntaxToken* const token = tokens.getUnchecked(i); | |||
| SyntaxToken& token = tokens.getReference(i); | |||
| if (lastType != token->tokenType) | |||
| if (lastType != token.tokenType) | |||
| { | |||
| lastType = token->tokenType; | |||
| lastType = token.tokenType; | |||
| g.setColour (owner.getColourForTokenType (lastType)); | |||
| } | |||
| g.drawSingleLineText (token->text, roundToInt (x), y + baselineOffset); | |||
| g.drawSingleLineText (token.text, roundToInt (x), y + baselineOffset); | |||
| if (i < tokens.size() - 1) | |||
| { | |||
| if (token->width < 0) | |||
| token->width = font.getStringWidthFloat (token->text); | |||
| if (token.width < 0) | |||
| token.width = font.getStringWidthFloat (token.text); | |||
| x += token->width; | |||
| x += token.width; | |||
| } | |||
| } | |||
| } | |||
| @@ -44870,13 +44862,13 @@ private: | |||
| } | |||
| }; | |||
| OwnedArray <SyntaxToken> tokens; | |||
| Array <SyntaxToken> tokens; | |||
| int highlightColumnStart, highlightColumnEnd; | |||
| static void createTokens (int startPosition, const String& lineText, | |||
| CodeDocument::Iterator& source, | |||
| CodeTokeniser* analyser, | |||
| OwnedArray <SyntaxToken>& newTokens) | |||
| Array <SyntaxToken>& newTokens) | |||
| { | |||
| CodeDocument::Iterator lastIterator (source); | |||
| const int lineLength = lineText.length(); | |||
| @@ -44895,8 +44887,8 @@ private: | |||
| if (tokenEnd > 0) | |||
| { | |||
| tokenStart -= startPosition; | |||
| newTokens.add (new SyntaxToken (lineText.substring (jmax (0, tokenStart), tokenEnd), | |||
| tokenType)); | |||
| newTokens.add (SyntaxToken (lineText.substring (jmax (0, tokenStart), tokenEnd), | |||
| tokenType)); | |||
| if (tokenEnd >= lineLength) | |||
| break; | |||
| @@ -44908,24 +44900,24 @@ private: | |||
| source = lastIterator; | |||
| } | |||
| static void replaceTabsWithSpaces (OwnedArray <SyntaxToken>& tokens, const int spacesPerTab) throw() | |||
| static void replaceTabsWithSpaces (Array <SyntaxToken>& tokens, const int spacesPerTab) throw() | |||
| { | |||
| int x = 0; | |||
| for (int i = 0; i < tokens.size(); ++i) | |||
| { | |||
| SyntaxToken* const t = tokens.getUnchecked(i); | |||
| SyntaxToken& t = tokens.getReference(i); | |||
| for (;;) | |||
| { | |||
| int tabPos = t->text.indexOfChar (T('\t')); | |||
| int tabPos = t.text.indexOfChar (T('\t')); | |||
| if (tabPos < 0) | |||
| break; | |||
| const int spacesNeeded = spacesPerTab - ((tabPos + x) % spacesPerTab); | |||
| t->text = t->text.replaceSection (tabPos, 1, String::repeatedString (T(" "), spacesNeeded)); | |||
| t.text = t.text.replaceSection (tabPos, 1, String::repeatedString (T(" "), spacesNeeded)); | |||
| } | |||
| x += t->text.length(); | |||
| x += t.text.length(); | |||
| } | |||
| } | |||
| @@ -57229,7 +57221,7 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||
| } | |||
| else | |||
| { | |||
| chosenFiles.add (new File (initialFileOrDirectory)); | |||
| chosenFiles.add (initialFileOrDirectory); | |||
| currentRoot = initialFileOrDirectory.getParentDirectory(); | |||
| filename = initialFileOrDirectory.getFileName(); | |||
| } | |||
| @@ -57343,7 +57335,7 @@ const File FileBrowserComponent::getSelectedFile (int index) const throw() | |||
| if (! filenameBox->isReadOnly()) | |||
| return currentRoot.getChildFile (filenameBox->getText()); | |||
| else | |||
| return chosenFiles[index] != 0 ? *chosenFiles[index] : File::nonexistent; | |||
| return chosenFiles[index]; | |||
| } | |||
| bool FileBrowserComponent::currentFileIsValid() const | |||
| @@ -57494,7 +57486,7 @@ void FileBrowserComponent::selectionChanged() | |||
| resetChosenFiles = false; | |||
| } | |||
| chosenFiles.add (new File (f)); | |||
| chosenFiles.add (f); | |||
| newFilenames.add (f.getRelativePathFrom (getRoot())); | |||
| } | |||
| } | |||
| @@ -57578,7 +57570,7 @@ void FileBrowserComponent::textEditorReturnKeyPressed (TextEditor&) | |||
| { | |||
| setRoot (f.getParentDirectory()); | |||
| chosenFiles.clear(); | |||
| chosenFiles.add (new File (f)); | |||
| chosenFiles.add (f); | |||
| filenameBox->setText (f.getFileName()); | |||
| } | |||
| } | |||
| @@ -57644,27 +57636,27 @@ const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArr | |||
| BitArray separators; | |||
| #if JUCE_WINDOWS | |||
| OwnedArray<File> roots; | |||
| Array<File> roots; | |||
| File::findFileSystemRoots (roots); | |||
| rootPaths.clear(); | |||
| for (int i = 0; i < roots.size(); ++i) | |||
| { | |||
| const File* const drive = roots.getUnchecked(i); | |||
| const File& drive = roots.getReference(i); | |||
| String name (drive->getFullPathName()); | |||
| String name (drive.getFullPathName()); | |||
| rootPaths.add (name); | |||
| if (drive->isOnHardDisk()) | |||
| if (drive.isOnHardDisk()) | |||
| { | |||
| String volume (drive->getVolumeLabel()); | |||
| String volume (drive.getVolumeLabel()); | |||
| if (volume.isEmpty()) | |||
| volume = TRANS("Hard Drive"); | |||
| name << " [" << drive->getVolumeLabel() << ']'; | |||
| name << " [" << drive.getVolumeLabel() << ']'; | |||
| } | |||
| else if (drive->isOnCDRomDrive()) | |||
| else if (drive.isOnCDRomDrive()) | |||
| { | |||
| name << TRANS(" [CD/DVD drive]"); | |||
| } | |||
| @@ -57690,18 +57682,18 @@ const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArr | |||
| separators.setBit (rootPaths.size()); | |||
| OwnedArray <File> volumes; | |||
| Array <File> volumes; | |||
| File vol ("/Volumes"); | |||
| vol.findChildFiles (volumes, File::findDirectories, false); | |||
| for (int i = 0; i < volumes.size(); ++i) | |||
| { | |||
| const File* const volume = volumes.getUnchecked(i); | |||
| const File& volume = volumes.getReference(i); | |||
| if (volume->isDirectory() && ! volume->getFileName().startsWithChar (T('.'))) | |||
| if (volume.isDirectory() && ! volume.getFileName().startsWithChar (T('.'))) | |||
| { | |||
| rootPaths.add (volume->getFullPathName()); | |||
| rootNames.add (volume->getFileName()); | |||
| rootPaths.add (volume.getFullPathName()); | |||
| rootNames.add (volume.getFileName()); | |||
| } | |||
| } | |||
| #endif | |||
| @@ -57777,15 +57769,10 @@ const File FileChooser::getResult() const | |||
| // to retrieve all the files that were chosen. | |||
| jassert (results.size() <= 1); | |||
| const File* const f = results.getFirst(); | |||
| if (f != 0) | |||
| return *f; | |||
| return File::nonexistent; | |||
| return results.getFirst(); | |||
| } | |||
| const OwnedArray <File>& FileChooser::getResults() const | |||
| const Array<File>& FileChooser::getResults() const | |||
| { | |||
| return results; | |||
| } | |||
| @@ -57851,7 +57838,7 @@ bool FileChooser::showDialog (const bool selectsDirectories, | |||
| if (box.show()) | |||
| { | |||
| for (int i = 0; i < browserComponent.getNumSelectedFiles(); ++i) | |||
| results.add (new File (browserComponent.getSelectedFile (i))); | |||
| results.add (browserComponent.getSelectedFile (i)); | |||
| } | |||
| } | |||
| @@ -74153,7 +74140,9 @@ void MagnifierComponent::paint (Graphics& g) | |||
| } | |||
| g.setImageResamplingQuality (quality); | |||
| g.drawImageTransformed (&temp, temp.getBounds(), AffineTransform::scale (scaleFactor, scaleFactor), false); | |||
| g.drawImageTransformed (&temp, temp.getBounds(), | |||
| AffineTransform::scale ((float) scaleFactor, (float) scaleFactor), | |||
| false); | |||
| } | |||
| void MagnifierComponent::childBoundsChanged (Component* c) | |||
| @@ -79881,6 +79870,16 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| return; | |||
| } | |||
| const int right = bounds.getRight() << 8; | |||
| // optimise for the common case where our line lies entirely within a | |||
| // single pair of points, as happens when clipping to a simple rect. | |||
| if (otherNumPoints == 2 && otherLine[2] >= 255) | |||
| { | |||
| clipEdgeTableLineToRange (dest, otherLine[1], jmin (right, otherLine[3])); | |||
| return; | |||
| } | |||
| ++otherLine; | |||
| const size_t lineSizeBytes = (dest[0] * 2 + 1) * sizeof (int); | |||
| int* temp = (int*) alloca (lineSizeBytes); | |||
| @@ -79897,7 +79896,6 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| int destIndex = 0, destTotal = 0; | |||
| int level1 = 0, level2 = 0; | |||
| int lastX = INT_MIN, lastLevel = 0; | |||
| const int right = bounds.getRight() << 8; | |||
| while (srcNum1 > 0 && srcNum2 > 0) | |||
| { | |||
| @@ -79983,6 +79981,45 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| #endif | |||
| } | |||
| void EdgeTable::clipEdgeTableLineToRange (int* dest, const int x1, const int x2) throw() | |||
| { | |||
| int* lastItem = dest + (dest[0] * 2 - 1); | |||
| if (x2 < lastItem[0]) | |||
| { | |||
| if (x2 <= dest[1]) | |||
| { | |||
| dest[0] = 0; | |||
| return; | |||
| } | |||
| while (x2 < lastItem[-2]) | |||
| { | |||
| --(dest[0]); | |||
| lastItem -= 2; | |||
| } | |||
| lastItem[0] = x2; | |||
| lastItem[1] = 0; | |||
| } | |||
| if (x1 > dest[1]) | |||
| { | |||
| while (lastItem[0] > x1) | |||
| lastItem -= 2; | |||
| const int itemsRemoved = (lastItem - (dest + 1)) / 2; | |||
| if (itemsRemoved > 0) | |||
| { | |||
| dest[0] -= itemsRemoved; | |||
| memmove (dest + 1, lastItem, dest[0] * (sizeof (int) * 2)); | |||
| } | |||
| dest[1] = x1; | |||
| } | |||
| } | |||
| void EdgeTable::clipToRectangle (const Rectangle& r) throw() | |||
| { | |||
| const Rectangle clipped (r.getIntersection (bounds)); | |||
| @@ -80008,10 +80045,17 @@ void EdgeTable::clipToRectangle (const Rectangle& r) throw() | |||
| if (clipped.getX() > bounds.getX()) | |||
| { | |||
| const int rectLine[] = { 2, clipped.getX() << 8, 255, clipped.getRight() << 8, 0 }; | |||
| const int x1 = clipped.getX() << 8; | |||
| const int x2 = jmin (bounds.getRight(), clipped.getRight()) << 8; | |||
| int* line = table + lineStrideElements * top; | |||
| for (int i = top; i < bottom; ++i) | |||
| intersectWithEdgeTableLine (i, rectLine); | |||
| for (int i = bottom - top; --i >= 0;) | |||
| { | |||
| if (line[0] != 0) | |||
| clipEdgeTableLineToRange (line, x1, x2); | |||
| line += lineStrideElements; | |||
| } | |||
| } | |||
| needToCheckEmptinesss = true; | |||
| @@ -87011,15 +87055,15 @@ Typeface::~Typeface() | |||
| { | |||
| } | |||
| class CustomTypefaceGlyphInfo | |||
| class CustomTypeface::GlyphInfo | |||
| { | |||
| public: | |||
| CustomTypefaceGlyphInfo (const juce_wchar character_, const Path& path_, const float width_) throw() | |||
| GlyphInfo (const juce_wchar character_, const Path& path_, const float width_) throw() | |||
| : character (character_), path (path_), width (width_) | |||
| { | |||
| } | |||
| ~CustomTypefaceGlyphInfo() throw() | |||
| ~GlyphInfo() throw() | |||
| { | |||
| } | |||
| @@ -87058,8 +87102,8 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| CustomTypefaceGlyphInfo (const CustomTypefaceGlyphInfo&); | |||
| const CustomTypefaceGlyphInfo& operator= (const CustomTypefaceGlyphInfo&); | |||
| GlyphInfo (const GlyphInfo&); | |||
| const GlyphInfo& operator= (const GlyphInfo&); | |||
| }; | |||
| CustomTypeface::CustomTypeface() | |||
| @@ -87136,14 +87180,14 @@ void CustomTypeface::addGlyph (const juce_wchar character, const Path& path, con | |||
| if (((unsigned int) character) < (unsigned int) numElementsInArray (lookupTable)) | |||
| lookupTable [character] = (short) glyphs.size(); | |||
| glyphs.add (new CustomTypefaceGlyphInfo (character, path, width)); | |||
| glyphs.add (new GlyphInfo (character, path, width)); | |||
| } | |||
| void CustomTypeface::addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw() | |||
| { | |||
| if (extraAmount != 0) | |||
| { | |||
| CustomTypefaceGlyphInfo* const g = findGlyph (char1, true); | |||
| GlyphInfo* const g = findGlyph (char1, true); | |||
| jassert (g != 0); // can only add kerning pairs for characters that exist! | |||
| if (g != 0) | |||
| @@ -87151,14 +87195,14 @@ void CustomTypeface::addKerningPair (const juce_wchar char1, const juce_wchar ch | |||
| } | |||
| } | |||
| CustomTypefaceGlyphInfo* CustomTypeface::findGlyph (const juce_wchar character, const bool loadIfNeeded) throw() | |||
| CustomTypeface::GlyphInfo* CustomTypeface::findGlyph (const juce_wchar character, const bool loadIfNeeded) throw() | |||
| { | |||
| if (((unsigned int) character) < (unsigned int) numElementsInArray (lookupTable) && lookupTable [character] > 0) | |||
| return glyphs [(int) lookupTable [(int) character]]; | |||
| for (int i = 0; i < glyphs.size(); ++i) | |||
| { | |||
| CustomTypefaceGlyphInfo* const g = glyphs.getUnchecked(i); | |||
| GlyphInfo* const g = glyphs.getUnchecked(i); | |||
| if (g->character == character) | |||
| return g; | |||
| } | |||
| @@ -87169,9 +87213,9 @@ CustomTypefaceGlyphInfo* CustomTypeface::findGlyph (const juce_wchar character, | |||
| return 0; | |||
| } | |||
| CustomTypefaceGlyphInfo* CustomTypeface::findGlyphSubstituting (const juce_wchar character) throw() | |||
| CustomTypeface::GlyphInfo* CustomTypeface::findGlyphSubstituting (const juce_wchar character) throw() | |||
| { | |||
| CustomTypefaceGlyphInfo* glyph = findGlyph (character, true); | |||
| GlyphInfo* glyph = findGlyph (character, true); | |||
| if (glyph == 0) | |||
| { | |||
| @@ -87250,7 +87294,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) | |||
| for (i = 0; i < glyphs.size(); ++i) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const g = glyphs.getUnchecked (i); | |||
| const GlyphInfo* const g = glyphs.getUnchecked (i); | |||
| out.writeShort ((short) (unsigned short) g->character); | |||
| out.writeFloat (g->width); | |||
| g->path.writePathToStream (out); | |||
| @@ -87262,11 +87306,11 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) | |||
| for (i = 0; i < glyphs.size(); ++i) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const g = glyphs.getUnchecked (i); | |||
| const GlyphInfo* const g = glyphs.getUnchecked (i); | |||
| for (int j = 0; j < g->kerningPairs.size(); ++j) | |||
| { | |||
| const CustomTypefaceGlyphInfo::KerningPair& p = g->kerningPairs.getReference (j); | |||
| const GlyphInfo::KerningPair& p = g->kerningPairs.getReference (j); | |||
| out.writeShort ((short) (unsigned short) g->character); | |||
| out.writeShort ((short) (unsigned short) p.character2); | |||
| out.writeFloat (p.kerningAmount); | |||
| @@ -87293,7 +87337,7 @@ float CustomTypeface::getStringWidth (const String& text) | |||
| while (*t != 0) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const glyph = findGlyphSubstituting (*t++); | |||
| const GlyphInfo* const glyph = findGlyphSubstituting (*t++); | |||
| if (glyph != 0) | |||
| x += glyph->getHorizontalSpacing (*t); | |||
| @@ -87311,7 +87355,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array <int>& resultG | |||
| while (*t != 0) | |||
| { | |||
| const juce_wchar c = *t++; | |||
| const CustomTypefaceGlyphInfo* const glyph = findGlyphSubstituting (c); | |||
| const GlyphInfo* const glyph = findGlyphSubstituting (c); | |||
| if (glyph != 0) | |||
| { | |||
| @@ -87324,7 +87368,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array <int>& resultG | |||
| bool CustomTypeface::getOutlineForGlyph (int glyphNumber, Path& path) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const glyph = findGlyphSubstituting ((juce_wchar) glyphNumber); | |||
| const GlyphInfo* const glyph = findGlyphSubstituting ((juce_wchar) glyphNumber); | |||
| if (glyph != 0) | |||
| { | |||
| path = glyph->path; | |||
| @@ -217969,7 +218013,7 @@ private: | |||
| const FPComponentHolder& operator= (const FPComponentHolder&); | |||
| }; | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -218060,7 +218104,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| { | |||
| const String stringFName (fname); | |||
| results.add (new File (File (stringFName).getSiblingFile (returnedString))); | |||
| results.add (File (stringFName).getSiblingFile (returnedString)); | |||
| returnedString = String::empty; | |||
| return; | |||
| @@ -218151,13 +218195,13 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| while (*filename != 0) | |||
| { | |||
| const String filepath (String (files) + T("\\") + String (filename)); | |||
| results.add (new File (filepath)); | |||
| results.add (File (filepath)); | |||
| filename += CharacterFunctions::length (filename) + 1; | |||
| } | |||
| } | |||
| else if (files[0] != 0) | |||
| { | |||
| results.add (new File (files)); | |||
| results.add (File (files)); | |||
| } | |||
| } | |||
| @@ -236904,7 +236948,7 @@ int AudioCDReader::getCDDBId() | |||
| // compiled on its own). | |||
| #if JUCE_INCLUDED_FILE | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& file, | |||
| const String& filters, | |||
| @@ -236966,7 +237010,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| tokens.add (resultString); | |||
| for (int i = 0; i < tokens.size(); i++) | |||
| results.add (new File (tokens[i])); | |||
| results.add (File (tokens[i])); | |||
| return; | |||
| } | |||
| @@ -241968,7 +242012,7 @@ using namespace JUCE_NAMESPACE; | |||
| BEGIN_JUCE_NAMESPACE | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -242022,7 +242066,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| { | |||
| if (isSaveDialogue) | |||
| { | |||
| results.add (new File (nsStringToJuce ([panel filename]))); | |||
| results.add (File (nsStringToJuce ([panel filename]))); | |||
| } | |||
| else | |||
| { | |||
| @@ -242031,7 +242075,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| for (unsigned int i = 0; i < [urls count]; ++i) | |||
| { | |||
| NSString* f = [urls objectAtIndex: i]; | |||
| results.add (new File (nsStringToJuce (f))); | |||
| results.add (File (nsStringToJuce (f))); | |||
| } | |||
| } | |||
| } | |||
| @@ -242041,7 +242085,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| #else | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -248168,7 +248212,7 @@ using namespace JUCE_NAMESPACE; | |||
| BEGIN_JUCE_NAMESPACE | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -248222,7 +248266,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| { | |||
| if (isSaveDialogue) | |||
| { | |||
| results.add (new File (nsStringToJuce ([panel filename]))); | |||
| results.add (File (nsStringToJuce ([panel filename]))); | |||
| } | |||
| else | |||
| { | |||
| @@ -248231,7 +248275,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| for (unsigned int i = 0; i < [urls count]; ++i) | |||
| { | |||
| NSString* f = [urls objectAtIndex: i]; | |||
| results.add (new File (nsStringToJuce (f))); | |||
| results.add (File (nsStringToJuce (f))); | |||
| } | |||
| } | |||
| } | |||
| @@ -248241,7 +248285,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| #else | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -3962,7 +3962,7 @@ public: | |||
| ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */ | |||
| }; | |||
| int findChildFiles (OwnedArray<File>& results, | |||
| int findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern = JUCE_T("*")) const; | |||
| @@ -3994,7 +3994,7 @@ public: | |||
| const bool asUnicode = false, | |||
| const bool writeUnicodeHeaderBytes = false) const; | |||
| static void findFileSystemRoots (OwnedArray<File>& results); | |||
| static void findFileSystemRoots (Array<File>& results); | |||
| const String getVolumeLabel() const; | |||
| @@ -7281,8 +7281,8 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| OwnedArray <File> filesFound; | |||
| OwnedArray <File> dirsFound; | |||
| Array <File> filesFound; | |||
| Array <File> dirsFound; | |||
| String wildCard; | |||
| int index; | |||
| const int whatToLookFor; | |||
| @@ -7414,7 +7414,7 @@ public: | |||
| void removeNonExistentPaths(); | |||
| int findChildFiles (OwnedArray<File>& results, | |||
| int findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern = JUCE_T("*")) const; | |||
| @@ -9655,6 +9655,7 @@ private: | |||
| void addEdgePoint (const int x, const int y, const int winding) throw(); | |||
| void remapTableForNumEdges (const int newNumEdgesPerLine) throw(); | |||
| void intersectWithEdgeTableLine (const int y, const int* otherLine) throw(); | |||
| void clipEdgeTableLineToRange (int* line, int x1, int x2) throw(); | |||
| void sanitiseLevels (const bool useNonZeroWinding) throw(); | |||
| }; | |||
| @@ -9873,7 +9874,6 @@ private: | |||
| /********* End of inlined file: juce_Path.h *********/ | |||
| class Font; | |||
| class CustomTypefaceGlyphInfo; | |||
| class JUCE_API Typeface : public ReferenceCountedObject | |||
| { | |||
| @@ -9952,14 +9952,16 @@ protected: | |||
| private: | |||
| OwnedArray <CustomTypefaceGlyphInfo> glyphs; | |||
| class GlyphInfo; | |||
| friend class OwnedArray<GlyphInfo>; | |||
| OwnedArray <GlyphInfo> glyphs; | |||
| short lookupTable [128]; | |||
| CustomTypeface (const CustomTypeface&); | |||
| const CustomTypeface& operator= (const CustomTypeface&); | |||
| CustomTypefaceGlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw(); | |||
| CustomTypefaceGlyphInfo* findGlyphSubstituting (const juce_wchar character) throw(); | |||
| GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw(); | |||
| GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw(); | |||
| }; | |||
| #endif // __JUCE_TYPEFACE_JUCEHEADER__ | |||
| @@ -13420,13 +13422,13 @@ private: | |||
| #if JUCE_MAC | |||
| File volumeDir; | |||
| OwnedArray<File> tracks; | |||
| Array <int> trackStartSamples; | |||
| Array<File> tracks; | |||
| Array<int> trackStartSamples; | |||
| int currentReaderTrack; | |||
| ScopedPointer <AudioFormatReader> reader; | |||
| AudioCDReader (const File& volume); | |||
| public: | |||
| static int compareElements (const File* const, const File* const) throw(); | |||
| static int compareElements (const File&, const File&); | |||
| private: | |||
| #elif JUCE_WINDOWS | |||
| @@ -16737,7 +16739,6 @@ public: | |||
| private: | |||
| friend class MidiComparator; | |||
| friend class MidiFile; | |||
| OwnedArray <MidiEventHolder> list; | |||
| @@ -20109,8 +20110,6 @@ public: | |||
| #endif // __JUCE_CODETOKENISER_JUCEHEADER__ | |||
| /********* End of inlined file: juce_CodeTokeniser.h *********/ | |||
| class CodeEditorLine; | |||
| class JUCE_API CodeEditorComponent : public Component, | |||
| public Timer, | |||
| public ScrollBarListener, | |||
| @@ -20251,6 +20250,7 @@ private: | |||
| CodeTokeniser* codeTokeniser; | |||
| Array <Colour> coloursForTokenCategories; | |||
| class CodeEditorLine; | |||
| OwnedArray <CodeEditorLine> lines; | |||
| void rebuildLineTokens(); | |||
| @@ -21763,7 +21763,7 @@ private: | |||
| int flags; | |||
| File currentRoot; | |||
| OwnedArray <File> chosenFiles; | |||
| Array<File> chosenFiles; | |||
| SortedSet <void*> listeners; | |||
| DirectoryContentsDisplayComponent* fileListComponent; | |||
| @@ -21817,14 +21817,14 @@ public: | |||
| const File getResult() const; | |||
| const OwnedArray <File>& getResults() const; | |||
| const Array<File>& getResults() const; | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| String title, filters; | |||
| File startingFile; | |||
| OwnedArray <File> results; | |||
| Array<File> results; | |||
| bool useNativeDialogBox; | |||
| bool showDialog (const bool selectsDirectories, | |||
| @@ -21834,7 +21834,7 @@ private: | |||
| const bool selectMultipleFiles, | |||
| FilePreviewComponent* const previewComponent); | |||
| static void showPlatformDialog (OwnedArray<File>& results, | |||
| static void showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& file, | |||
| const String& filters, | |||
| @@ -23862,9 +23862,9 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| class Token; | |||
| private: | |||
| class Token; | |||
| friend class OwnedArray <Token>; | |||
| OwnedArray <Token> tokens; | |||
| int totalLines; | |||
| }; | |||
| @@ -25921,6 +25921,7 @@ public: | |||
| private: | |||
| class OpenGLComponentWatcher; | |||
| friend class ScopedPointer <OpenGLComponentWatcher>; | |||
| ScopedPointer <OpenGLComponentWatcher> componentWatcher; | |||
| OpenGLContext* context; | |||
| @@ -29,6 +29,7 @@ | |||
| #include "../utilities/juce_PropertiesFile.h" | |||
| #include "../utilities/juce_DeletedAtShutdown.h" | |||
| #include "../core/juce_Singleton.h" | |||
| #include "../containers/juce_ScopedPointer.h" | |||
| //============================================================================== | |||
| @@ -39,36 +39,36 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../io/streams/juce_BufferedInputStream.h" | |||
| static void findCDs (OwnedArray<File>& cds) | |||
| static void findCDs (Array<File>& cds) | |||
| { | |||
| File volumes ("/Volumes"); | |||
| volumes.findChildFiles (cds, File::findDirectories, false); | |||
| for (int i = cds.size(); --i >= 0;) | |||
| if (! cds[i]->getChildFile (".TOC.plist").exists()) | |||
| if (! cds.getReference(i).getChildFile (".TOC.plist").exists()) | |||
| cds.remove (i); | |||
| } | |||
| const StringArray AudioCDReader::getAvailableCDNames() | |||
| { | |||
| OwnedArray<File> cds; | |||
| Array<File> cds; | |||
| findCDs (cds); | |||
| StringArray names; | |||
| for (int i = 0; i < cds.size(); ++i) | |||
| names.add (cds[i]->getFileName()); | |||
| names.add (cds.getReference(i).getFileName()); | |||
| return names; | |||
| } | |||
| AudioCDReader* AudioCDReader::createReaderForCD (const int index) | |||
| { | |||
| OwnedArray<File> cds; | |||
| Array<File> cds; | |||
| findCDs (cds); | |||
| if (cds[index] != 0) | |||
| return new AudioCDReader (*cds[index]); | |||
| if (cds[index] != File::nonexistent) | |||
| return new AudioCDReader (cds[index]); | |||
| else | |||
| return 0; | |||
| } | |||
| @@ -98,10 +98,10 @@ static int getTrackNumber (const File& file) | |||
| .getIntValue(); | |||
| } | |||
| int AudioCDReader::compareElements (const File* const first, const File* const second) throw() | |||
| int AudioCDReader::compareElements (const File& first, const File& second) | |||
| { | |||
| const int firstTrack = getTrackNumber (*first); | |||
| const int secondTrack = getTrackNumber (*second); | |||
| const int firstTrack = getTrackNumber (first); | |||
| const int secondTrack = getTrackNumber (second); | |||
| jassert (firstTrack > 0 && secondTrack > 0); | |||
| @@ -123,7 +123,7 @@ void AudioCDReader::refreshTrackLengths() | |||
| { | |||
| trackStartSamples.add (sample); | |||
| FileInputStream* const in = tracks[i]->createInputStream(); | |||
| FileInputStream* const in = tracks.getReference(i).createInputStream(); | |||
| if (in != 0) | |||
| { | |||
| @@ -161,22 +161,19 @@ bool AudioCDReader::readSamples (int** destSamples, int numDestChannels, int sta | |||
| { | |||
| reader = 0; | |||
| if (tracks [track] != 0) | |||
| { | |||
| FileInputStream* const in = tracks [track]->createInputStream(); | |||
| FileInputStream* const in = tracks [track].createInputStream(); | |||
| if (in != 0) | |||
| { | |||
| BufferedInputStream* const bin = new BufferedInputStream (in, 65536, true); | |||
| if (in != 0) | |||
| { | |||
| BufferedInputStream* const bin = new BufferedInputStream (in, 65536, true); | |||
| AiffAudioFormat format; | |||
| reader = format.createReaderFor (bin, true); | |||
| AiffAudioFormat format; | |||
| reader = format.createReaderFor (bin, true); | |||
| if (reader == 0) | |||
| currentReaderTrack = -1; | |||
| else | |||
| currentReaderTrack = track; | |||
| } | |||
| if (reader == 0) | |||
| currentReaderTrack = -1; | |||
| else | |||
| currentReaderTrack = track; | |||
| } | |||
| } | |||
| @@ -212,7 +209,7 @@ int AudioCDReader::getPositionOfTrackStart (int trackNum) const | |||
| bool AudioCDReader::isTrackAudio (int trackNum) const | |||
| { | |||
| return tracks [trackNum] != 0; | |||
| return tracks [trackNum] != File::nonexistent; | |||
| } | |||
| void AudioCDReader::enableIndexScanning (bool b) | |||
| @@ -30,6 +30,7 @@ | |||
| #include "juce_AudioFormatReader.h" | |||
| #include "../../containers/juce_Array.h" | |||
| #include "../../containers/juce_ScopedPointer.h" | |||
| #include "../../text/juce_StringArray.h" | |||
| #if JUCE_MAC | |||
| #include "../../io/files/juce_File.h" | |||
| @@ -152,13 +153,13 @@ private: | |||
| #if JUCE_MAC | |||
| File volumeDir; | |||
| OwnedArray<File> tracks; | |||
| Array <int> trackStartSamples; | |||
| Array<File> tracks; | |||
| Array<int> trackStartSamples; | |||
| int currentReaderTrack; | |||
| ScopedPointer <AudioFormatReader> reader; | |||
| AudioCDReader (const File& volume); | |||
| public: | |||
| static int compareElements (const File* const, const File* const) throw(); | |||
| static int compareElements (const File&, const File&); | |||
| private: | |||
| #elif JUCE_WINDOWS | |||
| @@ -33,6 +33,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_FlacAudioFormat.h" | |||
| #include "juce_OggVorbisAudioFormat.h" | |||
| #include "../../io/files/juce_FileInputStream.h" | |||
| #include "../../containers/juce_ScopedPointer.h" | |||
| //============================================================================== | |||
| @@ -78,6 +78,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_FlacAudioFormat.h" | |||
| #include "../../text/juce_LocalisedStrings.h" | |||
| #include "../../containers/juce_ScopedPointer.h" | |||
| using namespace FlacNamespace; | |||
| @@ -65,6 +65,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../text/juce_LocalisedStrings.h" | |||
| #include "../../threads/juce_Thread.h" | |||
| #include "../../io/network/juce_URL.h" | |||
| #include "../../containers/juce_ScopedPointer.h" | |||
| bool juce_OpenQuickTimeMovieFromStream (InputStream* input, Movie& movie, Handle& dataHandle); | |||
| @@ -278,7 +278,6 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| friend class MidiComparator; | |||
| friend class MidiFile; | |||
| OwnedArray <MidiEventHolder> list; | |||
| @@ -198,11 +198,11 @@ void KnownPluginList::scanAndAddDragAndDroppedFiles (const StringArray& files, | |||
| StringArray s; | |||
| { | |||
| OwnedArray <File> subFiles; | |||
| Array<File> subFiles; | |||
| f.findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
| for (int j = 0; j < subFiles.size(); ++j) | |||
| s.add (subFiles.getUnchecked (j)->getFullPathName()); | |||
| s.add (subFiles.getReference(j).getFullPathName()); | |||
| } | |||
| scanAndAddDragAndDroppedFiles (s, typesFound); | |||
| @@ -28,6 +28,7 @@ | |||
| #include "juce_Logger.h" | |||
| #include "../io/files/juce_File.h" | |||
| #include "../containers/juce_ScopedPointer.h" | |||
| //============================================================================== | |||
| @@ -69,7 +69,7 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| class CodeEditorLine | |||
| class CodeEditorComponent::CodeEditorLine | |||
| { | |||
| public: | |||
| CodeEditorLine() throw() | |||
| @@ -86,11 +86,12 @@ public: | |||
| const CodeDocument::Position& selectionStart, | |||
| const CodeDocument::Position& selectionEnd) | |||
| { | |||
| OwnedArray <SyntaxToken> newTokens; | |||
| Array <SyntaxToken> newTokens; | |||
| newTokens.ensureStorageAllocated (8); | |||
| if (analyser == 0) | |||
| { | |||
| newTokens.add (new SyntaxToken (document.getLine (lineNum), -1)); | |||
| newTokens.add (SyntaxToken (document.getLine (lineNum), -1)); | |||
| } | |||
| else if (lineNum < document.getNumLines()) | |||
| { | |||
| @@ -128,7 +129,7 @@ public: | |||
| for (int i = newTokens.size(); --i >= 0;) | |||
| { | |||
| if (*tokens.getUnchecked(i) != *newTokens.getUnchecked(i)) | |||
| if (tokens.getReference(i) != newTokens.getReference(i)) | |||
| { | |||
| allTheSame = false; | |||
| break; | |||
| @@ -159,22 +160,22 @@ public: | |||
| for (int i = 0; i < tokens.size(); ++i) | |||
| { | |||
| SyntaxToken* const token = tokens.getUnchecked(i); | |||
| SyntaxToken& token = tokens.getReference(i); | |||
| if (lastType != token->tokenType) | |||
| if (lastType != token.tokenType) | |||
| { | |||
| lastType = token->tokenType; | |||
| lastType = token.tokenType; | |||
| g.setColour (owner.getColourForTokenType (lastType)); | |||
| } | |||
| g.drawSingleLineText (token->text, roundToInt (x), y + baselineOffset); | |||
| g.drawSingleLineText (token.text, roundToInt (x), y + baselineOffset); | |||
| if (i < tokens.size() - 1) | |||
| { | |||
| if (token->width < 0) | |||
| token->width = font.getStringWidthFloat (token->text); | |||
| if (token.width < 0) | |||
| token.width = font.getStringWidthFloat (token.text); | |||
| x += token->width; | |||
| x += token.width; | |||
| } | |||
| } | |||
| } | |||
| @@ -197,13 +198,13 @@ private: | |||
| } | |||
| }; | |||
| OwnedArray <SyntaxToken> tokens; | |||
| Array <SyntaxToken> tokens; | |||
| int highlightColumnStart, highlightColumnEnd; | |||
| static void createTokens (int startPosition, const String& lineText, | |||
| CodeDocument::Iterator& source, | |||
| CodeTokeniser* analyser, | |||
| OwnedArray <SyntaxToken>& newTokens) | |||
| Array <SyntaxToken>& newTokens) | |||
| { | |||
| CodeDocument::Iterator lastIterator (source); | |||
| const int lineLength = lineText.length(); | |||
| @@ -222,8 +223,8 @@ private: | |||
| if (tokenEnd > 0) | |||
| { | |||
| tokenStart -= startPosition; | |||
| newTokens.add (new SyntaxToken (lineText.substring (jmax (0, tokenStart), tokenEnd), | |||
| tokenType)); | |||
| newTokens.add (SyntaxToken (lineText.substring (jmax (0, tokenStart), tokenEnd), | |||
| tokenType)); | |||
| if (tokenEnd >= lineLength) | |||
| break; | |||
| @@ -235,24 +236,24 @@ private: | |||
| source = lastIterator; | |||
| } | |||
| static void replaceTabsWithSpaces (OwnedArray <SyntaxToken>& tokens, const int spacesPerTab) throw() | |||
| static void replaceTabsWithSpaces (Array <SyntaxToken>& tokens, const int spacesPerTab) throw() | |||
| { | |||
| int x = 0; | |||
| for (int i = 0; i < tokens.size(); ++i) | |||
| { | |||
| SyntaxToken* const t = tokens.getUnchecked(i); | |||
| SyntaxToken& t = tokens.getReference(i); | |||
| for (;;) | |||
| { | |||
| int tabPos = t->text.indexOfChar (T('\t')); | |||
| int tabPos = t.text.indexOfChar (T('\t')); | |||
| if (tabPos < 0) | |||
| break; | |||
| const int spacesNeeded = spacesPerTab - ((tabPos + x) % spacesPerTab); | |||
| t->text = t->text.replaceSection (tabPos, 1, String::repeatedString (T(" "), spacesNeeded)); | |||
| t.text = t.text.replaceSection (tabPos, 1, String::repeatedString (T(" "), spacesNeeded)); | |||
| } | |||
| x += t->text.length(); | |||
| x += t.text.length(); | |||
| } | |||
| } | |||
| @@ -30,7 +30,6 @@ | |||
| #include "../layout/juce_ScrollBar.h" | |||
| #include "juce_CodeDocument.h" | |||
| #include "juce_CodeTokeniser.h" | |||
| class CodeEditorLine; | |||
| //============================================================================== | |||
| @@ -271,6 +270,7 @@ private: | |||
| CodeTokeniser* codeTokeniser; | |||
| Array <Colour> coloursForTokenCategories; | |||
| class CodeEditorLine; | |||
| OwnedArray <CodeEditorLine> lines; | |||
| void rebuildLineTokens(); | |||
| @@ -66,7 +66,7 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||
| } | |||
| else | |||
| { | |||
| chosenFiles.add (new File (initialFileOrDirectory)); | |||
| chosenFiles.add (initialFileOrDirectory); | |||
| currentRoot = initialFileOrDirectory.getParentDirectory(); | |||
| filename = initialFileOrDirectory.getFileName(); | |||
| } | |||
| @@ -182,7 +182,7 @@ const File FileBrowserComponent::getSelectedFile (int index) const throw() | |||
| if (! filenameBox->isReadOnly()) | |||
| return currentRoot.getChildFile (filenameBox->getText()); | |||
| else | |||
| return chosenFiles[index] != 0 ? *chosenFiles[index] : File::nonexistent; | |||
| return chosenFiles[index]; | |||
| } | |||
| bool FileBrowserComponent::currentFileIsValid() const | |||
| @@ -337,7 +337,7 @@ void FileBrowserComponent::selectionChanged() | |||
| resetChosenFiles = false; | |||
| } | |||
| chosenFiles.add (new File (f)); | |||
| chosenFiles.add (f); | |||
| newFilenames.add (f.getRelativePathFrom (getRoot())); | |||
| } | |||
| } | |||
| @@ -422,7 +422,7 @@ void FileBrowserComponent::textEditorReturnKeyPressed (TextEditor&) | |||
| { | |||
| setRoot (f.getParentDirectory()); | |||
| chosenFiles.clear(); | |||
| chosenFiles.add (new File (f)); | |||
| chosenFiles.add (f); | |||
| filenameBox->setText (f.getFileName()); | |||
| } | |||
| } | |||
| @@ -490,27 +490,27 @@ const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArr | |||
| BitArray separators; | |||
| #if JUCE_WINDOWS | |||
| OwnedArray<File> roots; | |||
| Array<File> roots; | |||
| File::findFileSystemRoots (roots); | |||
| rootPaths.clear(); | |||
| for (int i = 0; i < roots.size(); ++i) | |||
| { | |||
| const File* const drive = roots.getUnchecked(i); | |||
| const File& drive = roots.getReference(i); | |||
| String name (drive->getFullPathName()); | |||
| String name (drive.getFullPathName()); | |||
| rootPaths.add (name); | |||
| if (drive->isOnHardDisk()) | |||
| if (drive.isOnHardDisk()) | |||
| { | |||
| String volume (drive->getVolumeLabel()); | |||
| String volume (drive.getVolumeLabel()); | |||
| if (volume.isEmpty()) | |||
| volume = TRANS("Hard Drive"); | |||
| name << " [" << drive->getVolumeLabel() << ']'; | |||
| name << " [" << drive.getVolumeLabel() << ']'; | |||
| } | |||
| else if (drive->isOnCDRomDrive()) | |||
| else if (drive.isOnCDRomDrive()) | |||
| { | |||
| name << TRANS(" [CD/DVD drive]"); | |||
| } | |||
| @@ -536,18 +536,18 @@ const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArr | |||
| separators.setBit (rootPaths.size()); | |||
| OwnedArray <File> volumes; | |||
| Array <File> volumes; | |||
| File vol ("/Volumes"); | |||
| vol.findChildFiles (volumes, File::findDirectories, false); | |||
| for (int i = 0; i < volumes.size(); ++i) | |||
| { | |||
| const File* const volume = volumes.getUnchecked(i); | |||
| const File& volume = volumes.getReference(i); | |||
| if (volume->isDirectory() && ! volume->getFileName().startsWithChar (T('.'))) | |||
| if (volume.isDirectory() && ! volume.getFileName().startsWithChar (T('.'))) | |||
| { | |||
| rootPaths.add (volume->getFullPathName()); | |||
| rootNames.add (volume->getFileName()); | |||
| rootPaths.add (volume.getFullPathName()); | |||
| rootNames.add (volume.getFileName()); | |||
| } | |||
| } | |||
| #endif | |||
| @@ -212,7 +212,7 @@ private: | |||
| int flags; | |||
| File currentRoot; | |||
| OwnedArray <File> chosenFiles; | |||
| Array<File> chosenFiles; | |||
| SortedSet <void*> listeners; | |||
| DirectoryContentsDisplayComponent* fileListComponent; | |||
| @@ -87,15 +87,10 @@ const File FileChooser::getResult() const | |||
| // to retrieve all the files that were chosen. | |||
| jassert (results.size() <= 1); | |||
| const File* const f = results.getFirst(); | |||
| if (f != 0) | |||
| return *f; | |||
| return File::nonexistent; | |||
| return results.getFirst(); | |||
| } | |||
| const OwnedArray <File>& FileChooser::getResults() const | |||
| const Array<File>& FileChooser::getResults() const | |||
| { | |||
| return results; | |||
| } | |||
| @@ -161,7 +156,7 @@ bool FileChooser::showDialog (const bool selectsDirectories, | |||
| if (box.show()) | |||
| { | |||
| for (int i = 0; i < browserComponent.getNumSelectedFiles(); ++i) | |||
| results.add (new File (browserComponent.getSelectedFile (i))); | |||
| results.add (browserComponent.getSelectedFile (i)); | |||
| } | |||
| } | |||
| @@ -167,7 +167,7 @@ public: | |||
| @see getResult | |||
| */ | |||
| const OwnedArray <File>& getResults() const; | |||
| const Array<File>& getResults() const; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -175,7 +175,7 @@ public: | |||
| private: | |||
| String title, filters; | |||
| File startingFile; | |||
| OwnedArray <File> results; | |||
| Array<File> results; | |||
| bool useNativeDialogBox; | |||
| bool showDialog (const bool selectsDirectories, | |||
| @@ -185,7 +185,7 @@ private: | |||
| const bool selectMultipleFiles, | |||
| FilePreviewComponent* const previewComponent); | |||
| static void showPlatformDialog (OwnedArray<File>& results, | |||
| static void showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& file, | |||
| const String& filters, | |||
| @@ -275,7 +275,9 @@ void MagnifierComponent::paint (Graphics& g) | |||
| } | |||
| g.setImageResamplingQuality (quality); | |||
| g.drawImageTransformed (&temp, temp.getBounds(), AffineTransform::scale (scaleFactor, scaleFactor), false); | |||
| g.drawImageTransformed (&temp, temp.getBounds(), | |||
| AffineTransform::scale ((float) scaleFactor, (float) scaleFactor), | |||
| false); | |||
| } | |||
| void MagnifierComponent::childBoundsChanged (Component* c) | |||
| @@ -332,6 +332,7 @@ public: | |||
| private: | |||
| class OpenGLComponentWatcher; | |||
| friend class ScopedPointer <OpenGLComponentWatcher>; | |||
| ScopedPointer <OpenGLComponentWatcher> componentWatcher; | |||
| OpenGLContext* context; | |||
| @@ -435,6 +435,16 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| return; | |||
| } | |||
| const int right = bounds.getRight() << 8; | |||
| // optimise for the common case where our line lies entirely within a | |||
| // single pair of points, as happens when clipping to a simple rect. | |||
| if (otherNumPoints == 2 && otherLine[2] >= 255) | |||
| { | |||
| clipEdgeTableLineToRange (dest, otherLine[1], jmin (right, otherLine[3])); | |||
| return; | |||
| } | |||
| ++otherLine; | |||
| const size_t lineSizeBytes = (dest[0] * 2 + 1) * sizeof (int); | |||
| int* temp = (int*) alloca (lineSizeBytes); | |||
| @@ -451,7 +461,6 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| int destIndex = 0, destTotal = 0; | |||
| int level1 = 0, level2 = 0; | |||
| int lastX = INT_MIN, lastLevel = 0; | |||
| const int right = bounds.getRight() << 8; | |||
| while (srcNum1 > 0 && srcNum2 > 0) | |||
| { | |||
| @@ -537,6 +546,46 @@ void EdgeTable::intersectWithEdgeTableLine (const int y, const int* otherLine) t | |||
| #endif | |||
| } | |||
| void EdgeTable::clipEdgeTableLineToRange (int* dest, const int x1, const int x2) throw() | |||
| { | |||
| int* lastItem = dest + (dest[0] * 2 - 1); | |||
| if (x2 < lastItem[0]) | |||
| { | |||
| if (x2 <= dest[1]) | |||
| { | |||
| dest[0] = 0; | |||
| return; | |||
| } | |||
| while (x2 < lastItem[-2]) | |||
| { | |||
| --(dest[0]); | |||
| lastItem -= 2; | |||
| } | |||
| lastItem[0] = x2; | |||
| lastItem[1] = 0; | |||
| } | |||
| if (x1 > dest[1]) | |||
| { | |||
| while (lastItem[0] > x1) | |||
| lastItem -= 2; | |||
| const int itemsRemoved = (lastItem - (dest + 1)) / 2; | |||
| if (itemsRemoved > 0) | |||
| { | |||
| dest[0] -= itemsRemoved; | |||
| memmove (dest + 1, lastItem, dest[0] * (sizeof (int) * 2)); | |||
| } | |||
| dest[1] = x1; | |||
| } | |||
| } | |||
| //============================================================================== | |||
| void EdgeTable::clipToRectangle (const Rectangle& r) throw() | |||
| { | |||
| @@ -563,10 +612,17 @@ void EdgeTable::clipToRectangle (const Rectangle& r) throw() | |||
| if (clipped.getX() > bounds.getX()) | |||
| { | |||
| const int rectLine[] = { 2, clipped.getX() << 8, 255, clipped.getRight() << 8, 0 }; | |||
| const int x1 = clipped.getX() << 8; | |||
| const int x2 = jmin (bounds.getRight(), clipped.getRight()) << 8; | |||
| int* line = table + lineStrideElements * top; | |||
| for (int i = top; i < bottom; ++i) | |||
| intersectWithEdgeTableLine (i, rectLine); | |||
| for (int i = bottom - top; --i >= 0;) | |||
| { | |||
| if (line[0] != 0) | |||
| clipEdgeTableLineToRange (line, x1, x2); | |||
| line += lineStrideElements; | |||
| } | |||
| } | |||
| needToCheckEmptinesss = true; | |||
| @@ -203,6 +203,7 @@ private: | |||
| void addEdgePoint (const int x, const int y, const int winding) throw(); | |||
| void remapTableForNumEdges (const int newNumEdgesPerLine) throw(); | |||
| void intersectWithEdgeTableLine (const int y, const int* otherLine) throw(); | |||
| void clipEdgeTableLineToRange (int* line, int x1, int x2) throw(); | |||
| void sanitiseLevels (const bool useNonZeroWinding) throw(); | |||
| }; | |||
| @@ -142,10 +142,9 @@ public: | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| /** @internal */ | |||
| class Token; | |||
| private: | |||
| class Token; | |||
| friend class OwnedArray <Token>; | |||
| OwnedArray <Token> tokens; | |||
| int totalLines; | |||
| }; | |||
| @@ -45,15 +45,15 @@ Typeface::~Typeface() | |||
| } | |||
| //============================================================================== | |||
| class CustomTypefaceGlyphInfo | |||
| class CustomTypeface::GlyphInfo | |||
| { | |||
| public: | |||
| CustomTypefaceGlyphInfo (const juce_wchar character_, const Path& path_, const float width_) throw() | |||
| GlyphInfo (const juce_wchar character_, const Path& path_, const float width_) throw() | |||
| : character (character_), path (path_), width (width_) | |||
| { | |||
| } | |||
| ~CustomTypefaceGlyphInfo() throw() | |||
| ~GlyphInfo() throw() | |||
| { | |||
| } | |||
| @@ -92,8 +92,8 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| CustomTypefaceGlyphInfo (const CustomTypefaceGlyphInfo&); | |||
| const CustomTypefaceGlyphInfo& operator= (const CustomTypefaceGlyphInfo&); | |||
| GlyphInfo (const GlyphInfo&); | |||
| const GlyphInfo& operator= (const GlyphInfo&); | |||
| }; | |||
| //============================================================================== | |||
| @@ -172,14 +172,14 @@ void CustomTypeface::addGlyph (const juce_wchar character, const Path& path, con | |||
| if (((unsigned int) character) < (unsigned int) numElementsInArray (lookupTable)) | |||
| lookupTable [character] = (short) glyphs.size(); | |||
| glyphs.add (new CustomTypefaceGlyphInfo (character, path, width)); | |||
| glyphs.add (new GlyphInfo (character, path, width)); | |||
| } | |||
| void CustomTypeface::addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw() | |||
| { | |||
| if (extraAmount != 0) | |||
| { | |||
| CustomTypefaceGlyphInfo* const g = findGlyph (char1, true); | |||
| GlyphInfo* const g = findGlyph (char1, true); | |||
| jassert (g != 0); // can only add kerning pairs for characters that exist! | |||
| if (g != 0) | |||
| @@ -187,14 +187,14 @@ void CustomTypeface::addKerningPair (const juce_wchar char1, const juce_wchar ch | |||
| } | |||
| } | |||
| CustomTypefaceGlyphInfo* CustomTypeface::findGlyph (const juce_wchar character, const bool loadIfNeeded) throw() | |||
| CustomTypeface::GlyphInfo* CustomTypeface::findGlyph (const juce_wchar character, const bool loadIfNeeded) throw() | |||
| { | |||
| if (((unsigned int) character) < (unsigned int) numElementsInArray (lookupTable) && lookupTable [character] > 0) | |||
| return glyphs [(int) lookupTable [(int) character]]; | |||
| for (int i = 0; i < glyphs.size(); ++i) | |||
| { | |||
| CustomTypefaceGlyphInfo* const g = glyphs.getUnchecked(i); | |||
| GlyphInfo* const g = glyphs.getUnchecked(i); | |||
| if (g->character == character) | |||
| return g; | |||
| } | |||
| @@ -205,9 +205,9 @@ CustomTypefaceGlyphInfo* CustomTypeface::findGlyph (const juce_wchar character, | |||
| return 0; | |||
| } | |||
| CustomTypefaceGlyphInfo* CustomTypeface::findGlyphSubstituting (const juce_wchar character) throw() | |||
| CustomTypeface::GlyphInfo* CustomTypeface::findGlyphSubstituting (const juce_wchar character) throw() | |||
| { | |||
| CustomTypefaceGlyphInfo* glyph = findGlyph (character, true); | |||
| GlyphInfo* glyph = findGlyph (character, true); | |||
| if (glyph == 0) | |||
| { | |||
| @@ -286,7 +286,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) | |||
| for (i = 0; i < glyphs.size(); ++i) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const g = glyphs.getUnchecked (i); | |||
| const GlyphInfo* const g = glyphs.getUnchecked (i); | |||
| out.writeShort ((short) (unsigned short) g->character); | |||
| out.writeFloat (g->width); | |||
| g->path.writePathToStream (out); | |||
| @@ -298,11 +298,11 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) | |||
| for (i = 0; i < glyphs.size(); ++i) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const g = glyphs.getUnchecked (i); | |||
| const GlyphInfo* const g = glyphs.getUnchecked (i); | |||
| for (int j = 0; j < g->kerningPairs.size(); ++j) | |||
| { | |||
| const CustomTypefaceGlyphInfo::KerningPair& p = g->kerningPairs.getReference (j); | |||
| const GlyphInfo::KerningPair& p = g->kerningPairs.getReference (j); | |||
| out.writeShort ((short) (unsigned short) g->character); | |||
| out.writeShort ((short) (unsigned short) p.character2); | |||
| out.writeFloat (p.kerningAmount); | |||
| @@ -330,7 +330,7 @@ float CustomTypeface::getStringWidth (const String& text) | |||
| while (*t != 0) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const glyph = findGlyphSubstituting (*t++); | |||
| const GlyphInfo* const glyph = findGlyphSubstituting (*t++); | |||
| if (glyph != 0) | |||
| x += glyph->getHorizontalSpacing (*t); | |||
| @@ -348,7 +348,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array <int>& resultG | |||
| while (*t != 0) | |||
| { | |||
| const juce_wchar c = *t++; | |||
| const CustomTypefaceGlyphInfo* const glyph = findGlyphSubstituting (c); | |||
| const GlyphInfo* const glyph = findGlyphSubstituting (c); | |||
| if (glyph != 0) | |||
| { | |||
| @@ -361,7 +361,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array <int>& resultG | |||
| bool CustomTypeface::getOutlineForGlyph (int glyphNumber, Path& path) | |||
| { | |||
| const CustomTypefaceGlyphInfo* const glyph = findGlyphSubstituting ((juce_wchar) glyphNumber); | |||
| const GlyphInfo* const glyph = findGlyphSubstituting ((juce_wchar) glyphNumber); | |||
| if (glyph != 0) | |||
| { | |||
| path = glyph->path; | |||
| @@ -32,7 +32,6 @@ | |||
| #include "../../../io/streams/juce_OutputStream.h" | |||
| #include "../geometry/juce_Path.h" | |||
| class Font; | |||
| class CustomTypefaceGlyphInfo; | |||
| //============================================================================== | |||
| @@ -220,14 +219,16 @@ protected: | |||
| private: | |||
| //============================================================================== | |||
| OwnedArray <CustomTypefaceGlyphInfo> glyphs; | |||
| class GlyphInfo; | |||
| friend class OwnedArray<GlyphInfo>; | |||
| OwnedArray <GlyphInfo> glyphs; | |||
| short lookupTable [128]; | |||
| CustomTypeface (const CustomTypeface&); | |||
| const CustomTypeface& operator= (const CustomTypeface&); | |||
| CustomTypefaceGlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw(); | |||
| CustomTypefaceGlyphInfo* findGlyphSubstituting (const juce_wchar character) throw(); | |||
| GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw(); | |||
| GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw(); | |||
| }; | |||
| #endif // __JUCE_TYPEFACE_JUCEHEADER__ | |||
| @@ -77,7 +77,7 @@ DirectoryIterator::DirectoryIterator (const File& directory, | |||
| && ((whatToLookFor_ & File::ignoreHiddenFiles) == 0 | |||
| || ! isHidden)) | |||
| { | |||
| dirsFound.add (new File (path + filename, 0)); | |||
| dirsFound.add (File (path + filename, 0)); | |||
| } | |||
| addToList = (whatToLookFor_ & File::findDirectories) != 0; | |||
| @@ -96,7 +96,7 @@ DirectoryIterator::DirectoryIterator (const File& directory, | |||
| addToList = ! isHidden; | |||
| if (addToList) | |||
| filesFound.add (new File (path + filename, 0)); | |||
| filesFound.add (File (path + filename, 0)); | |||
| } | |||
| } while (juce_findFileNext (handle, filename, &isDirectory, &isHidden, 0, 0, 0, 0)); | |||
| @@ -126,7 +126,7 @@ bool DirectoryIterator::next() | |||
| if (index >= filesFound.size()) | |||
| { | |||
| subIterator = new DirectoryIterator (*(dirsFound [index - filesFound.size()]), | |||
| subIterator = new DirectoryIterator (dirsFound.getReference (index - filesFound.size()), | |||
| true, wildCard, whatToLookFor); | |||
| return next(); | |||
| } | |||
| @@ -139,10 +139,7 @@ const File DirectoryIterator::getFile() const | |||
| if (subIterator != 0) | |||
| return subIterator->getFile(); | |||
| const File* const f = filesFound [index]; | |||
| return (f != 0) ? *f | |||
| : File::nonexistent; | |||
| return filesFound [index]; | |||
| } | |||
| float DirectoryIterator::getEstimatedProgress() const | |||
| @@ -101,8 +101,8 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| OwnedArray <File> filesFound; | |||
| OwnedArray <File> dirsFound; | |||
| Array <File> filesFound; | |||
| Array <File> dirsFound; | |||
| String wildCard; | |||
| int index; | |||
| const int whatToLookFor; | |||
| @@ -42,6 +42,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_TemporaryFile.h" | |||
| #include "../../core/juce_SystemStats.h" | |||
| #include "../../core/juce_Random.h" | |||
| #include "../../containers/juce_ScopedPointer.h" | |||
| #ifdef _MSC_VER | |||
| #pragma warning (pop) | |||
| @@ -292,11 +293,11 @@ bool File::setReadOnly (const bool shouldBeReadOnly, | |||
| if (applyRecursively && isDirectory()) | |||
| { | |||
| OwnedArray <File> subFiles; | |||
| Array <File> subFiles; | |||
| findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
| for (int i = subFiles.size(); --i >= 0;) | |||
| worked = subFiles[i]->setReadOnly (shouldBeReadOnly, true) && worked; | |||
| worked = subFiles.getReference(i).setReadOnly (shouldBeReadOnly, true) && worked; | |||
| } | |||
| return juce_setFileReadOnly (fullPath, shouldBeReadOnly) && worked; | |||
| @@ -314,11 +315,11 @@ bool File::deleteRecursively() const | |||
| if (isDirectory()) | |||
| { | |||
| OwnedArray<File> subFiles; | |||
| Array<File> subFiles; | |||
| findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
| for (int i = subFiles.size(); --i >= 0;) | |||
| worked = subFiles[i]->deleteRecursively() && worked; | |||
| worked = subFiles.getReference(i).deleteRecursively() && worked; | |||
| } | |||
| return deleteFile() && worked; | |||
| @@ -353,19 +354,19 @@ bool File::copyDirectoryTo (const File& newDirectory) const | |||
| { | |||
| if (isDirectory() && newDirectory.createDirectory()) | |||
| { | |||
| OwnedArray<File> subFiles; | |||
| Array<File> subFiles; | |||
| findChildFiles (subFiles, File::findFiles, false); | |||
| int i; | |||
| for (i = 0; i < subFiles.size(); ++i) | |||
| if (! subFiles[i]->copyFileTo (newDirectory.getChildFile (subFiles[i]->getFileName()))) | |||
| if (! subFiles.getReference(i).copyFileTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) | |||
| return false; | |||
| subFiles.clear(); | |||
| findChildFiles (subFiles, File::findDirectories, false); | |||
| for (i = 0; i < subFiles.size(); ++i) | |||
| if (! subFiles[i]->copyDirectoryTo (newDirectory.getChildFile (subFiles[i]->getFileName()))) | |||
| if (! subFiles.getReference(i).copyDirectoryTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) | |||
| return false; | |||
| return true; | |||
| @@ -648,7 +649,7 @@ static inline bool fileTypeMatches (const int whatToLookFor, | |||
| || (whatToLookFor & File::ignoreHiddenFiles) == 0); | |||
| } | |||
| int File::findChildFiles (OwnedArray<File>& results, | |||
| int File::findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern) const | |||
| @@ -677,7 +678,7 @@ int File::findChildFiles (OwnedArray<File>& results, | |||
| if (fileTypeMatches (whatToLookFor, itemIsDirectory, itemIsHidden) | |||
| && ! filename.containsOnly (T("."))) | |||
| { | |||
| results.add (new File (path + filename, 0)); | |||
| results.add (File (path + filename, 0)); | |||
| ++total; | |||
| } | |||
| @@ -695,16 +696,13 @@ int File::findChildFiles (OwnedArray<File>& results, | |||
| // and recurse down if required. | |||
| if (searchRecursively) | |||
| { | |||
| OwnedArray <File> subDirectories; | |||
| Array<File> subDirectories; | |||
| findChildFiles (subDirectories, File::findDirectories, false); | |||
| for (int i = 0; i < subDirectories.size(); ++i) | |||
| { | |||
| total += subDirectories.getUnchecked(i) | |||
| ->findChildFiles (results, | |||
| whatToLookFor, | |||
| true, | |||
| wildCardPattern); | |||
| total += subDirectories.getReference(i).findChildFiles (results, whatToLookFor, | |||
| true, wildCardPattern); | |||
| } | |||
| } | |||
| @@ -1092,12 +1090,12 @@ const String File::getRelativePathFrom (const File& dir) const | |||
| } | |||
| //============================================================================== | |||
| void File::findFileSystemRoots (OwnedArray<File>& destArray) | |||
| void File::findFileSystemRoots (Array<File>& destArray) | |||
| { | |||
| const StringArray roots (juce_getFileSystemRoots()); | |||
| for (int i = 0; i < roots.size(); ++i) | |||
| destArray.add (new File (roots[i])); | |||
| destArray.add (File (roots[i])); | |||
| } | |||
| const String File::getVolumeLabel() const | |||
| @@ -26,7 +26,7 @@ | |||
| #ifndef __JUCE_FILE_JUCEHEADER__ | |||
| #define __JUCE_FILE_JUCEHEADER__ | |||
| #include "../../containers/juce_OwnedArray.h" | |||
| #include "../../containers/juce_Array.h" | |||
| #include "../../core/juce_Time.h" | |||
| #include "../../text/juce_StringArray.h" | |||
| #include "../../containers/juce_MemoryBlock.h" | |||
| @@ -529,7 +529,7 @@ public: | |||
| @see getNumberOfChildFiles, DirectoryIterator | |||
| */ | |||
| int findChildFiles (OwnedArray<File>& results, | |||
| int findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern = JUCE_T("*")) const; | |||
| @@ -671,7 +671,7 @@ public: | |||
| to which ones are available. On the Mac/Linux, this will probably | |||
| just add a single entry for "/". | |||
| */ | |||
| static void findFileSystemRoots (OwnedArray<File>& results); | |||
| static void findFileSystemRoots (Array<File>& results); | |||
| /** Finds the name of the drive on which this file lives. | |||
| @@ -138,7 +138,7 @@ void FileSearchPath::removeNonExistentPaths() | |||
| directories.remove (i); | |||
| } | |||
| int FileSearchPath::findChildFiles (OwnedArray<File>& results, | |||
| int FileSearchPath::findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern) const | |||
| @@ -130,7 +130,7 @@ public: | |||
| @returns the number of files added to the array | |||
| @see File::findChildFiles | |||
| */ | |||
| int findChildFiles (OwnedArray<File>& results, | |||
| int findChildFiles (Array<File>& results, | |||
| const int whatToLookFor, | |||
| const bool searchRecursively, | |||
| const String& wildCardPattern = JUCE_T("*")) const; | |||
| @@ -30,7 +30,7 @@ | |||
| #include "../streams/juce_InputStream.h" | |||
| #include "../streams/juce_InputSource.h" | |||
| #include "../../threads/juce_CriticalSection.h" | |||
| #include "../../containers/juce_VoidArray.h" | |||
| #include "../../containers/juce_OwnedArray.h" | |||
| //============================================================================== | |||
| @@ -28,7 +28,7 @@ | |||
| #if JUCE_INCLUDED_FILE | |||
| //============================================================================== | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& file, | |||
| const String& filters, | |||
| @@ -90,7 +90,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| tokens.add (resultString); | |||
| for (int i = 0; i < tokens.size(); i++) | |||
| results.add (new File (tokens[i])); | |||
| results.add (File (tokens[i])); | |||
| return; | |||
| } | |||
| @@ -79,7 +79,7 @@ using namespace JUCE_NAMESPACE; | |||
| BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -133,7 +133,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| { | |||
| if (isSaveDialogue) | |||
| { | |||
| results.add (new File (nsStringToJuce ([panel filename]))); | |||
| results.add (File (nsStringToJuce ([panel filename]))); | |||
| } | |||
| else | |||
| { | |||
| @@ -142,7 +142,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| for (unsigned int i = 0; i < [urls count]; ++i) | |||
| { | |||
| NSString* f = [urls objectAtIndex: i]; | |||
| results.add (new File (nsStringToJuce (f))); | |||
| results.add (File (nsStringToJuce (f))); | |||
| } | |||
| } | |||
| } | |||
| @@ -153,7 +153,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| #else | |||
| //============================================================================== | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -143,7 +143,7 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| void FileChooser::showPlatformDialog (Array<File>& results, | |||
| const String& title, | |||
| const File& currentFileOrDirectory, | |||
| const String& filter, | |||
| @@ -234,7 +234,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| { | |||
| const String stringFName (fname); | |||
| results.add (new File (File (stringFName).getSiblingFile (returnedString))); | |||
| results.add (File (stringFName).getSiblingFile (returnedString)); | |||
| returnedString = String::empty; | |||
| return; | |||
| @@ -325,13 +325,13 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results, | |||
| while (*filename != 0) | |||
| { | |||
| const String filepath (String (files) + T("\\") + String (filename)); | |||
| results.add (new File (filepath)); | |||
| results.add (File (filepath)); | |||
| filename += CharacterFunctions::length (filename) + 1; | |||
| } | |||
| } | |||
| else if (files[0] != 0) | |||
| { | |||
| results.add (new File (files)); | |||
| results.add (File (files)); | |||
| } | |||
| } | |||
| @@ -30,6 +30,7 @@ | |||
| #include "juce_StringArray.h" | |||
| #include "../io/files/juce_File.h" | |||
| #include "../io/streams/juce_InputSource.h" | |||
| #include "../containers/juce_ScopedPointer.h" | |||
| //============================================================================== | |||