Browse Source

Fixed Mac font kerning problem. Fixed Mac native window maximising and getting rid of menus when a a native title bar is clicked. Added an option for kiosk mode that stops the main menu and dock popping up. Small tweak to SparseSet to try to avoid a compile problem in GCC4.3.3. Small fix to file relative pathname parsing.

tags/2021-05-28
jules 16 years ago
parent
commit
68dba8605d
13 changed files with 431 additions and 373 deletions
  1. +2
    -2
      build/linux/platform_specific_code/juce_linux_Audio.cpp
  2. +1
    -2
      build/linux/platform_specific_code/juce_linux_Files.cpp
  3. +1
    -1
      build/linux/platform_specific_code/juce_linux_Windowing.cpp
  4. +341
    -338
      build/macosx/platform_specific_code/juce_mac_Fonts.mm
  5. +23
    -2
      build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm
  6. +2
    -1
      build/macosx/platform_specific_code/juce_mac_NamedPipe.cpp
  7. +1
    -1
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  8. +41
    -17
      juce_amalgamated.cpp
  9. +7
    -2
      juce_amalgamated.h
  10. +4
    -4
      src/juce_appframework/gui/components/juce_Desktop.cpp
  11. +6
    -1
      src/juce_appframework/gui/components/juce_Desktop.h
  12. +1
    -1
      src/juce_core/containers/juce_SparseSet.h
  13. +1
    -1
      src/juce_core/io/files/juce_File.cpp

+ 2
- 2
build/linux/platform_specific_code/juce_linux_Audio.cpp View File

@@ -448,7 +448,7 @@ public:
}
if (! outputDevice->setParameters ((unsigned int) sampleRate,
jlimit (minChansOut, maxChansOut, currentOutputChans.getHighestBit() + 1),
jlimit ((int) minChansOut, (int) maxChansOut, currentOutputChans.getHighestBit() + 1),
bufferSize))
{
error = outputDevice->error;
@@ -469,7 +469,7 @@ public:
}
if (! inputDevice->setParameters ((unsigned int) sampleRate,
jlimit (minChansIn, maxChansIn, currentInputChans.getHighestBit() + 1),
jlimit ((int) minChansIn, (int) maxChansIn, currentInputChans.getHighestBit() + 1),
bufferSize))
{
error = inputDevice->error;


+ 1
- 2
build/linux/platform_specific_code/juce_linux_Files.cpp View File

@@ -285,8 +285,7 @@ void juce_setCurrentExecutableFileName (const String& filename) throw()
const File File::getCurrentWorkingDirectory() throw()
{
char buf [2048];
getcwd (buf, sizeof(buf));
return File (String::fromUTF8 ((const uint8*) buf));
return File (String::fromUTF8 ((const uint8*) getcwd (buf, sizeof (buf))));
}
bool File::setAsCurrentWorkingDirectory() const throw()


+ 1
- 1
build/linux/platform_specific_code/juce_linux_Windowing.cpp View File

@@ -2574,7 +2574,7 @@ private:
};
//==============================================================================
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{
if (enableOrDisable)
kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));


+ 341
- 338
build/macosx/platform_specific_code/juce_mac_Fonts.mm View File

