- Library code update
- project update (added Eigen) git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@94 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -404,7 +404,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize)
|
||||
|
||||
for (int i = textBlocks.size(); --i >= 0;)
|
||||
{
|
||||
const AlertTextComp* const ac = static_cast <const AlertTextComp*> (textBlocks.getUnchecked(i));
|
||||
const AlertTextComp* const ac = static_cast<const AlertTextComp*> (textBlocks.getUnchecked(i));
|
||||
w = jmax (w, ac->getPreferredWidth());
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize)
|
||||
|
||||
for (int i = textBlocks.size(); --i >= 0;)
|
||||
{
|
||||
AlertTextComp* const ac = static_cast <AlertTextComp*> (textBlocks.getUnchecked(i));
|
||||
AlertTextComp* const ac = static_cast<AlertTextComp*> (textBlocks.getUnchecked(i));
|
||||
ac->updateLayout ((int) (w * 0.8f));
|
||||
h += ac->getHeight() + 10;
|
||||
}
|
||||
@@ -470,11 +470,11 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize)
|
||||
Component* const c = allComps.getUnchecked(i);
|
||||
h = 22;
|
||||
|
||||
const int comboIndex = comboBoxes.indexOf (dynamic_cast <ComboBox*> (c));
|
||||
const int comboIndex = comboBoxes.indexOf (dynamic_cast<ComboBox*> (c));
|
||||
if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty())
|
||||
y += labelHeight;
|
||||
|
||||
const int tbIndex = textBoxes.indexOf (dynamic_cast <TextEditor*> (c));
|
||||
const int tbIndex = textBoxes.indexOf (dynamic_cast<TextEditor*> (c));
|
||||
if (tbIndex >= 0 && textboxNames[tbIndex].isNotEmpty())
|
||||
y += labelHeight;
|
||||
|
||||
@@ -536,7 +536,8 @@ bool AlertWindow::keyPressed (const KeyPress& key)
|
||||
exitModalState (0);
|
||||
return true;
|
||||
}
|
||||
else if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1)
|
||||
|
||||
if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1)
|
||||
{
|
||||
buttons.getUnchecked(0)->triggerClick();
|
||||
return true;
|
||||
@@ -592,8 +593,8 @@ private:
|
||||
LookAndFeel& lf = associatedComponent != nullptr ? associatedComponent->getLookAndFeel()
|
||||
: LookAndFeel::getDefaultLookAndFeel();
|
||||
|
||||
ScopedPointer <Component> alertBox (lf.createAlertWindow (title, message, button1, button2, button3,
|
||||
iconType, numButtons, associatedComponent));
|
||||
ScopedPointer<Component> alertBox (lf.createAlertWindow (title, message, button1, button2, button3,
|
||||
iconType, numButtons, associatedComponent));
|
||||
|
||||
jassert (alertBox != nullptr); // you have to return one of these!
|
||||
|
||||
@@ -614,7 +615,7 @@ private:
|
||||
|
||||
static void* showCallback (void* userData)
|
||||
{
|
||||
static_cast <AlertWindowInfo*> (userData)->show();
|
||||
static_cast<AlertWindowInfo*> (userData)->show();
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
CallOutBox::CallOutBox (Component& c, const Rectangle<int>& area, Component* const parent)
|
||||
: arrowSize (16.0f), content (c)
|
||||
: arrowSize (16.0f), content (c), dismissalMouseClicksAreAlwaysConsumed (false)
|
||||
{
|
||||
addAndMakeVisible (content);
|
||||
|
||||
@@ -91,7 +91,7 @@ void CallOutBox::setArrowSize (const float newSize)
|
||||
|
||||
int CallOutBox::getBorderSize() const noexcept
|
||||
{
|
||||
return jmax (20, (int) arrowSize);
|
||||
return jmax (getLookAndFeel().getCallOutBoxBorderSize (*this), (int) arrowSize);
|
||||
}
|
||||
|
||||
void CallOutBox::paint (Graphics& g)
|
||||
@@ -123,9 +123,8 @@ bool CallOutBox::hitTest (int x, int y)
|
||||
|
||||
void CallOutBox::inputAttemptWhenModal()
|
||||
{
|
||||
const Point<int> mousePos (getMouseXYRelative() + getBounds().getPosition());
|
||||
|
||||
if (targetArea.contains (mousePos))
|
||||
if (dismissalMouseClicksAreAlwaysConsumed
|
||||
|| targetArea.contains (getMouseXYRelative() + getBounds().getPosition()))
|
||||
{
|
||||
// if you click on the area that originally popped-up the callout, you expect it
|
||||
// to get rid of the box, but deleting the box here allows the click to pass through and
|
||||
@@ -139,6 +138,11 @@ void CallOutBox::inputAttemptWhenModal()
|
||||
}
|
||||
}
|
||||
|
||||
void CallOutBox::setDismissalMouseClicksAreAlwaysConsumed (bool b) noexcept
|
||||
{
|
||||
dismissalMouseClicksAreAlwaysConsumed = b;
|
||||
}
|
||||
|
||||
enum { callOutBoxDismissCommandId = 0x4f83a04b };
|
||||
|
||||
void CallOutBox::handleCommandMessage (int commandId)
|
||||
|
||||
@@ -123,6 +123,16 @@ public:
|
||||
*/
|
||||
void dismiss();
|
||||
|
||||
/** Determines whether the mouse events for clicks outside the calloutbox are
|
||||
consumed, or allowed to arrive at the other component that they were aimed at.
|
||||
|
||||
By default this is false, so that when you click on something outside the calloutbox,
|
||||
that event will also be sent to the component that was clicked on. If you set it to
|
||||
true, then the first click will always just dismiss the box and not be sent to
|
||||
anything else.
|
||||
*/
|
||||
void setDismissalMouseClicksAreAlwaysConsumed (bool shouldAlwaysBeConsumed) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
@@ -130,6 +140,7 @@ public:
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
|
||||
virtual void drawCallOutBoxBackground (CallOutBox&, Graphics&, const Path&, Image& cachedImage) = 0;
|
||||
virtual int getCallOutBoxBorderSize (const CallOutBox&) = 0;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
@@ -160,6 +171,7 @@ private:
|
||||
Point<float> targetPoint;
|
||||
Rectangle<int> availableArea, targetArea;
|
||||
Image background;
|
||||
bool dismissalMouseClicksAreAlwaysConsumed;
|
||||
|
||||
void refreshPath();
|
||||
|
||||
|
||||
@@ -85,25 +85,22 @@ bool ComponentPeer::isKioskMode() const
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void ComponentPeer::handleMouseEvent (const int touchIndex, const Point<int> positionWithinPeer,
|
||||
const ModifierKeys newMods, const int64 time)
|
||||
void ComponentPeer::handleMouseEvent (int touchIndex, Point<float> pos, ModifierKeys newMods, int64 time)
|
||||
{
|
||||
if (MouseInputSource* mouse = Desktop::getInstance().mouseSources->getOrCreateMouseInputSource (touchIndex))
|
||||
MouseInputSource (*mouse).handleEvent (*this, positionWithinPeer, time, newMods);
|
||||
MouseInputSource (*mouse).handleEvent (*this, pos, time, newMods);
|
||||
}
|
||||
|
||||
void ComponentPeer::handleMouseWheel (const int touchIndex, const Point<int> positionWithinPeer,
|
||||
const int64 time, const MouseWheelDetails& wheel)
|
||||
void ComponentPeer::handleMouseWheel (int touchIndex, Point<float> pos, int64 time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (MouseInputSource* mouse = Desktop::getInstance().mouseSources->getOrCreateMouseInputSource (touchIndex))
|
||||
MouseInputSource (*mouse).handleWheel (*this, positionWithinPeer, time, wheel);
|
||||
MouseInputSource (*mouse).handleWheel (*this, pos, time, wheel);
|
||||
}
|
||||
|
||||
void ComponentPeer::handleMagnifyGesture (const int touchIndex, const Point<int> positionWithinPeer,
|
||||
const int64 time, const float scaleFactor)
|
||||
void ComponentPeer::handleMagnifyGesture (int touchIndex, Point<float> pos, int64 time, float scaleFactor)
|
||||
{
|
||||
if (MouseInputSource* mouse = Desktop::getInstance().mouseSources->getOrCreateMouseInputSource (touchIndex))
|
||||
MouseInputSource (*mouse).handleMagnifyGesture (*this, positionWithinPeer, time, scaleFactor);
|
||||
MouseInputSource (*mouse).handleMagnifyGesture (*this, pos, time, scaleFactor);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
@@ -402,6 +399,9 @@ const Rectangle<int>& ComponentPeer::getNonFullScreenBounds() const noexcept
|
||||
return lastNonFullscreenBounds;
|
||||
}
|
||||
|
||||
Point<int> ComponentPeer::localToGlobal (Point<int> p) { return localToGlobal (p.toFloat()).roundToInt(); }
|
||||
Point<int> ComponentPeer::globalToLocal (Point<int> p) { return globalToLocal (p.toFloat()).roundToInt(); }
|
||||
|
||||
Rectangle<int> ComponentPeer::localToGlobal (const Rectangle<int>& relativePosition)
|
||||
{
|
||||
return relativePosition.withPosition (localToGlobal (relativePosition.getPosition()));
|
||||
|
||||
@@ -148,14 +148,20 @@ public:
|
||||
virtual Rectangle<int> getBounds() const = 0;
|
||||
|
||||
/** Converts a position relative to the top-left of this component to screen coordinates. */
|
||||
virtual Point<int> localToGlobal (Point<int> relativePosition) = 0;
|
||||
virtual Point<float> localToGlobal (Point<float> relativePosition) = 0;
|
||||
|
||||
/** Converts a screen coordinate to a position relative to the top-left of this component. */
|
||||
virtual Point<float> globalToLocal (Point<float> screenPosition) = 0;
|
||||
|
||||
/** Converts a position relative to the top-left of this component to screen coordinates. */
|
||||
Point<int> localToGlobal (Point<int> relativePosition);
|
||||
|
||||
/** Converts a screen coordinate to a position relative to the top-left of this component. */
|
||||
Point<int> globalToLocal (Point<int> screenPosition);
|
||||
|
||||
/** Converts a rectangle relative to the top-left of this component to screen coordinates. */
|
||||
virtual Rectangle<int> localToGlobal (const Rectangle<int>& relativePosition);
|
||||
|
||||
/** Converts a screen coordinate to a position relative to the top-left of this component. */
|
||||
virtual Point<int> globalToLocal (Point<int> screenPosition) = 0;
|
||||
|
||||
/** Converts a screen area to a position relative to the top-left of this component. */
|
||||
virtual Rectangle<int> globalToLocal (const Rectangle<int>& screenPosition);
|
||||
|
||||
@@ -276,7 +282,7 @@ public:
|
||||
This may cause things like a virtual on-screen keyboard to appear, depending
|
||||
on the OS.
|
||||
*/
|
||||
virtual void textInputRequired (const Point<int>& position) = 0;
|
||||
virtual void textInputRequired (Point<int> position, TextInputTarget&) = 0;
|
||||
|
||||
/** If there's some kind of OS input-method in progress, this should dismiss it. */
|
||||
virtual void dismissPendingTextInput();
|
||||
@@ -300,9 +306,9 @@ public:
|
||||
virtual void setAlpha (float newAlpha) = 0;
|
||||
|
||||
//==============================================================================
|
||||
void handleMouseEvent (int touchIndex, const Point<int> positionWithinPeer, const ModifierKeys newMods, int64 time);
|
||||
void handleMouseWheel (int touchIndex, const Point<int> positionWithinPeer, int64 time, const MouseWheelDetails&);
|
||||
void handleMagnifyGesture (int touchIndex, const Point<int> positionWithinPeer, int64 time, float scaleFactor);
|
||||
void handleMouseEvent (int touchIndex, Point<float> positionWithinPeer, ModifierKeys newMods, int64 time);
|
||||
void handleMouseWheel (int touchIndex, Point<float> positionWithinPeer, int64 time, const MouseWheelDetails&);
|
||||
void handleMagnifyGesture (int touchIndex, Point<float> positionWithinPeer, int64 time, float scaleFactor);
|
||||
|
||||
void handleUserClosingWindow();
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
initialise its fields with the appropriate details, and then call its launchAsync()
|
||||
method to launch the dialog.
|
||||
*/
|
||||
struct LaunchOptions
|
||||
struct JUCE_API LaunchOptions
|
||||
{
|
||||
LaunchOptions() noexcept;
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ void TooltipWindow::timerCallback()
|
||||
mouseClicks = clickCount;
|
||||
mouseWheelMoves = wheelCount;
|
||||
|
||||
const Point<int> mousePos (mouseSource.getScreenPosition());
|
||||
const Point<float> mousePos (mouseSource.getScreenPosition());
|
||||
const bool mouseMovedQuickly = mousePos.getDistanceFrom (lastMousePos) > 12;
|
||||
lastMousePos = mousePos;
|
||||
|
||||
@@ -159,7 +159,7 @@ void TooltipWindow::timerCallback()
|
||||
}
|
||||
else if (tipChanged)
|
||||
{
|
||||
displayTip (mousePos, newTip);
|
||||
displayTip (mousePos.roundToInt(), newTip);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -170,7 +170,7 @@ void TooltipWindow::timerCallback()
|
||||
&& newTip != tipShowing
|
||||
&& now > lastCompChangeTime + (unsigned int) millisecondsBeforeTipAppears)
|
||||
{
|
||||
displayTip (mousePos, newTip);
|
||||
displayTip (mousePos.roundToInt(), newTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
private:
|
||||
//==============================================================================
|
||||
int millisecondsBeforeTipAppears;
|
||||
Point<int> lastMousePos;
|
||||
Point<float> lastMousePos;
|
||||
int mouseClicks, mouseWheelMoves;
|
||||
unsigned int lastCompChangeTime, lastHideTime;
|
||||
Component* lastComponentUnderMouse;
|
||||
|
||||
@@ -27,7 +27,6 @@ class TopLevelWindowManager : private Timer,
|
||||
private DeletedAtShutdown
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
TopLevelWindowManager() : currentActive (nullptr)
|
||||
{
|
||||
}
|
||||
@@ -48,33 +47,15 @@ public:
|
||||
{
|
||||
startTimer (jmin (1731, getTimerInterval() * 2));
|
||||
|
||||
TopLevelWindow* active = nullptr;
|
||||
TopLevelWindow* newActive = findCurrentlyActiveWindow();
|
||||
|
||||
if (Process::isForegroundProcess())
|
||||
if (newActive != currentActive)
|
||||
{
|
||||
active = currentActive;
|
||||
|
||||
Component* const c = Component::getCurrentlyFocusedComponent();
|
||||
TopLevelWindow* tlw = dynamic_cast <TopLevelWindow*> (c);
|
||||
|
||||
if (tlw == nullptr && c != nullptr)
|
||||
tlw = c->findParentComponentOfClass<TopLevelWindow>();
|
||||
|
||||
if (tlw != nullptr)
|
||||
active = tlw;
|
||||
}
|
||||
|
||||
if (active != currentActive)
|
||||
{
|
||||
currentActive = active;
|
||||
currentActive = newActive;
|
||||
|
||||
for (int i = windows.size(); --i >= 0;)
|
||||
{
|
||||
TopLevelWindow* const tlw = windows.getUnchecked (i);
|
||||
tlw->setWindowActive (isWindowActive (tlw));
|
||||
|
||||
i = jmin (i, windows.size() - 1);
|
||||
}
|
||||
if (TopLevelWindow* tlw = windows[i])
|
||||
tlw->setWindowActive (isWindowActive (tlw));
|
||||
|
||||
Desktop::getInstance().triggerFocusCallback();
|
||||
}
|
||||
@@ -101,7 +82,7 @@ public:
|
||||
deleteInstance();
|
||||
}
|
||||
|
||||
Array <TopLevelWindow*> windows;
|
||||
Array<TopLevelWindow*> windows;
|
||||
|
||||
private:
|
||||
TopLevelWindow* currentActive;
|
||||
@@ -119,6 +100,26 @@ private:
|
||||
&& tlw->isShowing();
|
||||
}
|
||||
|
||||
TopLevelWindow* findCurrentlyActiveWindow() const
|
||||
{
|
||||
if (Process::isForegroundProcess())
|
||||
{
|
||||
Component* const focusedComp = Component::getCurrentlyFocusedComponent();
|
||||
TopLevelWindow* w = dynamic_cast<TopLevelWindow*> (focusedComp);
|
||||
|
||||
if (w == nullptr && focusedComp != nullptr)
|
||||
w = focusedComp->findParentComponentOfClass<TopLevelWindow>();
|
||||
|
||||
if (w == nullptr)
|
||||
w = currentActive;
|
||||
|
||||
if (w != nullptr && w->isShowing())
|
||||
return w;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (TopLevelWindowManager)
|
||||
};
|
||||
|
||||
@@ -187,12 +188,11 @@ bool TopLevelWindow::isUsingNativeTitleBar() const noexcept
|
||||
|
||||
void TopLevelWindow::visibilityChanged()
|
||||
{
|
||||
if (isShowing()
|
||||
&& (getPeer()->getStyleFlags() & (ComponentPeer::windowIsTemporary
|
||||
| ComponentPeer::windowIgnoresKeyPresses)) == 0)
|
||||
{
|
||||
toFront (true);
|
||||
}
|
||||
if (isShowing())
|
||||
if (ComponentPeer* p = getPeer())
|
||||
if ((p->getStyleFlags() & (ComponentPeer::windowIsTemporary
|
||||
| ComponentPeer::windowIgnoresKeyPresses)) == 0)
|
||||
toFront (true);
|
||||
}
|
||||
|
||||
void TopLevelWindow::parentHierarchyChanged()
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = nullptr) override;
|
||||
void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = nullptr) override;
|
||||
|
||||
protected:
|
||||
//==============================================================================
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
bool useDropShadow, useNativeTitleBar, isCurrentlyActive;
|
||||
ScopedPointer<DropShadower> shadower;
|
||||
|
||||
void setWindowActive (bool isNowActive);
|
||||
void setWindowActive (bool);
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TopLevelWindow)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user