Browse Source

Fix for mac window ordering that was causing drag and drop problems. Added a sanity-check to the text editor's undo transaction size.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
c539e8f5c0
9 changed files with 195 additions and 102 deletions
  1. +62
    -60
      juce_Config.h
  2. +62
    -20
      juce_amalgamated.cpp
  3. +3
    -1
      juce_amalgamated.h
  4. +27
    -17
      src/gui/components/controls/juce_TextEditor.cpp
  5. +17
    -3
      src/gui/components/juce_Desktop.cpp
  6. +1
    -1
      src/gui/components/juce_Desktop.h
  7. +7
    -0
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  8. +10
    -0
      src/utilities/juce_UndoManager.cpp
  9. +6
    -0
      src/utilities/juce_UndoManager.h

+ 62
- 60
juce_Config.h View File

@@ -40,17 +40,17 @@
#endif
//=============================================================================
/** Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and project settings,
but if you define this value, you can override this can force it to be true or
false.
/** JUCE_FORCE_DEBUG: Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and
project settings, but if you define this value, you can override this can force
it to be true or false.
*/
#ifndef JUCE_FORCE_DEBUG
//#define JUCE_FORCE_DEBUG 1
#endif
//=============================================================================
/** If this flag is enabled, the the jassert and jassertfalse macros will
always use Logger::writeToLog() to write a message when an assertion happens.
/** JUCE_LOG_ASSERTIONS: If this flag is enabled, the the jassert and jassertfalse
macros will always use Logger::writeToLog() to write a message when an assertion happens.
Enabling it will also leave this turned on in release builds. When it's disabled,
however, the jassert and jassertfalse macros will not be compiled in a
@@ -63,48 +63,42 @@
#endif
//=============================================================================
/** Comment out this macro if you haven't got the Steinberg ASIO SDK, without
which the ASIOAudioIODevice class can't be built. See the comments in the
ASIOAudioIODevice class's header file for more info about this.
/** JUCE_ASIO: Enables ASIO audio devices (MS Windows only).
Turning this on means that you'll need to have the Steinberg ASIO SDK installed
on your Windows build machine.
(This only affects a Win32 build)
See the comments in the ASIOAudioIODevice class's header file for more
info about this.
*/
#ifndef JUCE_ASIO
#define JUCE_ASIO 1
#endif
/** Comment out this macro to disable the Windows WASAPI audio device type.
/** JUCE_WASAPI: Enables WASAPI audio devices (Windows Vista and above).
*/
#ifndef JUCE_WASAPI
// #define JUCE_WASAPI 1
#endif
/** Comment out this macro to disable the Windows WASAPI audio device type.
/** JUCE_DIRECTSOUND: Enables DirectSound audio (MS Windows only).
*/
#ifndef JUCE_DIRECTSOUND
#define JUCE_DIRECTSOUND 1
#endif
/** Comment out this macro to disable building of ALSA device support on Linux.
*/
/** JUCE_ALSA: Enables ALSA audio devices (Linux only). */
#ifndef JUCE_ALSA
#define JUCE_ALSA 1
#endif
/** Comment out this macro to disable building of JACK device support on Linux.
*/
/** JUCE_JACK: Enables JACK audio devices (Linux only). */
#ifndef JUCE_JACK
#define JUCE_JACK 1
#endif
//=============================================================================
/** Comment out this macro if you don't want to enable QuickTime or if you don't
have the SDK installed.
If this flag is not enabled, the QuickTimeMovieComponent and QuickTimeAudioFormat
classes will be unavailable.
On Windows, if you enable this, you'll need to have the QuickTime SDK
/** JUCE_QUICKTIME: Enables the QuickTimeMovieComponent class (Mac and Windows).
If you're building on Windows, you'll need to have the Apple QuickTime SDK
installed, and its header files will need to be on your include path.
*/
#if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
@@ -113,83 +107,92 @@
//=============================================================================
/** Comment out this macro if you don't want to enable OpenGL or if you don't
have the appropriate headers and libraries available. If it's not enabled, the
OpenGLComponent class will be unavailable.
/** JUCE_OPENGL: Enables the OpenGLComponent class (available on all platforms).
If you're not using OpenGL, you might want to turn this off to reduce your binary's size.
*/
#ifndef JUCE_OPENGL
#define JUCE_OPENGL 1
#endif
//=============================================================================
/** These flags enable the Ogg-Vorbis and Flac audio formats.
If you're not going to need either of these formats, turn off the flags to
avoid bloating your codebase with them.
/** JUCE_USE_FLAC: Enables the FLAC audio codec classes (available on all platforms).
If your app doesn't need to read FLAC files, you might want to disable this to
reduce the size of your codebase and build time.
*/
#ifndef JUCE_USE_FLAC
#define JUCE_USE_FLAC 1
#endif
/** JUCE_USE_OGGBORBIS: Enables the Ogg-Vorbis audio codec classes (available on all platforms).
If your app doesn't need to read Ogg-Vorbis files, you might want to disable this to
reduce the size of your codebase and build time.
*/
#ifndef JUCE_USE_OGGVORBIS
#define JUCE_USE_OGGVORBIS 1
#endif
//=============================================================================
/** This flag lets you enable the AudioCDBurner class. You might want to disable
it to build without the MS SDK under windows.
/** JUCE_USE_CDBURNER: Enables the audio CD reader code (Mac and Windows only).
Unless you're using CD-burning, you should probably turn this flag off to
reduce code size.
*/
#if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
#define JUCE_USE_CDBURNER 1
#endif
/** This flag lets you enable support for the AudioCDReader class. You might want to disable
it to build without the MS SDK under windows.
/** JUCE_USE_CDREADER: Enables the audio CD reader code (Mac and Windows only).
Unless you're using CD-reading, you should probably turn this flag off to
reduce code size.
*/
#ifndef JUCE_USE_CDREADER
#define JUCE_USE_CDREADER 1
#endif
//=============================================================================
/** Enabling this provides support for cameras, using the CameraDevice class
/** JUCE_USE_CAMERA: Enables web-cam support using the CameraDevice class (Mac and Windows).
*/
#if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
// #define JUCE_USE_CAMERA 1
#endif
//=============================================================================
/** Enabling this macro means that all regions that get repainted will have a coloured
line drawn around them.
This is handy if you're trying to optimise drawing, because it lets you easily see
when anything is being repainted unnecessarily.
/** JUCE_ENABLE_REPAINT_DEBUGGING: If this option is turned on, each area of the screen that
gets repainted will flash in a random colour, so that you can check exactly how much and how
often your components are being drawn.
*/
#ifndef JUCE_ENABLE_REPAINT_DEBUGGING
// #define JUCE_ENABLE_REPAINT_DEBUGGING 1
#endif
//=============================================================================
/** Enable this under Linux to use Xinerama for multi-monitor support.
/** JUCE_USE_XINERAMA: Enables Xinerama multi-monitor support (Linux only).
Unless you specifically want to disable this, it's best to leave this option turned on.
*/
#ifndef JUCE_USE_XINERAMA
#define JUCE_USE_XINERAMA 1
#endif
/** Enable this under Linux to use XShm for faster shared-memory rendering.
/** JUCE_USE_XSHM: Enables X shared memory for faster rendering on Linux. This is best left
turned on unless you have a good reason to disable it.
*/
#ifndef JUCE_USE_XSHM
#define JUCE_USE_XSHM 1
#endif
//=============================================================================
/** Enabling this builds support for VST audio plugins.
/** JUCE_PLUGINHOST_VST: Enables the VST audio plugin hosting classes. This requires the
Steinberg VST SDK to be installed on your machine, and should be left turned off unless
you're building a plugin hosting app.
@see VSTPluginFormat, AudioPluginFormat, AudioPluginFormatManager, JUCE_PLUGINHOST_AU
*/
#ifndef JUCE_PLUGINHOST_VST
// #define JUCE_PLUGINHOST_VST 1
#endif
/** Enabling this builds support for AudioUnit audio plugins.
/** JUCE_PLUGINHOST_AU: Enables the AudioUnit plugin hosting classes. This is Mac-only,
of course, and should only be enabled if you're building a plugin hosting app.
@see AudioUnitPluginFormat, AudioPluginFormat, AudioPluginFormatManager, JUCE_PLUGINHOST_VST
*/
#ifndef JUCE_PLUGINHOST_AU
@@ -197,15 +200,15 @@
#endif
//=============================================================================
/** Enabling this will avoid including any UI code in the build. This is handy for
writing command-line utilities, e.g. on linux boxes which don't have some
of the UI libraries installed.
/** JUCE_ONLY_BUILD_CORE_LIBRARY: Enabling this will avoid including any UI classes in the build.
This should be enabled if you're writing a console application.
*/
#ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
//#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
#endif
/** This lets you disable building of the WebBrowserComponent, if it's not required.
/** JUCE_WEB_BROWSER: This lets you disable the WebBrowserComponent class (Mac and Windows).
If you're not using any embedded web-pages, turning this off may reduce your code size.
*/
#ifndef JUCE_WEB_BROWSER
#define JUCE_WEB_BROWSER 1
@@ -213,18 +216,19 @@
//=============================================================================
/** Setting this allows the build to use old Carbon libraries that will be
deprecated in newer versions of OSX. This is handy for some backwards-compatibility
reasons.
/** JUCE_SUPPORT_CARBON: Enabling this allows the Mac code to use old Carbon library functions.
Carbon isn't required for a normal app, but may be needed by specialised classes like
plugin-hosts, which support older APIs.
*/
#ifndef JUCE_SUPPORT_CARBON
#define JUCE_SUPPORT_CARBON 1
#endif
//=============================================================================
/* These flags let you avoid the direct inclusion of some 3rd-party libs in the
codebase - you might need to use this if you're linking to some of these libraries
yourself.
/* JUCE_INCLUDE_ZLIB_CODE: Can be used to disable Juce's embedded 3rd-party zlib code.
You might need to tweak this if you're linking to an external zlib library in your app,
but for normal apps, this option should be left alone.
*/
#ifndef JUCE_INCLUDE_ZLIB_CODE
#define JUCE_INCLUDE_ZLIB_CODE 1
@@ -247,25 +251,23 @@
#endif
//=============================================================================
/** Enable this to add extra memory-leak info to the new and delete operators.
/** JUCE_CHECK_MEMORY_LEAKS: Enables a memory-leak check when an app terminates.
(Currently, this only affects Windows builds in debug mode).
*/
#ifndef JUCE_CHECK_MEMORY_LEAKS
#define JUCE_CHECK_MEMORY_LEAKS 1
#endif
/** Enable this to turn on juce's internal catching of exceptions.
Turning it off will avoid any exception catching. With it on, all exceptions
/** JUCE_CATCH_UNHANDLED_EXCEPTIONS: Turn on juce's internal catching of exceptions
that are thrown by the message dispatch loop. With it enabled, any unhandled exceptions
are passed to the JUCEApplication::unhandledException() callback for logging.
*/
#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
#endif
/** If this macro is set, the Juce String class will use unicode as its
internal representation. If it isn't set, it'll use ANSI.
/** JUCE_STRINGS_ARE_UNICODE: If this macro is set, the Juce String class will use
unicode as its internal representation. If disabled, it'll use ANSI.
*/
#ifndef JUCE_STRINGS_ARE_UNICODE
#define JUCE_STRINGS_ARE_UNICODE 1