@@ -1,338 +1,341 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
// (This file gets included by juce_mac_NativeCode.mm, rather than being
// compiled on its own).
#ifdef JUCE_INCLUDED_FILE
//==============================================================================
class FontHelper
{
NSFont* font;
public:
String name;
bool isBold, isItalic;
float fontSize, totalSize, ascent;
int refCount;
FontHelper (const String& name_,
const bool bold_,
const bool italic_,
const float size_)
: font (0),
name (name_),
isBold (bold_),
isItalic (italic_),
fontSize (size_),
refCount (1)
{
font = [NSFont fontWithName: juceStringToNS (name_) size: size_];
if (italic_)
font = [[NSFontManager sharedFontManager] convertFont: font toHaveTrait: NSItalicFontMask];
if (bold_)
font = [[NSFontManager sharedFontManager] convertFont: font toHaveTrait: NSBoldFontMask];
[font retain];
ascent = fabsf ([font ascender]);
totalSize = ascent + fabsf ([font descender]);
}
~FontHelper()
{
[font release];
}
bool getPathAndKerning (const juce_wchar char1,
const juce_wchar char2,
Path* path,
float& kerning,
float* ascent,
float* descent)
{
const ScopedAutoReleasePool pool;
if (font == 0
|| ! [[font coveredCharacterSet] longCharacterIsMember: (UTF32Char) char1])
return false;
String chars;
chars << ' ' << char1 << char2;
NSTextStorage* textStorage = [[[NSTextStorage alloc] initWithString: juceStringToNS (chars)] autorelease];
NSLayoutManager* layoutManager = [[[NSLayoutManager alloc] init] autorelease];
NSTextContainer* textContainer = [[[NSTextContainer alloc] init] autorelease];
[layoutManager addTextContainer: textContainer];
[textStorage addLayoutManager: layoutManager];
[textStorage setFont: font];
unsigned int glyphIndex = [layoutManager glyphRangeForCharacterRange: NSMakeRange (1, 1)
actualCharacterRange: 0].location;
NSPoint p1 = [layoutManager locationForGlyphAtIndex: glyphIndex];
NSPoint p2 = [layoutManager locationForGlyphAtIndex: glyphIndex + 1];
kerning = p2.x - p1.x;
if (ascent != 0)
*ascent = this->ascent;
if (descent != 0)
*descent = fabsf ([font descender]);
if (path != 0)
{
NSBezierPath* bez = [NSBezierPath bezierPath];
[bez moveToPoint: NSMakePoint (0, 0)];
[bez appendBezierPathWithGlyph: [layoutManager glyphAtIndex: glyphIndex]
inFont: font];
for (int i = 0; i < [bez elementCount]; ++i)
{
NSPoint p[3];
switch ([bez elementAtIndex: i associatedPoints: p])
{
case NSMoveToBezierPathElement:
path->startNewSubPath (p[0].x, -p[0].y);
break;
case NSLineToBezierPathElement:
path->lineTo (p[0].x, -p[0].y);
break;
case NSCurveToBezierPathElement:
path->cubicTo (p[0].x, -p[0].y, p[1].x, -p[1].y, p[2].x, -p[2].y);
break;
case NSClosePathBezierPathElement:
path->closeSubPath();
break;
default:
jassertfalse
break;
}
}
}
return kerning != 0;
}
juce_wchar getDefaultChar()
{
return 0;
}
};
//==============================================================================
class FontHelperCache : public Timer,
public DeletedAtShutdown
{
VoidArray cache;
public:
FontHelperCache()
{
}
~FontHelperCache()
{
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f = (FontHelper*) cache.getUnchecked(i);
delete f;
}
clearSingletonInstance();
}
FontHelper* getFont (const String& name,
const bool bold,
const bool italic,
const float size = 1024)
{
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f = (FontHelper*) cache.getUnchecked(i);
if (f->name == name
&& f->isBold == bold
&& f->isItalic == italic
&& f->fontSize == size)
{
f->refCount++;
return f;
}
}
FontHelper* const f = new FontHelper (name, bold, italic, size);
cache.add (f);
return f;
}
void releaseFont (FontHelper* f)
{
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f2 = (FontHelper*) cache.getUnchecked(i);
if (f == f2)
{
f->refCount--;
if (f->refCount == 0)
startTimer (5000);
break;
}
}
}
void timerCallback()
{
stopTimer();
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f = (FontHelper*) cache.getUnchecked(i);
if (f->refCount == 0)
{
cache.remove (i);
delete f;
}
}
if (cache.size() == 0)
delete this;
}
juce_DeclareSingleton_SingleThreaded_Minimal (FontHelperCache)
};
juce_ImplementSingleton_SingleThreaded (FontHelperCache)
//==============================================================================
void Typeface::initialiseTypefaceCharacteristics (const String& fontName,
bool bold,
bool italic,
bool addAllGlyphsToFont) throw()
{
// This method is only safe to be called from the normal UI thread..
jassert (MessageManager::getInstance()->isThisTheMessageThread());
FontHelper* const helper = FontHelperCache::getInstance()
->getFont (fontName, bold, italic);
clear();
setAscent (helper->ascent / helper->totalSize);
setName (fontName);
setDefaultCharacter (helper->getDefaultChar());
setBold (bold);
setItalic (italic);
if (addAllGlyphsToFont)
{
//xxx
jassertfalse
}
FontHelperCache::getInstance()->releaseFont (helper);
}
bool Typeface::findAndAddSystemGlyph (juce_wchar character) throw()
{
// This method is only safe to be called from the normal UI thread..
jassert (MessageManager::getInstance()->isThisTheMessageThread());
FontHelper* const helper = FontHelperCache::getInstance()
->getFont (getName(), isBold(), isItalic());
Path path;
float width;
bool foundOne = false;
if (helper->getPathAndKerning (character, T('I'), &path, width, 0, 0))
{
path.applyTransform (AffineTransform::scale (1.0f / helper->totalSize,
1.0f / helper->totalSize));
addGlyph (character, path, width / helper->totalSize);
for (int i = 0; i < glyphs.size(); ++i)
{
const TypefaceGlyphInfo* const g = (const TypefaceGlyphInfo*) glyphs.getUnchecked(i);
float kerning;
if (helper->getPathAndKerning (character, g->getCharacter(), 0, kerning, 0, 0))
{
kerning = (kerning - width) / helper->totalSize;
if (kerning != 0)
addKerningPair (character, g->getCharacter(), kerning);
}
if (helper->getPathAndKerning (g->getCharacter(), character, 0, kerning, 0, 0))
{
kerning = kerning / helper->totalSize - g->width;
if (kerning != 0)
addKerningPair (g->getCharacter(), character, kerning);
}
}
foundOne = true;
}
FontHelperCache::getInstance()->releaseFont (helper);
return foundOne;
}
//==============================================================================
const StringArray Font::findAllTypefaceNames() throw()
{
StringArray names;
const ScopedAutoReleasePool pool;
NSArray* fonts = [[NSFontManager sharedFontManager] availableFontFamilies];
for (int i = 0; i < [fonts count]; ++i)
names.add (nsStringToJuce ((NSString*) [fonts objectAtIndex: i]));
names.sort (true);
return names;
}
void Typeface::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw()
{
defaultSans = "Lucida Grande";
defaultSerif = "Times New Roman";
defaultFixed = "Monaco";
}
#endif
/*
==============================================================================

This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.

------------------------------------------------------------------------------

JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA

------------------------------------------------------------------------------

If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.

==============================================================================
*/

