mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 06:07:42 +02:00
Revert stuff
This commit is contained in:
parent
e9576bf198
commit
d88371b4b7
@ -1223,9 +1223,9 @@ int AudacityApp::FilterEvent(wxEvent & event)
|
||||
object->IsKindOf(CLASSINFO(wxWindow)))
|
||||
{
|
||||
const auto window = ((wxWindow *)e.GetEventObject());
|
||||
// window->SetFocus();
|
||||
window->SetFocus();
|
||||
#if defined(__WXMAC__)
|
||||
// window->NavigateIn();
|
||||
window->NavigateIn();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ IMPLEMENT_CLASS( ToolDock, wxPanelWrapper );
|
||||
//
|
||||
// Custom event
|
||||
//
|
||||
//DEFINE_EVENT_TYPE( EVT_TOOLBAR_FLOAT );
|
||||
DEFINE_EVENT_TYPE( EVT_TOOLBAR_FLOAT );
|
||||
|
||||
BEGIN_EVENT_TABLE( ToolDock, wxPanelWrapper )
|
||||
EVT_GRABBER( wxID_ANY, ToolDock::OnGrabber )
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**********************************************************************
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
@ -67,8 +67,6 @@
|
||||
#include "../Project.h"
|
||||
#include "../Theme.h"
|
||||
#include "../widgets/AButton.h"
|
||||
#include "../widgets/ASlider.h"
|
||||
#include "../widgets/Meter.h"
|
||||
#include "../widgets/Grabber.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
@ -436,8 +434,6 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
||||
|
||||
// Process the toolbar config settings
|
||||
ReadConfig();
|
||||
|
||||
wxEvtHandler::AddFilter(this);
|
||||
}
|
||||
|
||||
//
|
||||
@ -445,8 +441,6 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
||||
//
|
||||
ToolManager::~ToolManager()
|
||||
{
|
||||
wxEvtHandler::RemoveFilter(this);
|
||||
|
||||
// Save the toolbar states
|
||||
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
|
||||
//
|
||||
@ -1108,7 +1076,7 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
||||
// Can't do anything if we're not dragging. This also prevents
|
||||
// us from intercepting events that don't belong to us from the
|
||||
// parent since we're Connect()ed to a couple.
|
||||
if( !mClicked )
|
||||
if( !mDragWindow )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1122,16 +1090,11 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
||||
wxPoint pos =
|
||||
( (wxWindow *)event.GetEventObject() )->ClientToScreen( event.GetPosition() ) - mDragOffset;
|
||||
|
||||
|
||||
// Button was released...finish the drag
|
||||
if( !event.LeftIsDown() )
|
||||
{
|
||||
// Button was released...finish the drag
|
||||
// Transition the bar to a dock
|
||||
if (!mDidDrag) {
|
||||
DoneDragging();
|
||||
return;
|
||||
}
|
||||
else if( mDragDock && !event.ShiftDown() )
|
||||
if( mDragDock && !event.ShiftDown() )
|
||||
{
|
||||
// Trip over...everyone ashore that's going ashore...
|
||||
mDragDock->Dock( mDragBar, true, mDragBefore );
|
||||
@ -1152,15 +1115,6 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
||||
}
|
||||
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
|
||||
mDragWindow->Move( pos );
|
||||
|
||||
@ -1356,36 +1310,6 @@ void ToolManager::OnIndicatorCreate( wxWindowCreateEvent & event )
|
||||
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
|
||||
//
|
||||
@ -1416,10 +1340,35 @@ void ToolManager::OnGrabber( GrabberEvent & event )
|
||||
mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) +
|
||||
wxPoint( 1, 1 );
|
||||
|
||||
mClicked = true;
|
||||
// Must set the bar afloat if it's currently docked
|
||||
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
|
||||
{
|
||||
@ -1452,8 +1401,6 @@ void ToolManager::HandleEscapeKey()
|
||||
mDragWindow->Destroy();
|
||||
mDragWindow = nullptr;
|
||||
mDragBar->Refresh(false);
|
||||
|
||||
mPrevDock->SetFocus();
|
||||
}
|
||||
else {
|
||||
// Floater remains, and returns to where it begain
|
||||
@ -1487,20 +1434,4 @@ void ToolManager::DoneDragging()
|
||||
mLastPos.x = mBarPos.x = -1;
|
||||
mLastPos.y = mBarPos.y = -1;
|
||||
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 <wx/defs.h>
|
||||
#include <wx/eventfilter.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
@ -42,7 +41,7 @@ class ToolFrame;
|
||||
/// class ToolManager
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
class ToolManager final : public wxEvtHandler, public wxEventFilter
|
||||
class ToolManager final : public wxEvtHandler
|
||||
{
|
||||
|
||||
public:
|
||||
@ -69,8 +68,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
||||
void Reset();
|
||||
void RegenerateTooltips();
|
||||
|
||||
int FilterEvent(wxEvent &event) override;
|
||||
|
||||
private:
|
||||
|
||||
ToolBar *Float( ToolBar *t, wxPoint & pos );
|
||||
@ -78,7 +75,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
||||
void OnTimer( wxTimerEvent & event );
|
||||
void OnMouse( wxMouseEvent & event );
|
||||
void OnCaptureLost( wxMouseCaptureLostEvent & event );
|
||||
void UndockBar( wxPoint mp );
|
||||
void OnGrabber( GrabberEvent & event );
|
||||
void HandleEscapeKey();
|
||||
void DoneDragging();
|
||||
@ -91,7 +87,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
||||
void Updated();
|
||||
|
||||
AudacityProject *mParent;
|
||||
wxWindow *mLastFocus{};
|
||||
|
||||
ToolFrame *mDragWindow;
|
||||
ToolDock *mDragDock;
|
||||
@ -124,8 +119,6 @@ class ToolManager final : public wxEvtHandler, public wxEventFilter
|
||||
ToolBarConfiguration::Position mPrevSlot
|
||||
{ ToolBarConfiguration::UnspecifiedPosition };
|
||||
ToolBarConfiguration mPrevConfiguration;
|
||||
bool mDidDrag{};
|
||||
bool mClicked{};
|
||||
|
||||
public:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user