mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-10 22:56:26 +01:00
Revert stuff
This commit is contained in:
@@ -1223,9 +1223,9 @@ int AudacityApp::FilterEvent(wxEvent & event)
|
|||||||
object->IsKindOf(CLASSINFO(wxWindow)))
|
object->IsKindOf(CLASSINFO(wxWindow)))
|
||||||
{
|
{
|
||||||
const auto window = ((wxWindow *)e.GetEventObject());
|
const auto window = ((wxWindow *)e.GetEventObject());
|
||||||
// window->SetFocus();
|
window->SetFocus();
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
// window->NavigateIn();
|
window->NavigateIn();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ IMPLEMENT_CLASS( ToolDock, wxPanelWrapper );
|
|||||||
//
|
//
|
||||||
// Custom event
|
// Custom event
|
||||||
//
|
//
|
||||||
//DEFINE_EVENT_TYPE( EVT_TOOLBAR_FLOAT );
|
DEFINE_EVENT_TYPE( EVT_TOOLBAR_FLOAT );
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( ToolDock, wxPanelWrapper )
|
BEGIN_EVENT_TABLE( ToolDock, wxPanelWrapper )
|
||||||
EVT_GRABBER( wxID_ANY, ToolDock::OnGrabber )
|
EVT_GRABBER( wxID_ANY, ToolDock::OnGrabber )
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|
||||||
Audacity: A Digital Audio Editor
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
@@ -67,8 +67,6 @@
|
|||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../Theme.h"
|
#include "../Theme.h"
|
||||||
#include "../widgets/AButton.h"
|
#include "../widgets/AButton.h"
|
||||||
#include "../widgets/ASlider.h"
|
|
||||||
#include "../widgets/Meter.h"
|
|
||||||
#include "../widgets/Grabber.h"
|
#include "../widgets/Grabber.h"
|
||||||
|
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
@@ -436,8 +434,6 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
|||||||
|
|
||||||
// Process the toolbar config settings
|
// Process the toolbar config settings
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
|
||||||
wxEvtHandler::AddFilter(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -445,8 +441,6 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
|||||||
//
|
//
|
||||||
ToolManager::~ToolManager()
|
ToolManager::~ToolManager()
|
||||||
{
|
{
|
||||||
wxEvtHandler::RemoveFilter(this);
|
|
||||||
|
|
||||||
// Save the toolbar states
|
// Save the toolbar states
|
||||||
WriteConfig();
|
WriteConfig();
|
||||||
|
|
||||||
@@ -645,32 +639,6 @@ void ToolManager::RegenerateTooltips()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ToolManager::FilterEvent(wxEvent &event)
|
|
||||||
{
|
|
||||||
// Snoop the global event stream for changes of focused window. Remember
|
|
||||||
// the last one of our own that is not a grabber.
|
|
||||||
|
|
||||||
if (event.GetEventType() == wxEVT_KILL_FOCUS) {
|
|
||||||
auto &focusEvent = static_cast<wxFocusEvent&>(event);
|
|
||||||
auto window = focusEvent.GetWindow();
|
|
||||||
// window is that which will GET the focus
|
|
||||||
if ( window &&
|
|
||||||
!dynamic_cast<Grabber*>( window ) &&
|
|
||||||
!dynamic_cast<ToolFrame*>( window ) &&
|
|
||||||
wxGetTopLevelParent(window) == mParent )
|
|
||||||
mLastFocus = window;
|
|
||||||
}
|
|
||||||
else if (event.GetEventType() == wxEVT_CLOSE_WINDOW) {
|
|
||||||
auto &closeEvent = static_cast<wxCloseEvent&>(event);
|
|
||||||
auto window = closeEvent.GetEventObject();
|
|
||||||
if (window == mLastFocus)
|
|
||||||
// Avoid a dangling pointer!
|
|
||||||
mLastFocus = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Event_Skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read the toolbar states
|
// Read the toolbar states
|
||||||
//
|
//
|
||||||
@@ -1108,7 +1076,7 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
|||||||
// Can't do anything if we're not dragging. This also prevents
|
// Can't do anything if we're not dragging. This also prevents
|
||||||
// us from intercepting events that don't belong to us from the
|
// us from intercepting events that don't belong to us from the
|
||||||
// parent since we're Connect()ed to a couple.
|
// parent since we're Connect()ed to a couple.
|
||||||
if( !mClicked )
|
if( !mDragWindow )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1122,16 +1090,11 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
|||||||
wxPoint pos =
|
wxPoint pos =
|
||||||
( (wxWindow *)event.GetEventObject() )->ClientToScreen( event.GetPosition() ) - mDragOffset;
|
( (wxWindow *)event.GetEventObject() )->ClientToScreen( event.GetPosition() ) - mDragOffset;
|
||||||
|
|
||||||
|
// Button was released...finish the drag
|
||||||
if( !event.LeftIsDown() )
|
if( !event.LeftIsDown() )
|
||||||
{
|
{
|
||||||
// Button was released...finish the drag
|
|
||||||
// Transition the bar to a dock
|
// Transition the bar to a dock
|
||||||
if (!mDidDrag) {
|
if( mDragDock && !event.ShiftDown() )
|
||||||
DoneDragging();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if( mDragDock && !event.ShiftDown() )
|
|
||||||
{
|
{
|
||||||
// Trip over...everyone ashore that's going ashore...
|
// Trip over...everyone ashore that's going ashore...
|
||||||
mDragDock->Dock( mDragBar, true, mDragBefore );
|
mDragDock->Dock( mDragBar, true, mDragBefore );
|
||||||
@@ -1152,15 +1115,6 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
|||||||
}
|
}
|
||||||
else if( event.Dragging() && pos != mLastPos )
|
else if( event.Dragging() && pos != mLastPos )
|
||||||
{
|
{
|
||||||
if (!mDidDrag) {
|
|
||||||
// Must set the bar afloat if it's currently docked
|
|
||||||
mDidDrag = true;
|
|
||||||
wxPoint mp = event.GetPosition();
|
|
||||||
mp = mParent->ClientToScreen(mp);
|
|
||||||
if (!mDragWindow)
|
|
||||||
UndockBar(mp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make toolbar follow the mouse
|
// Make toolbar follow the mouse
|
||||||
mDragWindow->Move( pos );
|
mDragWindow->Move( pos );
|
||||||
|
|
||||||
@@ -1356,36 +1310,6 @@ void ToolManager::OnIndicatorCreate( wxWindowCreateEvent & event )
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolManager::UndockBar( wxPoint mp )
|
|
||||||
{
|
|
||||||
#if defined(__WXMAC__)
|
|
||||||
// Disable window animation
|
|
||||||
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Adjust the starting position
|
|
||||||
mp -= mDragOffset;
|
|
||||||
|
|
||||||
// Inform toolbar of change
|
|
||||||
mDragBar->SetDocked( NULL, true );
|
|
||||||
mDragBar->SetPositioned();
|
|
||||||
|
|
||||||
// Construct a NEW floater
|
|
||||||
wxASSERT(mParent);
|
|
||||||
mDragWindow = safenew ToolFrame( mParent, this, mDragBar, mp );
|
|
||||||
|
|
||||||
// Make sure the ferry is visible
|
|
||||||
mDragWindow->Show();
|
|
||||||
|
|
||||||
// Notify parent of change
|
|
||||||
Updated();
|
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
|
||||||
// Reinstate original transition
|
|
||||||
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Transition a toolbar from float to dragging
|
// Transition a toolbar from float to dragging
|
||||||
//
|
//
|
||||||
@@ -1416,10 +1340,35 @@ void ToolManager::OnGrabber( GrabberEvent & event )
|
|||||||
mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) +
|
mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) +
|
||||||
wxPoint( 1, 1 );
|
wxPoint( 1, 1 );
|
||||||
|
|
||||||
mClicked = true;
|
// Must set the bar afloat if it's currently docked
|
||||||
if( mPrevDock )
|
if( mPrevDock )
|
||||||
{
|
{
|
||||||
mDragWindow = nullptr;
|
#if defined(__WXMAC__)
|
||||||
|
// Disable window animation
|
||||||
|
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Adjust the starting position
|
||||||
|
mp -= mDragOffset;
|
||||||
|
|
||||||
|
// Inform toolbar of change
|
||||||
|
mDragBar->SetDocked( NULL, true );
|
||||||
|
mDragBar->SetPositioned();
|
||||||
|
|
||||||
|
// Construct a NEW floater
|
||||||
|
wxASSERT(mParent);
|
||||||
|
mDragWindow = safenew ToolFrame( mParent, this, mDragBar, mp );
|
||||||
|
|
||||||
|
// Make sure the ferry is visible
|
||||||
|
mDragWindow->Show();
|
||||||
|
|
||||||
|
// Notify parent of change
|
||||||
|
Updated();
|
||||||
|
|
||||||
|
#if defined(__WXMAC__)
|
||||||
|
// Reinstate original transition
|
||||||
|
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1452,8 +1401,6 @@ void ToolManager::HandleEscapeKey()
|
|||||||
mDragWindow->Destroy();
|
mDragWindow->Destroy();
|
||||||
mDragWindow = nullptr;
|
mDragWindow = nullptr;
|
||||||
mDragBar->Refresh(false);
|
mDragBar->Refresh(false);
|
||||||
|
|
||||||
mPrevDock->SetFocus();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Floater remains, and returns to where it begain
|
// Floater remains, and returns to where it begain
|
||||||
@@ -1487,20 +1434,4 @@ void ToolManager::DoneDragging()
|
|||||||
mLastPos.x = mBarPos.x = -1;
|
mLastPos.x = mBarPos.x = -1;
|
||||||
mLastPos.y = mBarPos.y = -1;
|
mLastPos.y = mBarPos.y = -1;
|
||||||
mTimer.Stop();
|
mTimer.Stop();
|
||||||
mDidDrag = false;
|
|
||||||
mClicked = false;
|
|
||||||
|
|
||||||
if (mLastFocus) {
|
|
||||||
CallAfter( [&] {
|
|
||||||
auto temp1 = AButton::TemporarilyAllowFocus();
|
|
||||||
auto temp2 = ASlider::TemporarilyAllowFocus();
|
|
||||||
auto temp3 = Meter::TemporarilyAllowFocus();
|
|
||||||
auto parent = mLastFocus->GetParent();
|
|
||||||
// if (parent) {
|
|
||||||
// parent->SetFocus();
|
|
||||||
// parent->NavigateIn();
|
|
||||||
// }
|
|
||||||
mLastFocus->SetFocus();
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "../MemoryX.h"
|
#include "../MemoryX.h"
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/eventfilter.h>
|
|
||||||
#include <wx/frame.h>
|
#include <wx/frame.h>
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ class ToolFrame;
|
|||||||
/// class ToolManager
|
/// class ToolManager
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class ToolManager final : public wxEvtHandler, public wxEventFilter
|
class ToolManager final : public wxEvtHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -69,8 +68,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
|||||||
void Reset();
|
void Reset();
|
||||||
void RegenerateTooltips();
|
void RegenerateTooltips();
|
||||||
|
|
||||||
int FilterEvent(wxEvent &event) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ToolBar *Float( ToolBar *t, wxPoint & pos );
|
ToolBar *Float( ToolBar *t, wxPoint & pos );
|
||||||
@@ -78,7 +75,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
|||||||
void OnTimer( wxTimerEvent & event );
|
void OnTimer( wxTimerEvent & event );
|
||||||
void OnMouse( wxMouseEvent & event );
|
void OnMouse( wxMouseEvent & event );
|
||||||
void OnCaptureLost( wxMouseCaptureLostEvent & event );
|
void OnCaptureLost( wxMouseCaptureLostEvent & event );
|
||||||
void UndockBar( wxPoint mp );
|
|
||||||
void OnGrabber( GrabberEvent & event );
|
void OnGrabber( GrabberEvent & event );
|
||||||
void HandleEscapeKey();
|
void HandleEscapeKey();
|
||||||
void DoneDragging();
|
void DoneDragging();
|
||||||
@@ -91,7 +87,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
|||||||
void Updated();
|
void Updated();
|
||||||
|
|
||||||
AudacityProject *mParent;
|
AudacityProject *mParent;
|
||||||
wxWindow *mLastFocus{};
|
|
||||||
|
|
||||||
ToolFrame *mDragWindow;
|
ToolFrame *mDragWindow;
|
||||||
ToolDock *mDragDock;
|
ToolDock *mDragDock;
|
||||||
@@ -124,8 +119,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
|||||||
ToolBarConfiguration::Position mPrevSlot
|
ToolBarConfiguration::Position mPrevSlot
|
||||||
{ ToolBarConfiguration::UnspecifiedPosition };
|
{ ToolBarConfiguration::UnspecifiedPosition };
|
||||||
ToolBarConfiguration mPrevConfiguration;
|
ToolBarConfiguration mPrevConfiguration;
|
||||||
bool mDidDrag{};
|
|
||||||
bool mClicked{};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user