// (This file gets included by juce_mac_NativeCode.mm, rather than being
// compiled on its own).
#ifdef JUCE_INCLUDED_FILE


//==============================================================================
class FontHelper
{
NSFont* font;

public:
String name;
bool isBold, isItalic;
float fontSize, totalSize, ascent;
int refCount;

FontHelper (const String& name_,
const bool bold_,
const bool italic_,
const float size_)
: font (0),
name (name_),
isBold (bold_),
isItalic (italic_),
fontSize (size_),
refCount (1)
{
font = [NSFont fontWithName: juceStringToNS (name_) size: size_];

if (italic_)
font = [[NSFontManager sharedFontManager] convertFont: font toHaveTrait: NSItalicFontMask];

if (bold_)
font = [[NSFontManager sharedFontManager] convertFont: font toHaveTrait: NSBoldFontMask];

[font retain];

ascent = fabsf ([font ascender]);
totalSize = ascent + fabsf ([font descender]);
}

~FontHelper()
{
[font release];
}

bool getPathAndKerning (const juce_wchar char1,
const juce_wchar char2,
Path* path,
float& kerning,
float* ascent,
float* descent)
{
const ScopedAutoReleasePool pool;

if (font == 0
|| ! [[font coveredCharacterSet] longCharacterIsMember: (UTF32Char) char1])
return false;

String chars;
chars << ' ' << char1 << char2;
NSTextStorage* textStorage = [[[NSTextStorage alloc]
initWithString: juceStringToNS (chars)
attributes: [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: 0]
forKey: NSLigatureAttributeName]] autorelease];
NSLayoutManager* layoutManager = [[[NSLayoutManager alloc] init] autorelease];
NSTextContainer* textContainer = [[[NSTextContainer alloc] init] autorelease];
[layoutManager addTextContainer: textContainer];
[textStorage addLayoutManager: layoutManager];
[textStorage setFont: font];

unsigned int glyphIndex = [layoutManager glyphRangeForCharacterRange: NSMakeRange (1, 1)
actualCharacterRange: 0].location;
NSPoint p1 = [layoutManager locationForGlyphAtIndex: glyphIndex];
NSPoint p2 = [layoutManager locationForGlyphAtIndex: glyphIndex + 1];
kerning = p2.x - p1.x;

if (ascent != 0)
*ascent = this->ascent;

if (descent != 0)
*descent = fabsf ([font descender]);

if (path != 0)
{
NSBezierPath* bez = [NSBezierPath bezierPath];
[bez moveToPoint: NSMakePoint (0, 0)];
[bez appendBezierPathWithGlyph: [layoutManager glyphAtIndex: glyphIndex]
inFont: font];

for (int i = 0; i < [bez elementCount]; ++i)
{
NSPoint p[3];
switch ([bez elementAtIndex: i associatedPoints: p])
{
case NSMoveToBezierPathElement:
path->startNewSubPath (p[0].x, -p[0].y);
break;
case NSLineToBezierPathElement:
path->lineTo (p[0].x, -p[0].y);
break;
case NSCurveToBezierPathElement:
path->cubicTo (p[0].x, -p[0].y, p[1].x, -p[1].y, p[2].x, -p[2].y);
break;
case NSClosePathBezierPathElement:
path->closeSubPath();
break;
default:
jassertfalse
break;
}
}
}

return kerning != 0;
}

