@@ -597,7 +597,7 @@ private: | |||
T("Change TabComponent tab depth")); | |||
} | |||
const double getValue() const | |||
double getValue() const | |||
{ | |||
return component->getTabBarDepth(); | |||
} | |||
@@ -396,7 +396,7 @@ private: | |||
T("Change Viewport scrollbar size")); | |||
} | |||
const double getValue() const | |||
double getValue() const | |||
{ | |||
return component->getScrollBarThickness(); | |||
} | |||
@@ -330,7 +330,7 @@ public: | |||
true); | |||
} | |||
const double getValue() const { return owner->getStrokeType().stroke.getStrokeThickness(); } | |||
double getValue() const { return owner->getStrokeType().stroke.getStrokeThickness(); } | |||
void changeListenerCallback (void*) { refresh(); } | |||
@@ -586,7 +586,7 @@ public: | |||
} | |||
} | |||
const double getValue() const | |||
double getValue() const | |||
{ | |||
if (isForStroke) | |||
return element->getStrokeType().fill.imageOpacity; | |||
@@ -449,7 +449,7 @@ private: | |||
element->setOpacity (newValue, true); | |||
} | |||
const double getValue() const | |||
double getValue() const | |||
{ | |||
return element->getOpacity(); | |||
} | |||
@@ -227,7 +227,7 @@ private: | |||
owner->setCornerSize (newValue, true); | |||
} | |||
const double getValue() const { return owner->getCornerSize(); } | |||
double getValue() const { return owner->getCornerSize(); } | |||
void changeListenerCallback (void*) { refresh(); } | |||
@@ -52245,6 +52245,12 @@ void TextEditor::insertTextAtCaret (const String& newText_) | |||
if (allowedCharacters.isNotEmpty()) | |||
newText = newText.retainCharacters (allowedCharacters); | |||
if ((! returnKeyStartsNewLine) && newText == T("\n")) | |||
{ | |||
returnPressed(); | |||
return; | |||
} | |||
if (! isMultiLine()) | |||
newText = newText.replaceCharacters (T("\r\n"), T(" ")); | |||
else | |||
@@ -52658,11 +52664,7 @@ bool TextEditor::keyPressed (const KeyPress& key) | |||
else if (key == KeyPress::returnKey) | |||
{ | |||
newTransaction(); | |||
if (returnKeyStartsNewLine) | |||
insertTextAtCaret (T("\n")); | |||
else | |||
returnPressed(); | |||
insertTextAtCaret (T("\n")); | |||
} | |||
else if (key.isKeyCode (KeyPress::escapeKey)) | |||
{ | |||
@@ -77406,7 +77408,8 @@ TooltipWindow::TooltipWindow (Component* const parentComponent, | |||
lastComponentUnderMouse (0), | |||
changedCompsSinceShown (true) | |||
{ | |||
startTimer (123); | |||
if (Desktop::getInstance().getMainMouseSource().canHover()) | |||
startTimer (123); | |||
setAlwaysOnTop (true); | |||
setOpaque (true); | |||
@@ -114411,6 +114414,9 @@ void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L) | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
#ifdef _MSC_VER | |||
#pragma warning (pop) | |||
#endif | |||
@@ -114418,7 +114424,7 @@ void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L) | |||
BEGIN_JUCE_NAMESPACE | |||
static const char* const flacFormatName = "FLAC file"; | |||
static const tchar* const flacExtensions[] = { T(".flac"), 0 }; | |||
static const juce_wchar* const flacExtensions[] = { T(".flac"), 0 }; | |||
class FlacReader : public AudioFormatReader | |||
{ | |||
@@ -114580,34 +114586,34 @@ public: | |||
static FlacNamespace::FLAC__StreamDecoderReadStatus readCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__byte buffer[], size_t* bytes, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
*bytes = (unsigned int) ((const FlacReader*) client_data)->input->read (buffer, (int) *bytes); | |||
*bytes = (size_t) static_cast <const FlacReader*> (client_data)->input->read (buffer, (int) *bytes); | |||
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderSeekStatus seekCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64 absolute_byte_offset, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
((const FlacReader*) client_data)->input->setPosition ((int) absolute_byte_offset); | |||
static_cast <const FlacReader*> (client_data)->input->setPosition ((int) absolute_byte_offset); | |||
return FLAC__STREAM_DECODER_SEEK_STATUS_OK; | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderTellStatus tellCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
*absolute_byte_offset = ((const FlacReader*) client_data)->input->getPosition(); | |||
*absolute_byte_offset = static_cast <const FlacReader*> (client_data)->input->getPosition(); | |||
return FLAC__STREAM_DECODER_TELL_STATUS_OK; | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderLengthStatus lengthCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* stream_length, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
*stream_length = ((const FlacReader*) client_data)->input->getTotalLength(); | |||
*stream_length = static_cast <const FlacReader*> (client_data)->input->getTotalLength(); | |||
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; | |||
} | |||
static FlacNamespace::FLAC__bool eofCallback_ (const FlacNamespace::FLAC__StreamDecoder*, void* client_data) | |||
{ | |||
return ((const FlacReader*) client_data)->input->isExhausted(); | |||
return static_cast <const FlacReader*> (client_data)->input->isExhausted(); | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderWriteStatus writeCallback_ (const FlacNamespace::FLAC__StreamDecoder*, | |||
@@ -114616,7 +114622,7 @@ public: | |||
void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
((FlacReader*) client_data)->useSamples (buffer, frame->header.blocksize); | |||
static_cast <FlacReader*> (client_data)->useSamples (buffer, frame->header.blocksize); | |||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; | |||
} | |||
@@ -114624,7 +114630,7 @@ public: | |||
const FlacNamespace::FLAC__StreamMetadata* metadata, | |||
void* client_data) | |||
{ | |||
((FlacReader*) client_data)->useMetadata (metadata->data.stream_info); | |||
static_cast <FlacReader*> (client_data)->useMetadata (metadata->data.stream_info); | |||
} | |||
static void errorCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__StreamDecoderErrorStatus, void*) | |||
@@ -114780,7 +114786,7 @@ public: | |||
void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
return ((FlacWriter*) client_data)->writeData (buffer, (int) bytes) | |||
return static_cast <FlacWriter*> (client_data)->writeData (buffer, (int) bytes) | |||
? FLAC__STREAM_ENCODER_WRITE_STATUS_OK | |||
: FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; | |||
} | |||
@@ -114797,15 +114803,13 @@ public: | |||
if (client_data == 0) | |||
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED; | |||
*absolute_byte_offset = (FLAC__uint64) ((FlacWriter*) client_data)->output->getPosition(); | |||
*absolute_byte_offset = (FLAC__uint64) static_cast <FlacWriter*> (client_data)->output->getPosition(); | |||
return FLAC__STREAM_ENCODER_TELL_STATUS_OK; | |||
} | |||
static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*, | |||
const FlacNamespace::FLAC__StreamMetadata* metadata, | |||
void* client_data) | |||
static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*, const FlacNamespace::FLAC__StreamMetadata* metadata, void* client_data) | |||
{ | |||
((FlacWriter*) client_data)->writeMetaData (metadata); | |||
static_cast <FlacWriter*> (client_data)->writeMetaData (metadata); | |||
} | |||
juce_UseDebuggingNewOperator | |||
@@ -114821,7 +114825,7 @@ private: | |||
}; | |||
FlacAudioFormat::FlacAudioFormat() | |||
: AudioFormat (TRANS (flacFormatName), (const tchar**) flacExtensions) | |||
: AudioFormat (TRANS (flacFormatName), (const juce_wchar**) flacExtensions) | |||
{ | |||
} | |||
@@ -114859,7 +114863,7 @@ bool FlacAudioFormat::isCompressed() | |||
AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in, | |||
const bool deleteStreamIfOpeningFails) | |||
{ | |||
ScopedPointer <FlacReader> r (new FlacReader (in)); | |||
ScopedPointer<FlacReader> r (new FlacReader (in)); | |||
if (r->sampleRate != 0) | |||
return r.release(); | |||
@@ -114879,10 +114883,7 @@ AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out, | |||
{ | |||
if (getPossibleBitDepths().contains (bitsPerSample)) | |||
{ | |||
ScopedPointer <FlacWriter> w (new FlacWriter (out, | |||
sampleRate, | |||
numberOfChannels, | |||
bitsPerSample)); | |||
ScopedPointer<FlacWriter> w (new FlacWriter (out, sampleRate, numberOfChannels, bitsPerSample)); | |||
if (w->ok) | |||
return w.release(); | |||
@@ -171166,10 +171167,13 @@ void _vorbis_apply_window(float *d,int *winno,long *blocksizes, | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
BEGIN_JUCE_NAMESPACE | |||
static const char* const oggFormatName = "Ogg-Vorbis file"; | |||
static const tchar* const oggExtensions[] = { T(".ogg"), 0 }; | |||
static const juce_wchar* const oggExtensions[] = { T(".ogg"), 0 }; | |||
class OggReader : public AudioFormatReader | |||
{ | |||
@@ -171471,7 +171475,7 @@ public: | |||
}; | |||
OggVorbisAudioFormat::OggVorbisAudioFormat() | |||
: AudioFormat (TRANS (oggFormatName), (const tchar**) oggExtensions) | |||
: AudioFormat (TRANS (oggFormatName), (const juce_wchar**) oggExtensions) | |||
{ | |||
} | |||
@@ -188337,6 +188341,9 @@ jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
#if JUCE_MSVC | |||
#pragma warning (pop) | |||
#endif | |||
@@ -210929,6 +210936,9 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
#ifdef _MSC_VER | |||
#pragma warning (pop) | |||
#endif | |||
@@ -210943,11 +210953,14 @@ namespace PNGHelpers | |||
{ | |||
using namespace pnglibNamespace; | |||
static void readCallback (png_structp pngReadStruct, png_bytep data, png_size_t length) | |||
static void readCallback (png_structp png, png_bytep data, png_size_t length) | |||
{ | |||
using namespace pnglibNamespace; | |||
InputStream* const in = (InputStream*) png_get_io_ptr (pngReadStruct); | |||
in->read (data, (int) length); | |||
static_cast<InputStream*> (png->io_ptr)->read (data, (int) length); | |||
} | |||
static void writeDataCallback (png_structp png, png_bytep data, png_size_t length) | |||
{ | |||
static_cast<OutputStream*> (png->io_ptr)->write (data, (int) length); | |||
} | |||
struct PNGErrorStruct {}; | |||
@@ -210956,17 +210969,6 @@ namespace PNGHelpers | |||
{ | |||
throw PNGErrorStruct(); | |||
} | |||
static void writeDataCallback (png_structp png_ptr, png_bytep data, png_size_t length) | |||
{ | |||
OutputStream* const out = (OutputStream*) png_ptr->io_ptr; | |||
const bool ok = out->write (data, (int) length); | |||
(void) ok; | |||
jassert (ok); | |||
} | |||
} | |||
Image* juce_loadPNGImageFromStream (InputStream& in) | |||
@@ -240405,10 +240407,11 @@ END_JUCE_NAMESPACE | |||
#define JuceUIView MakeObjCClassName(JuceUIView) | |||
@interface JuceUIView : UIView | |||
@interface JuceUIView : UIView <UITextFieldDelegate> | |||
{ | |||
@public | |||
UIViewComponentPeer* owner; | |||
UITextField *hiddenTextField; | |||
} | |||
- (JuceUIView*) initWithOwner: (UIViewComponentPeer*) owner withFrame: (CGRect) frame; | |||
@@ -240427,6 +240430,9 @@ END_JUCE_NAMESPACE | |||
- (void) asyncRepaint: (id) rect; | |||
- (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) string; | |||
- (BOOL) textFieldShouldClear: (UITextField*) textField; | |||
- (BOOL) textFieldShouldReturn: (UITextField*) textField; | |||
@end | |||
#define JuceUIWindow MakeObjCClassName(JuceUIWindow) | |||
@@ -240444,7 +240450,8 @@ END_JUCE_NAMESPACE | |||
BEGIN_JUCE_NAMESPACE | |||
class UIViewComponentPeer : public ComponentPeer | |||
class UIViewComponentPeer : public ComponentPeer, | |||
public FocusChangeListener | |||
{ | |||
public: | |||
UIViewComponentPeer (Component* const component, | |||
@@ -240490,6 +240497,12 @@ public: | |||
void grabFocus(); | |||
void textInputRequired (const Point<int>& position); | |||
virtual BOOL textFieldReplaceCharacters (const Range<int>& range, const String& text); | |||
virtual BOOL textFieldShouldClear(); | |||
virtual BOOL textFieldShouldReturn(); | |||
void updateHiddenTextContent (TextInputTarget* target); | |||
void globalFocusChanged (Component*); | |||
void handleTouches (UIEvent* e, bool isDown, bool isUp, bool isCancel); | |||
void repaint (int x, int y, int w, int h); | |||
@@ -240521,11 +240534,18 @@ END_JUCE_NAMESPACE | |||
[super initWithFrame: frame]; | |||
owner = owner_; | |||
hiddenTextField = [[UITextField alloc] initWithFrame: CGRectMake (0, 0, 0, 0)]; | |||
[self addSubview: hiddenTextField]; | |||
hiddenTextField.delegate = self; | |||
return self; | |||
} | |||
- (void) dealloc | |||
{ | |||
[hiddenTextField removeFromSuperview]; | |||
[hiddenTextField release]; | |||
[super dealloc]; | |||
} | |||
@@ -240607,6 +240627,22 @@ JUCE_NAMESPACE::Point<int> juce_lastMousePos; | |||
[self setNeedsDisplayInRect: *r]; | |||
} | |||
- (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) text | |||
{ | |||
return owner->textFieldReplaceCharacters (Range<int> (range.location, range.location + range.length), | |||
nsStringToJuce (text)); | |||
} | |||
- (BOOL) textFieldShouldClear: (UITextField*) textField | |||
{ | |||
return owner->textFieldShouldClear(); | |||
} | |||
- (BOOL) textFieldShouldReturn: (UITextField*) textField | |||
{ | |||
return owner->textFieldShouldReturn(); | |||
} | |||
@end | |||
@implementation JuceUIWindow | |||
@@ -240679,10 +240715,14 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component, | |||
} | |||
setTitle (component->getName()); | |||
Desktop::getInstance().addFocusChangeListener (this); | |||
} | |||
UIViewComponentPeer::~UIViewComponentPeer() | |||
{ | |||
Desktop::getInstance().removeFocusChangeListener (this); | |||
view->owner = 0; | |||
[view removeFromSuperview]; | |||
[view release]; | |||
@@ -241029,6 +241069,77 @@ void UIViewComponentPeer::textInputRequired (const Point<int>&) | |||
{ | |||
} | |||
void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | |||
{ | |||
view->hiddenTextField.text = juceStringToNS (target->getTextInRange (Range<int> (0, target->getHighlightedRegion().getStart()))); | |||
} | |||
BOOL UIViewComponentPeer::textFieldReplaceCharacters (const Range<int>& range, const String& text) | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
const Range<int> currentSelection (target->getHighlightedRegion()); | |||
if (range.getLength() == 1 && text.isEmpty()) // (detect backspace) | |||
if (currentSelection.isEmpty()) | |||
target->setHighlightedRegion (currentSelection.withStart (currentSelection.getStart() - 1)); | |||
target->insertTextAtCaret (text); | |||
updateHiddenTextContent (target); | |||
} | |||
return NO; | |||
} | |||
BOOL UIViewComponentPeer::textFieldShouldClear() | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
target->setHighlightedRegion (Range<int> (0, std::numeric_limits<int>::max())); | |||
target->insertTextAtCaret (String::empty); | |||
updateHiddenTextContent (target); | |||
} | |||
return YES; | |||
} | |||
BOOL UIViewComponentPeer::textFieldShouldReturn() | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
target->insertTextAtCaret (T("\n")); | |||
updateHiddenTextContent (target); | |||
} | |||
return YES; | |||
} | |||
void UIViewComponentPeer::globalFocusChanged (Component*) | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
Component* comp = dynamic_cast<Component*> (target); | |||
Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>())); | |||
view->hiddenTextField.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); | |||
updateHiddenTextContent (target); | |||
[view->hiddenTextField becomeFirstResponder]; | |||
} | |||
else | |||
{ | |||
[view->hiddenTextField resignFirstResponder]; | |||
} | |||
} | |||
void UIViewComponentPeer::drawRect (CGRect r) | |||
{ | |||
if (r.size.width < 1.0f || r.size.height < 1.0f) | |||
@@ -875,6 +875,11 @@ public: | |||
static void bigEndian24BitToChars (int value, char* destBytes); | |||
static bool isBigEndian(); | |||
private: | |||
ByteOrder(); | |||
ByteOrder (const ByteOrder&); | |||
ByteOrder& operator= (const ByteOrder&); | |||
}; | |||
#if JUCE_USE_INTRINSICS | |||
@@ -2891,13 +2896,13 @@ public: | |||
static const var null; | |||
var (const var& valueToCopy); | |||
var (const int value) throw(); | |||
var (const bool value) throw(); | |||
var (const double value) throw(); | |||
var (const char* const value); | |||
var (const juce_wchar* const value); | |||
var (int value) throw(); | |||
var (bool value) throw(); | |||
var (double value) throw(); | |||
var (const char* value); | |||
var (const juce_wchar* value); | |||
var (const String& value); | |||
var (DynamicObject* const object); | |||
var (DynamicObject* object); | |||
var (MethodFunction method) throw(); | |||
var& operator= (const var& valueToCopy); | |||
@@ -2937,7 +2942,7 @@ public: | |||
public: | |||
identifier() throw(); | |||
identifier (const char* const name); | |||
identifier (const char* name); | |||
identifier (const String& name); | |||
@@ -3075,6 +3080,11 @@ public: | |||
static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue); | |||
static void* swapPointers (void* volatile* value1, void* value2); | |||
private: | |||
Atomic(); | |||
Atomic (const Atomic&); | |||
Atomic& operator= (const Atomic&); | |||
}; | |||
#if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone... | |||
@@ -3891,7 +3901,7 @@ public: | |||
inline int size() const throw() { return strings.size(); }; | |||
const String& operator[] (const int index) const throw(); | |||
const String& operator[] (int index) const throw(); | |||
bool contains (const String& stringToLookFor, | |||
bool ignoreCase = false) const; | |||
@@ -6967,6 +6977,11 @@ public: | |||
#if JUCE_LINUX || DOXYGEN | |||
#endif | |||
private: | |||
PlatformUtilities(); | |||
PlatformUtilities (const PlatformUtilities&); | |||
PlatformUtilities& operator= (const PlatformUtilities&); | |||
}; | |||
#if JUCE_MAC || JUCE_IPHONE | |||
@@ -7342,6 +7357,11 @@ public: | |||
// not-for-public-use platform-specific method gets called at startup to initialise things. | |||
static void initialiseStats() throw(); | |||
private: | |||
SystemStats(); | |||
SystemStats (const SystemStats&); | |||
SystemStats& operator= (const SystemStats&); | |||
}; | |||
#endif // __JUCE_SYSTEMSTATS_JUCEHEADER__ | |||
@@ -70,6 +70,9 @@ namespace FlacNamespace | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
#ifdef _MSC_VER | |||
#pragma warning (pop) | |||
#endif | |||
@@ -83,7 +86,7 @@ BEGIN_JUCE_NAMESPACE | |||
//============================================================================== | |||
static const char* const flacFormatName = "FLAC file"; | |||
static const tchar* const flacExtensions[] = { T(".flac"), 0 }; | |||
static const juce_wchar* const flacExtensions[] = { T(".flac"), 0 }; | |||
//============================================================================== | |||
@@ -248,34 +251,34 @@ public: | |||
static FlacNamespace::FLAC__StreamDecoderReadStatus readCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__byte buffer[], size_t* bytes, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
*bytes = (unsigned int) ((const FlacReader*) client_data)->input->read (buffer, (int) *bytes); | |||
*bytes = (size_t) static_cast <const FlacReader*> (client_data)->input->read (buffer, (int) *bytes); | |||
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderSeekStatus seekCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64 absolute_byte_offset, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
((const FlacReader*) client_data)->input->setPosition ((int) absolute_byte_offset); | |||
static_cast <const FlacReader*> (client_data)->input->setPosition ((int) absolute_byte_offset); | |||
return FLAC__STREAM_DECODER_SEEK_STATUS_OK; | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderTellStatus tellCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
*absolute_byte_offset = ((const FlacReader*) client_data)->input->getPosition(); | |||
*absolute_byte_offset = static_cast <const FlacReader*> (client_data)->input->getPosition(); | |||
return FLAC__STREAM_DECODER_TELL_STATUS_OK; | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderLengthStatus lengthCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* stream_length, void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
*stream_length = ((const FlacReader*) client_data)->input->getTotalLength(); | |||
*stream_length = static_cast <const FlacReader*> (client_data)->input->getTotalLength(); | |||
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; | |||
} | |||
static FlacNamespace::FLAC__bool eofCallback_ (const FlacNamespace::FLAC__StreamDecoder*, void* client_data) | |||
{ | |||
return ((const FlacReader*) client_data)->input->isExhausted(); | |||
return static_cast <const FlacReader*> (client_data)->input->isExhausted(); | |||
} | |||
static FlacNamespace::FLAC__StreamDecoderWriteStatus writeCallback_ (const FlacNamespace::FLAC__StreamDecoder*, | |||
@@ -284,7 +287,7 @@ public: | |||
void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
((FlacReader*) client_data)->useSamples (buffer, frame->header.blocksize); | |||
static_cast <FlacReader*> (client_data)->useSamples (buffer, frame->header.blocksize); | |||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; | |||
} | |||
@@ -292,7 +295,7 @@ public: | |||
const FlacNamespace::FLAC__StreamMetadata* metadata, | |||
void* client_data) | |||
{ | |||
((FlacReader*) client_data)->useMetadata (metadata->data.stream_info); | |||
static_cast <FlacReader*> (client_data)->useMetadata (metadata->data.stream_info); | |||
} | |||
static void errorCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__StreamDecoderErrorStatus, void*) | |||
@@ -452,7 +455,7 @@ public: | |||
void* client_data) | |||
{ | |||
using namespace FlacNamespace; | |||
return ((FlacWriter*) client_data)->writeData (buffer, (int) bytes) | |||
return static_cast <FlacWriter*> (client_data)->writeData (buffer, (int) bytes) | |||
? FLAC__STREAM_ENCODER_WRITE_STATUS_OK | |||
: FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; | |||
} | |||
@@ -469,15 +472,13 @@ public: | |||
if (client_data == 0) | |||
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED; | |||
*absolute_byte_offset = (FLAC__uint64) ((FlacWriter*) client_data)->output->getPosition(); | |||
*absolute_byte_offset = (FLAC__uint64) static_cast <FlacWriter*> (client_data)->output->getPosition(); | |||
return FLAC__STREAM_ENCODER_TELL_STATUS_OK; | |||
} | |||
static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*, | |||
const FlacNamespace::FLAC__StreamMetadata* metadata, | |||
void* client_data) | |||
static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*, const FlacNamespace::FLAC__StreamMetadata* metadata, void* client_data) | |||
{ | |||
((FlacWriter*) client_data)->writeMetaData (metadata); | |||
static_cast <FlacWriter*> (client_data)->writeMetaData (metadata); | |||
} | |||
juce_UseDebuggingNewOperator | |||
@@ -495,7 +496,7 @@ private: | |||
//============================================================================== | |||
FlacAudioFormat::FlacAudioFormat() | |||
: AudioFormat (TRANS (flacFormatName), (const tchar**) flacExtensions) | |||
: AudioFormat (TRANS (flacFormatName), (const juce_wchar**) flacExtensions) | |||
{ | |||
} | |||
@@ -533,7 +534,7 @@ bool FlacAudioFormat::isCompressed() | |||
AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in, | |||
const bool deleteStreamIfOpeningFails) | |||
{ | |||
ScopedPointer <FlacReader> r (new FlacReader (in)); | |||
ScopedPointer<FlacReader> r (new FlacReader (in)); | |||
if (r->sampleRate != 0) | |||
return r.release(); | |||
@@ -553,10 +554,7 @@ AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out, | |||
{ | |||
if (getPossibleBitDepths().contains (bitsPerSample)) | |||
{ | |||
ScopedPointer <FlacWriter> w (new FlacWriter (out, | |||
sampleRate, | |||
numberOfChannels, | |||
bitsPerSample)); | |||
ScopedPointer<FlacWriter> w (new FlacWriter (out, sampleRate, numberOfChannels, bitsPerSample)); | |||
if (w->ok) | |||
return w.release(); | |||
@@ -72,6 +72,9 @@ namespace OggVorbisNamespace | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
BEGIN_JUCE_NAMESPACE | |||
#include "juce_OggVorbisAudioFormat.h" | |||
@@ -80,10 +83,9 @@ BEGIN_JUCE_NAMESPACE | |||
#include "../../io/files/juce_FileInputStream.h" | |||
#include "../../text/juce_LocalisedStrings.h" | |||
//============================================================================== | |||
static const char* const oggFormatName = "Ogg-Vorbis file"; | |||
static const tchar* const oggExtensions[] = { T(".ogg"), 0 }; | |||
static const juce_wchar* const oggExtensions[] = { T(".ogg"), 0 }; | |||
//============================================================================== | |||
class OggReader : public AudioFormatReader | |||
@@ -393,7 +395,7 @@ public: | |||
//============================================================================== | |||
OggVorbisAudioFormat::OggVorbisAudioFormat() | |||
: AudioFormat (TRANS (oggFormatName), (const tchar**) oggExtensions) | |||
: AudioFormat (TRANS (oggFormatName), (const juce_wchar**) oggExtensions) | |||
{ | |||
} | |||
@@ -59,13 +59,13 @@ public: | |||
static const var null; | |||
var (const var& valueToCopy); | |||
var (const int value) throw(); | |||
var (const bool value) throw(); | |||
var (const double value) throw(); | |||
var (const char* const value); | |||
var (const juce_wchar* const value); | |||
var (int value) throw(); | |||
var (bool value) throw(); | |||
var (double value) throw(); | |||
var (const char* value); | |||
var (const juce_wchar* value); | |||
var (const String& value); | |||
var (DynamicObject* const object); | |||
var (DynamicObject* object); | |||
var (MethodFunction method) throw(); | |||
var& operator= (const var& valueToCopy); | |||
@@ -119,7 +119,7 @@ public: | |||
Because this name may need to be used in contexts such as script variables or XML | |||
tags, it must only contain ascii letters and digits, or the underscore character. | |||
*/ | |||
identifier (const char* const name); | |||
identifier (const char* name); | |||
/** Creates an identifier with a specified name. | |||
Because this name may need to be used in contexts such as script variables or XML | |||
@@ -53,6 +53,11 @@ public: | |||
/** This atomically sets *value1 to be value2, and returns the previous value of *value1. */ | |||
static void* swapPointers (void* volatile* value1, void* value2); | |||
private: | |||
Atomic(); | |||
Atomic (const Atomic&); | |||
Atomic& operator= (const Atomic&); | |||
}; | |||
@@ -92,6 +92,11 @@ public: | |||
//============================================================================== | |||
/** Returns true if the current CPU is big-endian. */ | |||
static bool isBigEndian(); | |||
private: | |||
ByteOrder(); | |||
ByteOrder (const ByteOrder&); | |||
ByteOrder& operator= (const ByteOrder&); | |||
}; | |||
@@ -194,6 +194,11 @@ public: | |||
//============================================================================== | |||
#endif | |||
private: | |||
PlatformUtilities(); | |||
PlatformUtilities (const PlatformUtilities&); | |||
PlatformUtilities& operator= (const PlatformUtilities&); | |||
}; | |||
@@ -189,6 +189,11 @@ public: | |||
//============================================================================== | |||
// not-for-public-use platform-specific method gets called at startup to initialise things. | |||
static void initialiseStats() throw(); | |||
private: | |||
SystemStats(); | |||
SystemStats (const SystemStats&); | |||
SystemStats& operator= (const SystemStats&); | |||
}; | |||
@@ -1585,6 +1585,12 @@ void TextEditor::insertTextAtCaret (const String& newText_) | |||
if (allowedCharacters.isNotEmpty()) | |||
newText = newText.retainCharacters (allowedCharacters); | |||
if ((! returnKeyStartsNewLine) && newText == T("\n")) | |||
{ | |||
returnPressed(); | |||
return; | |||
} | |||
if (! isMultiLine()) | |||
newText = newText.replaceCharacters (T("\r\n"), T(" ")); | |||
else | |||
@@ -2002,11 +2008,7 @@ bool TextEditor::keyPressed (const KeyPress& key) | |||
else if (key == KeyPress::returnKey) | |||
{ | |||
newTransaction(); | |||
if (returnKeyStartsNewLine) | |||
insertTextAtCaret (T("\n")); | |||
else | |||
returnPressed(); | |||
insertTextAtCaret (T("\n")); | |||
} | |||
else if (key.isKeyCode (KeyPress::escapeKey)) | |||
{ | |||
@@ -46,7 +46,8 @@ TooltipWindow::TooltipWindow (Component* const parentComponent, | |||
lastComponentUnderMouse (0), | |||
changedCompsSinceShown (true) | |||
{ | |||
startTimer (123); | |||
if (Desktop::getInstance().getMainMouseSource().canHover()) | |||
startTimer (123); | |||
setAlwaysOnTop (true); | |||
setOpaque (true); | |||
@@ -117,6 +117,9 @@ namespace jpeglibNamespace | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
#if JUCE_MSVC | |||
#pragma warning (pop) | |||
#endif | |||
@@ -90,13 +90,15 @@ namespace pnglibNamespace | |||
#endif | |||
} | |||
#undef max | |||
#undef min | |||
#ifdef _MSC_VER | |||
#pragma warning (pop) | |||
#endif | |||
BEGIN_JUCE_NAMESPACE | |||
#include "../juce_Image.h" | |||
#include "../../../../io/streams/juce_InputStream.h" | |||
#include "../../../../io/streams/juce_OutputStream.h" | |||
@@ -111,11 +113,14 @@ namespace PNGHelpers | |||
{ | |||
using namespace pnglibNamespace; | |||
static void readCallback (png_structp pngReadStruct, png_bytep data, png_size_t length) | |||
static void readCallback (png_structp png, png_bytep data, png_size_t length) | |||
{ | |||
static_cast<InputStream*> (png->io_ptr)->read (data, (int) length); | |||
} | |||
static void writeDataCallback (png_structp png, png_bytep data, png_size_t length) | |||
{ | |||
using namespace pnglibNamespace; | |||
InputStream* const in = (InputStream*) png_get_io_ptr (pngReadStruct); | |||
in->read (data, (int) length); | |||
static_cast<OutputStream*> (png->io_ptr)->write (data, (int) length); | |||
} | |||
struct PNGErrorStruct {}; | |||
@@ -124,17 +129,6 @@ namespace PNGHelpers | |||
{ | |||
throw PNGErrorStruct(); | |||
} | |||
static void writeDataCallback (png_structp png_ptr, png_bytep data, png_size_t length) | |||
{ | |||
OutputStream* const out = (OutputStream*) png_ptr->io_ptr; | |||
const bool ok = out->write (data, (int) length); | |||
(void) ok; | |||
jassert (ok); | |||
} | |||
} | |||
//============================================================================== | |||
@@ -34,10 +34,11 @@ END_JUCE_NAMESPACE | |||
#define JuceUIView MakeObjCClassName(JuceUIView) | |||
@interface JuceUIView : UIView | |||
@interface JuceUIView : UIView <UITextFieldDelegate> | |||
{ | |||
@public | |||
UIViewComponentPeer* owner; | |||
UITextField *hiddenTextField; | |||
} | |||
- (JuceUIView*) initWithOwner: (UIViewComponentPeer*) owner withFrame: (CGRect) frame; | |||
@@ -56,8 +57,12 @@ END_JUCE_NAMESPACE | |||
- (void) asyncRepaint: (id) rect; | |||
- (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) string; | |||
- (BOOL) textFieldShouldClear: (UITextField*) textField; | |||
- (BOOL) textFieldShouldReturn: (UITextField*) textField; | |||
@end | |||
//============================================================================== | |||
#define JuceUIWindow MakeObjCClassName(JuceUIWindow) | |||
@@ -75,7 +80,8 @@ END_JUCE_NAMESPACE | |||
BEGIN_JUCE_NAMESPACE | |||
//============================================================================== | |||
class UIViewComponentPeer : public ComponentPeer | |||
class UIViewComponentPeer : public ComponentPeer, | |||
public FocusChangeListener | |||
{ | |||
public: | |||
UIViewComponentPeer (Component* const component, | |||
@@ -123,6 +129,12 @@ public: | |||
void grabFocus(); | |||
void textInputRequired (const Point<int>& position); | |||
virtual BOOL textFieldReplaceCharacters (const Range<int>& range, const String& text); | |||
virtual BOOL textFieldShouldClear(); | |||
virtual BOOL textFieldShouldReturn(); | |||
void updateHiddenTextContent (TextInputTarget* target); | |||
void globalFocusChanged (Component*); | |||
void handleTouches (UIEvent* e, bool isDown, bool isUp, bool isCancel); | |||
//============================================================================== | |||
@@ -157,11 +169,18 @@ END_JUCE_NAMESPACE | |||
[super initWithFrame: frame]; | |||
owner = owner_; | |||
hiddenTextField = [[UITextField alloc] initWithFrame: CGRectMake (0, 0, 0, 0)]; | |||
[self addSubview: hiddenTextField]; | |||
hiddenTextField.delegate = self; | |||
return self; | |||
} | |||
- (void) dealloc | |||
{ | |||
[hiddenTextField removeFromSuperview]; | |||
[hiddenTextField release]; | |||
[super dealloc]; | |||
} | |||
@@ -247,6 +266,22 @@ JUCE_NAMESPACE::Point<int> juce_lastMousePos; | |||
[self setNeedsDisplayInRect: *r]; | |||
} | |||
- (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) text | |||
{ | |||
return owner->textFieldReplaceCharacters (Range<int> (range.location, range.location + range.length), | |||
nsStringToJuce (text)); | |||
} | |||
- (BOOL) textFieldShouldClear: (UITextField*) textField | |||
{ | |||
return owner->textFieldShouldClear(); | |||
} | |||
- (BOOL) textFieldShouldReturn: (UITextField*) textField | |||
{ | |||
return owner->textFieldShouldReturn(); | |||
} | |||
@end | |||
//============================================================================== | |||
@@ -323,10 +358,14 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component, | |||
} | |||
setTitle (component->getName()); | |||
Desktop::getInstance().addFocusChangeListener (this); | |||
} | |||
UIViewComponentPeer::~UIViewComponentPeer() | |||
{ | |||
Desktop::getInstance().removeFocusChangeListener (this); | |||
view->owner = 0; | |||
[view removeFromSuperview]; | |||
[view release]; | |||
@@ -676,6 +715,77 @@ void UIViewComponentPeer::textInputRequired (const Point<int>&) | |||
{ | |||
} | |||
void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | |||
{ | |||
view->hiddenTextField.text = juceStringToNS (target->getTextInRange (Range<int> (0, target->getHighlightedRegion().getStart()))); | |||
} | |||
BOOL UIViewComponentPeer::textFieldReplaceCharacters (const Range<int>& range, const String& text) | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
const Range<int> currentSelection (target->getHighlightedRegion()); | |||
if (range.getLength() == 1 && text.isEmpty()) // (detect backspace) | |||
if (currentSelection.isEmpty()) | |||
target->setHighlightedRegion (currentSelection.withStart (currentSelection.getStart() - 1)); | |||
target->insertTextAtCaret (text); | |||
updateHiddenTextContent (target); | |||
} | |||
return NO; | |||
} | |||
BOOL UIViewComponentPeer::textFieldShouldClear() | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
target->setHighlightedRegion (Range<int> (0, std::numeric_limits<int>::max())); | |||
target->insertTextAtCaret (String::empty); | |||
updateHiddenTextContent (target); | |||
} | |||
return YES; | |||
} | |||
BOOL UIViewComponentPeer::textFieldShouldReturn() | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
target->insertTextAtCaret (T("\n")); | |||
updateHiddenTextContent (target); | |||
} | |||
return YES; | |||
} | |||
void UIViewComponentPeer::globalFocusChanged (Component*) | |||
{ | |||
TextInputTarget* const target = findCurrentTextInputTarget(); | |||
if (target != 0) | |||
{ | |||
Component* comp = dynamic_cast<Component*> (target); | |||
Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>())); | |||
view->hiddenTextField.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); | |||
updateHiddenTextContent (target); | |||
[view->hiddenTextField becomeFirstResponder]; | |||
} | |||
else | |||
{ | |||
[view->hiddenTextField resignFirstResponder]; | |||
} | |||
} | |||
//============================================================================== | |||
void UIViewComponentPeer::drawRect (CGRect r) | |||
@@ -110,7 +110,7 @@ public: | |||
Obviously the reference returned shouldn't be stored for later use, as the | |||
string it refers to may disappear when the array changes. | |||
*/ | |||
const String& operator[] (const int index) const throw(); | |||
const String& operator[] (int index) const throw(); | |||
/** Searches for a string in the array. | |||