+ 62
- 20
juce_amalgamated.cpp View File

@@ -18980,6 +18980,16 @@ void UndoManager::getActionsInCurrentTransaction (Array <const UndoableAction*>&
}
}

int UndoManager::getNumActionsInCurrentTransaction() const
{
const OwnedArray <UndoableAction>* const commandSet = transactions [nextIndex - 1];

if (commandSet != 0 && ! newTransaction)
return commandSet->size();

return 0;
}

END_JUCE_NAMESPACE
/********* End of inlined file: juce_UndoManager.cpp *********/

@@ -42226,7 +42236,7 @@ int Desktop::getNumComponents() const throw()

Component* Desktop::getComponent (const int index) const throw()
{
return (Component*) desktopComponents [index];
return desktopComponents [index];
}

Component* Desktop::findComponentAt (const int screenX,
@@ -42234,7 +42244,7 @@ Component* Desktop::findComponentAt (const int screenX,
{
for (int i = desktopComponents.size(); --i >= 0;)
{
Component* const c = (Component*) desktopComponents.getUnchecked(i);
Component* const c = desktopComponents.getUnchecked(i);

int x = screenX, y = screenY;
c->globalPositionToRelative (x, y);
@@ -42264,7 +42274,21 @@ void Desktop::componentBroughtToFront (Component* const c) throw()
jassert (index >= 0);

if (index >= 0)
desktopComponents.move (index, -1);
{
int newIndex = -1;

if (! c->isAlwaysOnTop())
{
newIndex = desktopComponents.size();

while (newIndex > 0 && desktopComponents.getUnchecked (newIndex - 1)->isAlwaysOnTop())
--newIndex;

--newIndex;
}

desktopComponents.move (index, newIndex);
}
}

// from Component.cpp
@@ -52352,12 +52376,17 @@ public:
}
};

const int flashSpeedIntervalMs = 380;
namespace TextEditorDefs
{
const int flashSpeedIntervalMs = 380;

const int textChangeMessageId = 0x10003001;
const int returnKeyMessageId = 0x10003002;
const int escapeKeyMessageId = 0x10003003;
const int focusLossMessageId = 0x10003004;
const int textChangeMessageId = 0x10003001;
const int returnKeyMessageId = 0x10003002;
const int escapeKeyMessageId = 0x10003003;
const int focusLossMessageId = 0x10003004;

const int maxActionsPerTransaction = 100;
}

TextEditor::TextEditor (const String& name,
const tchar passwordCharacter_)
@@ -52531,7 +52560,7 @@ void TextEditor::setCaretVisible (const bool shouldCaretBeVisible)
caretVisible = shouldCaretBeVisible;

if (shouldCaretBeVisible)
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);