juce_wchar getDefaultChar()
{
return 0;
}
};

//==============================================================================
class FontHelperCache : public Timer,
public DeletedAtShutdown
{
VoidArray cache;

public:
FontHelperCache()
{
}

~FontHelperCache()
{
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f = (FontHelper*) cache.getUnchecked(i);
delete f;
}

clearSingletonInstance();
}

FontHelper* getFont (const String& name,
const bool bold,
const bool italic,
const float size = 1024)
{
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f = (FontHelper*) cache.getUnchecked(i);

if (f->name == name
&& f->isBold == bold
&& f->isItalic == italic
&& f->fontSize == size)
{
f->refCount++;
return f;
}
}

FontHelper* const f = new FontHelper (name, bold, italic, size);
cache.add (f);
return f;
}

void releaseFont (FontHelper* f)
{
for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f2 = (FontHelper*) cache.getUnchecked(i);

if (f == f2)
{
f->refCount--;

if (f->refCount == 0)
startTimer (5000);

break;
}
}
}

void timerCallback()
{
stopTimer();

for (int i = cache.size(); --i >= 0;)
{
FontHelper* const f = (FontHelper*) cache.getUnchecked(i);

if (f->refCount == 0)
{
cache.remove (i);
delete f;
}
}

if (cache.size() == 0)
delete this;
}

juce_DeclareSingleton_SingleThreaded_Minimal (FontHelperCache)
};

juce_ImplementSingleton_SingleThreaded (FontHelperCache)

