1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 08:39:46 +02:00

Implement double-click at the view separator to split view evenly...

... And this can even change an unsplit view to evenly split when you get the
 cursor near the top or bottom
This commit is contained in:
Paul Licameli 2019-12-31 11:16:26 -05:00
parent e0453d1b7e
commit 917e84f382

View File

@ -223,7 +223,7 @@ public:
}
Result Click(
const TrackPanelMouseEvent &event, AudacityProject * ) override
const TrackPanelMouseEvent &event, AudacityProject *pProject ) override
{
using namespace RefreshCode;
const auto &permutation = mAdjuster.mPermutation;
@ -231,6 +231,20 @@ public:
if ( mMySubView >= size )
return Cancelled;
if (event.event.LeftDClick()) {
for ( auto &placement : mAdjuster.mNewPlacements ) {
if ( placement.index >= 0 )
placement.fraction = 1.0f;
else
placement.fraction = 0.0f;
}
mAdjuster.UpdateViews( false );
ProjectHistory::Get( *pProject ).ModifyState( false );
// Do not start a drag
return Cancelled | RefreshAll;
}
const auto &rect = event.rect;
const auto height = rect.GetHeight();
mOrigHeight = height;
@ -359,7 +373,8 @@ public:
static auto resizeCursor =
::MakeCursor(wxCURSOR_ARROW, SubViewsCursorXpm, 16, 16);
return {
XO("Click and drag to adjust sizes of sub-views."),
XO(
"Click and drag to adjust sizes of sub-views, double-click to split evenly"),
&*resizeCursor
};
}