setMouseCursor (shouldCaretBeVisible ? MouseCursor::IBeamCursor
: MouseCursor::NormalCursor);
@@ -52630,7 +52659,7 @@ void TextEditor::textWasChangedByValue()
void TextEditor::textChanged()
{
updateTextHolderSize();
postCommandMessage (textChangeMessageId);
postCommandMessage (TextEditorDefs::textChangeMessageId);

if (textValue.getValueSource().getReferenceCount() > 1)
{
@@ -52641,12 +52670,12 @@ void TextEditor::textChanged()

void TextEditor::returnPressed()
{
postCommandMessage (returnKeyMessageId);
postCommandMessage (TextEditorDefs::returnKeyMessageId);
}

void TextEditor::escapePressed()
{
postCommandMessage (escapeKeyMessageId);
postCommandMessage (TextEditorDefs::escapeKeyMessageId);
}

void TextEditor::addListener (TextEditorListener* const newListener)
@@ -52740,7 +52769,7 @@ void TextEditor::moveCaret (int newCaretPos)
repaintCaret();
caretFlashState = true;
caretPosition = newCaretPos;
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);
scrollToMakeSureCursorIsVisible();
repaintCaret();
}
@@ -53195,7 +53224,7 @@ void TextEditor::mouseDrag (const MouseEvent& e)
void TextEditor::mouseUp (const MouseEvent& e)
{
newTransaction();
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);