//==============================================================================
void Typeface::initialiseTypefaceCharacteristics (const String& fontName,
bool bold,
bool italic,
bool addAllGlyphsToFont) throw()
{
// This method is only safe to be called from the normal UI thread..
jassert (MessageManager::getInstance()->isThisTheMessageThread());

FontHelper* const helper = FontHelperCache::getInstance()
->getFont (fontName, bold, italic);

clear();
setAscent (helper->ascent / helper->totalSize);
setName (fontName);
setDefaultCharacter (helper->getDefaultChar());
setBold (bold);
setItalic (italic);

if (addAllGlyphsToFont)
{
//xxx
jassertfalse
}

FontHelperCache::getInstance()->releaseFont (helper);
}

bool Typeface::findAndAddSystemGlyph (juce_wchar character) throw()
{
// This method is only safe to be called from the normal UI thread..
jassert (MessageManager::getInstance()->isThisTheMessageThread());

FontHelper* const helper = FontHelperCache::getInstance()
->getFont (getName(), isBold(), isItalic());

Path path;
float width;
bool foundOne = false;

if (helper->getPathAndKerning (character, T('I'), &path, width, 0, 0))
{
path.applyTransform (AffineTransform::scale (1.0f / helper->totalSize,
1.0f / helper->totalSize));

addGlyph (character, path, width / helper->totalSize);

for (int i = 0; i < glyphs.size(); ++i)
{
const TypefaceGlyphInfo* const g = (const TypefaceGlyphInfo*) glyphs.getUnchecked(i);

float kerning;
if (helper->getPathAndKerning (character, g->getCharacter(), 0, kerning, 0, 0))
{
kerning = (kerning - width) / helper->totalSize;

if (kerning != 0)
addKerningPair (character, g->getCharacter(), kerning);
}

if (helper->getPathAndKerning (g->getCharacter(), character, 0, kerning, 0, 0))
{
kerning = kerning / helper->totalSize - g->width;

if (kerning != 0)
addKerningPair (g->getCharacter(), character, kerning);
}
}

foundOne = true;
}

FontHelperCache::getInstance()->releaseFont (helper);
return foundOne;
}

//==============================================================================
const StringArray Font::findAllTypefaceNames() throw()
{
StringArray names;

const ScopedAutoReleasePool pool;
NSArray* fonts = [[NSFontManager sharedFontManager] availableFontFamilies];

for (int i = 0; i < [fonts count]; ++i)
names.add (nsStringToJuce ((NSString*) [fonts objectAtIndex: i]));

names.sort (true);
return names;
}

void Typeface::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw()
{
defaultSans = "Lucida Grande";
defaultSerif = "Times New Roman";
defaultFixed = "Monaco";
}

#endif

+ 23
- 2
build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm View File

@@ -95,6 +95,7 @@ END_JUCE_NAMESPACE
{
@private
NSViewComponentPeer* owner;
bool isZooming;
}
- (void) setOwner: (NSViewComponentPeer*) owner;
@@ -102,6 +103,7 @@ END_JUCE_NAMESPACE
- (BOOL) windowShouldClose: (id) window;
- (NSRect) constrainFrameRect: (NSRect) frameRect toScreen: (NSScreen*) screen;
- (NSSize) windowWillResize: (NSWindow*) window toSize: (NSSize) proposedFrameSize;
- (void) zoom: (id) sender;
@end
BEGIN_JUCE_NAMESPACE
@@ -418,6 +420,7 @@ END_JUCE_NAMESPACE
- (void) setOwner: (NSViewComponentPeer*) owner_
{
owner = owner_;
isZooming = false;
}
- (BOOL) canBecomeKeyWindow
@@ -440,6 +443,9 @@ END_JUCE_NAMESPACE
- (NSSize) windowWillResize: (NSWindow*) window toSize: (NSSize) proposedFrameSize
{
if (isZooming)
return proposedFrameSize;
NSRect frameRect = [self frame];
frameRect.size = proposedFrameSize;
@@ -449,6 +455,21 @@ END_JUCE_NAMESPACE
return frameRect.size;
}
- (void) zoom: (id) sender
{
isZooming = true;
[super zoom: sender];
isZooming = false;
}
- (void) windowWillMove: (NSNotification*) notification
{
if (juce::Component::getCurrentlyModalComponent() != 0
&& owner->getComponent()->isCurrentlyBlockedByAnotherModalComponent()
&& (owner->getStyleFlags() & juce::ComponentPeer::windowHasTitleBar) != 0)
juce::Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
}
@end
//==============================================================================
@@ -1362,14 +1383,14 @@ void NSViewComponentPeer::redirectMovedOrResized()
}
//==============================================================================
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{
// Very annoyingly, this function has to use the old SetSystemUIMode function,
// which is in Carbon.framework. But, because there's no Cocoa equivalent, it
// is apparently still available in 64-bit apps..
if (enableOrDisable)
{
SetSystemUIMode (kUIModeAllSuppressed, kUIOptionAutoShowMenuBar);
SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0);
kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));
}
else


+ 2
- 1
build/macosx/platform_specific_code/juce_mac_NamedPipe.cpp View File

@@ -70,7 +70,8 @@ void NamedPipe::cancelPendingReads()
intern->stopReadOperation = true;
char buffer [1] = { 0 };
::write (intern->pipeIn, buffer, 1);
int bytesWritten = ::write (intern->pipeIn, buffer, 1);
(void) bytesWritten;
int timeout = 2000;
while (intern->blocked && --timeout >= 0)


+ 1
- 1
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

@@ -2380,7 +2380,7 @@ bool Desktop::isScreenSaverEnabled() throw()
*/
//==============================================================================
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/)
{
if (enableOrDisable)
kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));


+ 41
- 17
juce_amalgamated.cpp View File

@@ -5759,7 +5759,7 @@ const File File::getChildFile (String relativePath) const throw()
if (relativePath [2] == 0 || relativePath[2] == separator)
{
const int lastSlash = path.lastIndexOfChar (separator);
if (lastSlash > 0)
if (lastSlash >= 0)
path = path.substring (0, lastSlash);

relativePath = relativePath.substring (3);
@@ -41250,9 +41250,9 @@ void Desktop::resetTimer() throw()
getMousePosition (lastMouseX, lastMouseY);
}

extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable);
extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars);

void Desktop::setKioskModeComponent (Component* componentToUse)
void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars)
{
if (kioskModeComponent != componentToUse)
{
@@ -41263,7 +41263,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse)

if (kioskModeComponent->isValidComponent())
{
juce_setKioskComponent (kioskModeComponent, false);
juce_setKioskComponent (kioskModeComponent, false, allowMenusAndBars);

kioskModeComponent->setBounds (kioskComponentOriginalBounds);
}
@@ -41279,7 +41279,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse)

kioskComponentOriginalBounds = kioskModeComponent->getBounds();

juce_setKioskComponent (kioskModeComponent, true);
juce_setKioskComponent (kioskModeComponent, true, allowMenusAndBars);
}
}
}
@@ -244519,7 +244519,7 @@ bool Desktop::isScreenSaverEnabled() throw()
}
*/

void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/)
{
if (enableOrDisable)
kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));
@@ -255242,8 +255242,7 @@ void juce_setCurrentExecutableFileName (const String& filename) throw()
const File File::getCurrentWorkingDirectory() throw()
{
char buf [2048];
getcwd (buf, sizeof(buf));
return File (String::fromUTF8 ((const uint8*) buf));
return File (String::fromUTF8 ((const uint8*) getcwd (buf, sizeof (buf))));
}

bool File::setAsCurrentWorkingDirectory() const throw()
@@ -255485,7 +255484,8 @@ void NamedPipe::cancelPendingReads()
intern->stopReadOperation = true;

char buffer [1] = { 0 };
::write (intern->pipeIn, buffer, 1);
int bytesWritten = ::write (intern->pipeIn, buffer, 1);
(void) bytesWritten;

int timeout = 2000;
while (intern->blocked && --timeout >= 0)
@@ -257179,7 +257179,7 @@ public:
}