if (wasFocused || ! selectAllTextWhenFocused)
{
@@ -53524,7 +53553,7 @@ void TextEditor::focusGained (FocusChangeType)
repaint();

if (caretVisible)
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);

ComponentPeer* const peer = getPeer();
if (peer != 0 && ! isReadOnly())
@@ -53540,7 +53569,7 @@ void TextEditor::focusLost (FocusChangeType)
textHolder->stopTimer();
caretFlashState = false;

postCommandMessage (focusLossMessageId);
postCommandMessage (TextEditorDefs::focusLossMessageId);
repaint();
}

@@ -53573,19 +53602,19 @@ void TextEditor::handleCommandMessage (const int commandId)
{
switch (commandId)
{
case textChangeMessageId:
case TextEditorDefs::textChangeMessageId:
tl->textEditorTextChanged (*this);
break;

case returnKeyMessageId:
case TextEditorDefs::returnKeyMessageId:
tl->textEditorReturnKeyPressed (*this);
break;

case escapeKeyMessageId:
case TextEditorDefs::escapeKeyMessageId:
tl->textEditorEscapeKeyPressed (*this);
break;

case focusLossMessageId:
case TextEditorDefs::focusLossMessageId:
tl->textEditorFocusLost (*this);
break;

@@ -53623,6 +53652,9 @@ void TextEditor::insert (const String& text,
{
if (um != 0)
{
if (um->getNumActionsInCurrentTransaction() > TextEditorDefs::maxActionsPerTransaction)
newTransaction();

um->perform (new TextEditorInsertAction (*this,
text,
insertIndex,
@@ -53772,6 +53804,9 @@ void TextEditor::remove (const int startIndex,
index = nextIndex;
}

if (um->getNumActionsInCurrentTransaction() > TextEditorDefs::maxActionsPerTransaction)
newTransaction();

um->perform (new TextEditorRemoveAction (*this,
startIndex,
endIndex,
@@ -245879,9 +245914,14 @@ void NSViewComponentPeer::setVisible (bool shouldBeVisible)
else
{
if (shouldBeVisible)
{
[window orderFront: nil];
handleBroughtToFront();
}
else
{
[window orderOut: nil];
}
}
}

@@ -246137,6 +246177,8 @@ void NSViewComponentPeer::toFront (bool makeActiveWindow)
[window makeKeyAndOrderFront: nil];
else
[window orderFront: nil];

handleBroughtToFront();
}
}



+ 3
- 1
juce_amalgamated.h View File

@@ -6423,6 +6423,8 @@ public:

void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;

int getNumActionsInCurrentTransaction() const;

bool canRedo() const;

const String getRedoDescription() const;
@@ -12775,7 +12777,7 @@ private:
friend class Component;
friend class ComponentPeer;
SortedSet <void*> mouseListeners, focusListeners;
VoidArray desktopComponents;
Array <Component*> desktopComponents;

friend class DeletedAtShutdown;
friend class TopLevelWindowManager;


+ 27
- 17
src/gui/components/controls/juce_TextEditor.cpp View File

@@ -953,13 +953,17 @@ public:
};
//==============================================================================
const int flashSpeedIntervalMs = 380;
namespace TextEditorDefs
{
const int flashSpeedIntervalMs = 380;
const int textChangeMessageId = 0x10003001;
const int returnKeyMessageId = 0x10003002;
const int escapeKeyMessageId = 0x10003003;
const int focusLossMessageId = 0x10003004;
const int textChangeMessageId = 0x10003001;
const int returnKeyMessageId = 0x10003002;
const int escapeKeyMessageId = 0x10003003;
const int focusLossMessageId = 0x10003004;
const int maxActionsPerTransaction = 100;
}
//==============================================================================
TextEditor::TextEditor (const String& name,
@@ -1137,7 +1141,7 @@ void TextEditor::setCaretVisible (const bool shouldCaretBeVisible)
caretVisible = shouldCaretBeVisible;
if (shouldCaretBeVisible)
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);
setMouseCursor (shouldCaretBeVisible ? MouseCursor::IBeamCursor
: MouseCursor::NormalCursor);
@@ -1239,7 +1243,7 @@ void TextEditor::textWasChangedByValue()
void TextEditor::textChanged()
{
updateTextHolderSize();
postCommandMessage (textChangeMessageId);
postCommandMessage (TextEditorDefs::textChangeMessageId);
if (textValue.getValueSource().getReferenceCount() > 1)
{
@@ -1250,12 +1254,12 @@ void TextEditor::textChanged()
void TextEditor::returnPressed()
{
postCommandMessage (returnKeyMessageId);
postCommandMessage (TextEditorDefs::returnKeyMessageId);
}
void TextEditor::escapePressed()
{
postCommandMessage (escapeKeyMessageId);
postCommandMessage (TextEditorDefs::escapeKeyMessageId);
}
void TextEditor::addListener (TextEditorListener* const newListener)
@@ -1351,7 +1355,7 @@ void TextEditor::moveCaret (int newCaretPos)
repaintCaret();
caretFlashState = true;
caretPosition = newCaretPos;
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);
scrollToMakeSureCursorIsVisible();
repaintCaret();
}
@@ -1810,7 +1814,7 @@ void TextEditor::mouseDrag (const MouseEvent& e)
void TextEditor::mouseUp (const MouseEvent& e)
{
newTransaction();
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);
if (wasFocused || ! selectAllTextWhenFocused)
{
@@ -2142,7 +2146,7 @@ void TextEditor::focusGained (FocusChangeType)
repaint();
if (caretVisible)
textHolder->startTimer (flashSpeedIntervalMs);
textHolder->startTimer (TextEditorDefs::flashSpeedIntervalMs);
ComponentPeer* const peer = getPeer();
if (peer != 0 && ! isReadOnly())
@@ -2158,7 +2162,7 @@ void TextEditor::focusLost (FocusChangeType)
textHolder->stopTimer();
caretFlashState = false;
postCommandMessage (focusLossMessageId);
postCommandMessage (TextEditorDefs::focusLossMessageId);
repaint();
}
@@ -2192,19 +2196,19 @@ void TextEditor::handleCommandMessage (const int commandId)
{
switch (commandId)
{
case textChangeMessageId:
case TextEditorDefs::textChangeMessageId:
tl->textEditorTextChanged (*this);
break;
case returnKeyMessageId:
case TextEditorDefs::returnKeyMessageId:
tl->textEditorReturnKeyPressed (*this);
break;
case escapeKeyMessageId:
case TextEditorDefs::escapeKeyMessageId:
tl->textEditorEscapeKeyPressed (*this);
break;
case focusLossMessageId:
case TextEditorDefs::focusLossMessageId:
tl->textEditorFocusLost (*this);
break;
@@ -2243,6 +2247,9 @@ void TextEditor::insert (const String& text,
{
if (um != 0)
{
if (um->getNumActionsInCurrentTransaction() > TextEditorDefs::maxActionsPerTransaction)
newTransaction();
um->perform (new TextEditorInsertAction (*this,
text,
insertIndex,
@@ -2392,6 +2399,9 @@ void TextEditor::remove (const int startIndex,
index = nextIndex;
}
if (um->getNumActionsInCurrentTransaction() > TextEditorDefs::maxActionsPerTransaction)
newTransaction();
um->perform (new TextEditorRemoveAction (*this,
startIndex,
endIndex,


+ 17
- 3
src/gui/components/juce_Desktop.cpp View File

@@ -149,7 +149,7 @@ int Desktop::getNumComponents() const throw()
Component* Desktop::getComponent (const int index) const throw()
{
return (Component*) desktopComponents [index];
return desktopComponents [index];
}
Component* Desktop::findComponentAt (const int screenX,
@@ -157,7 +157,7 @@ Component* Desktop::findComponentAt (const int screenX,
{
for (int i = desktopComponents.size(); --i >= 0;)
{
Component* const c = (Component*) desktopComponents.getUnchecked(i);
Component* const c = desktopComponents.getUnchecked(i);
int x = screenX, y = screenY;
c->globalPositionToRelative (x, y);
@@ -188,7 +188,21 @@ void Desktop::componentBroughtToFront (Component* const c) throw()
jassert (index >= 0);
if (index >= 0)
desktopComponents.move (index, -1);
{
int newIndex = -1;
if (! c->isAlwaysOnTop())
{
newIndex = desktopComponents.size();
while (newIndex > 0 && desktopComponents.getUnchecked (newIndex - 1)->isAlwaysOnTop())
--newIndex;
--newIndex;
}
desktopComponents.move (index, newIndex);
}
}
//==============================================================================


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

@@ -240,7 +240,7 @@ private:
friend class Component;
friend class ComponentPeer;
SortedSet <void*> mouseListeners, focusListeners;
VoidArray desktopComponents;
Array <Component*> desktopComponents;
friend class DeletedAtShutdown;
friend class TopLevelWindowManager;


+ 7
- 0
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -769,9 +769,14 @@ void NSViewComponentPeer::setVisible (bool shouldBeVisible)
else
{
if (shouldBeVisible)
{
[window orderFront: nil];
handleBroughtToFront();
}
else
{
[window orderOut: nil];
}
}
}
@@ -1027,6 +1032,8 @@ void NSViewComponentPeer::toFront (bool makeActiveWindow)
[window makeKeyAndOrderFront: nil];
else
[window orderFront: nil];
handleBroughtToFront();
}
}


+ 10
- 0
src/utilities/juce_UndoManager.cpp View File

@@ -281,5 +281,15 @@ void UndoManager::getActionsInCurrentTransaction (Array <const UndoableAction*>&
}
}
int UndoManager::getNumActionsInCurrentTransaction() const
{
const OwnedArray <UndoableAction>* const commandSet = transactions [nextIndex - 1];
if (commandSet != 0 && ! newTransaction)
return commandSet->size();
return 0;
}
END_JUCE_NAMESPACE

+ 6
- 0
src/utilities/juce_UndoManager.h View File

@@ -185,6 +185,12 @@ public:
*/
void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
/** Returns the number of UndoableAction objects that have been performed during the
transaction that is currently open.
@see getActionsInCurrentTransaction
*/
int getNumActionsInCurrentTransaction() const;
//==============================================================================
/** Returns true if there's at least one action in the list to redo.


Loading…
Cancel
Save