if (! outputDevice->setParameters ((unsigned int) sampleRate,
jlimit (minChansOut, maxChansOut, currentOutputChans.getHighestBit() + 1),
jlimit ((int) minChansOut, (int) maxChansOut, currentOutputChans.getHighestBit() + 1),
bufferSize))
{
error = outputDevice->error;
@@ -257200,7 +257200,7 @@ public:
}

if (! inputDevice->setParameters ((unsigned int) sampleRate,
jlimit (minChansIn, maxChansIn, currentInputChans.getHighestBit() + 1),
jlimit ((int) minChansIn, (int) maxChansIn, currentInputChans.getHighestBit() + 1),
bufferSize))
{
error = inputDevice->error;
@@ -262879,7 +262879,7 @@ private:
Array <Atom> srcMimeTypeAtomList;
};

void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{
if (enableOrDisable)
kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));
@@ -265930,6 +265930,7 @@ END_JUCE_NAMESPACE
{
@private
NSViewComponentPeer* owner;
bool isZooming;
}

- (void) setOwner: (NSViewComponentPeer*) owner;
@@ -265937,6 +265938,7 @@ END_JUCE_NAMESPACE
- (BOOL) windowShouldClose: (id) window;
- (NSRect) constrainFrameRect: (NSRect) frameRect toScreen: (NSScreen*) screen;
- (NSSize) windowWillResize: (NSWindow*) window toSize: (NSSize) proposedFrameSize;
- (void) zoom: (id) sender;
@end

BEGIN_JUCE_NAMESPACE
@@ -266242,6 +266244,7 @@ END_JUCE_NAMESPACE
- (void) setOwner: (NSViewComponentPeer*) owner_
{
owner = owner_;
isZooming = false;
}

- (BOOL) canBecomeKeyWindow
@@ -266264,6 +266267,9 @@ END_JUCE_NAMESPACE

- (NSSize) windowWillResize: (NSWindow*) window toSize: (NSSize) proposedFrameSize
{
if (isZooming)
return proposedFrameSize;

NSRect frameRect = [self frame];
frameRect.size = proposedFrameSize;

@@ -266273,6 +266279,21 @@ END_JUCE_NAMESPACE
return frameRect.size;
}

- (void) zoom: (id) sender
{
isZooming = true;
[super zoom: sender];
isZooming = false;
}

- (void) windowWillMove: (NSNotification*) notification
{
if (juce::Component::getCurrentlyModalComponent() != 0
&& owner->getComponent()->isCurrentlyBlockedByAnotherModalComponent()
&& (owner->getStyleFlags() & juce::ComponentPeer::windowHasTitleBar) != 0)
juce::Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
}

@end

BEGIN_JUCE_NAMESPACE
@@ -267137,7 +267158,6 @@ void NSViewComponentPeer::drawRect (NSRect r)

const NSRect* rects = 0;
NSInteger numRects = 0;

[view getRectsBeingDrawn: &rects count: &numRects];

RectangleList clip;
@@ -267177,14 +267197,14 @@ void NSViewComponentPeer::redirectMovedOrResized()
handleMovedOrResized();
}

void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{
// Very annoyingly, this function has to use the old SetSystemUIMode function,
// which is in Carbon.framework. But, because there's no Cocoa equivalent, it
// is apparently still available in 64-bit apps..
if (enableOrDisable)
{
SetSystemUIMode (kUIModeAllSuppressed, kUIOptionAutoShowMenuBar);
SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0);
kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));
}
else
@@ -269354,7 +269374,10 @@ public:

String chars;
chars << ' ' << char1 << char2;
NSTextStorage* textStorage = [[[NSTextStorage alloc] initWithString: juceStringToNS (chars)] autorelease];
NSTextStorage* textStorage = [[[NSTextStorage alloc]
initWithString: juceStringToNS (chars)
attributes: [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: 0]
forKey: NSLigatureAttributeName]] autorelease];
NSLayoutManager* layoutManager = [[[NSLayoutManager alloc] init] autorelease];
NSTextContainer* textContainer = [[[NSTextContainer alloc] init] autorelease];
[layoutManager addTextContainer: textContainer];
@@ -272020,7 +272043,8 @@ void NamedPipe::cancelPendingReads()
intern->stopReadOperation = true;

char buffer [1] = { 0 };
::write (intern->pipeIn, buffer, 1);
int bytesWritten = ::write (intern->pipeIn, buffer, 1);
(void) bytesWritten;

int timeout = 2000;
while (intern->blocked && --timeout >= 0)


+ 7
- 2
juce_amalgamated.h View File

@@ -11214,7 +11214,7 @@ public:
{
jassert (numValuesToRemove >= 0);

if (numValuesToRemove > 0
if (numValuesToRemove != 0
&& firstValue < values.getLast())
{
const bool onAtStart = contains (firstValue - 1);
@@ -23880,8 +23880,13 @@ public:
To exit kiosk mode, just call setKioskModeComponent (0). When this is called,
the component that's currently being used will be resized back to the size
and position it was in before being put into this mode.

If allowMenusAndBars is true, things like the menu and dock (on mac) are still
allowed to pop up when the mouse moves onto them. If this is false, it'll try
to hide as much on-screen paraphenalia as possible.
*/
void setKioskModeComponent (Component* componentToUse);
void setKioskModeComponent (Component* componentToUse,
const bool allowMenusAndBars = true);

/** Returns the component that is currently being used in kiosk-mode.



+ 4
- 4
src/juce_appframework/gui/components/juce_Desktop.cpp View File

@@ -328,9 +328,9 @@ void Desktop::resetTimer() throw()
}
//==============================================================================
extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable);
extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars);
void Desktop::setKioskModeComponent (Component* componentToUse)
void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars)
{
if (kioskModeComponent != componentToUse)
{
@@ -341,7 +341,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse)
if (kioskModeComponent->isValidComponent())
{
juce_setKioskComponent (kioskModeComponent, false);
juce_setKioskComponent (kioskModeComponent, false, allowMenusAndBars);
kioskModeComponent->setBounds (kioskComponentOriginalBounds);
}
@@ -357,7 +357,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse)
kioskComponentOriginalBounds = kioskModeComponent->getBounds();
juce_setKioskComponent (kioskModeComponent, true);
juce_setKioskComponent (kioskModeComponent, true, allowMenusAndBars);
}
}
}


+ 6
- 1
src/juce_appframework/gui/components/juce_Desktop.h View File

@@ -185,8 +185,13 @@ public:
To exit kiosk mode, just call setKioskModeComponent (0). When this is called,
the component that's currently being used will be resized back to the size
and position it was in before being put into this mode.
If allowMenusAndBars is true, things like the menu and dock (on mac) are still
allowed to pop up when the mouse moves onto them. If this is false, it'll try
to hide as much on-screen paraphenalia as possible.
*/
void setKioskModeComponent (Component* componentToUse);
void setKioskModeComponent (Component* componentToUse,
const bool allowMenusAndBars = true);
/** Returns the component that is currently being used in kiosk-mode.


+ 1
- 1
src/juce_core/containers/juce_SparseSet.h View File

@@ -225,7 +225,7 @@ public:
{
jassert (numValuesToRemove >= 0);
if (numValuesToRemove > 0
if (numValuesToRemove != 0
&& firstValue < values.getLast())
{
const bool onAtStart = contains (firstValue - 1);


+ 1
- 1
src/juce_core/io/files/juce_File.cpp View File

@@ -483,7 +483,7 @@ const File File::getChildFile (String relativePath) const throw()
if (relativePath [2] == 0 || relativePath[2] == separator)
{
const int lastSlash = path.lastIndexOfChar (separator);
if (lastSlash > 0)
if (lastSlash >= 0)
path = path.substring (0, lastSlash);
relativePath = relativePath.substring (3);


Loading…
Cancel
Save