mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Make AdornedRulerPanel respect toolbar edit mode
AdornedRulerPanel also has a grabber, this commit makes it so that the grabber does not exist when edit mode is off. Signed-off-by: abb128 <alexx128p@gmail.com>
This commit is contained in:
parent
534da8b617
commit
21614a390c
@ -926,6 +926,9 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* project,
|
|||||||
mTracks = &TrackList::Get( *project );
|
mTracks = &TrackList::Get( *project );
|
||||||
|
|
||||||
mIsSnapped = false;
|
mIsSnapped = false;
|
||||||
|
mEditMode = gPrefs->Read(wxT("/GUI/Toolbars/EditMode"), false);
|
||||||
|
|
||||||
|
mGrabber = nullptr;
|
||||||
|
|
||||||
mIsRecording = false;
|
mIsRecording = false;
|
||||||
|
|
||||||
@ -969,7 +972,13 @@ void AdornedRulerPanel::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
|
|
||||||
void AdornedRulerPanel::UpdatePrefs()
|
void AdornedRulerPanel::UpdatePrefs()
|
||||||
{
|
{
|
||||||
if (mNeedButtonUpdate) {
|
bool mode = gPrefs->Read(wxT("/GUI/Toolbars/EditMode"), false);
|
||||||
|
|
||||||
|
if ( mode != mEditMode )
|
||||||
|
{
|
||||||
|
mEditMode = mode;
|
||||||
|
ReCreateButtons();
|
||||||
|
}else if (mNeedButtonUpdate) {
|
||||||
// Visit this block once only in the lifetime of this panel
|
// Visit this block once only in the lifetime of this panel
|
||||||
mNeedButtonUpdate = false;
|
mNeedButtonUpdate = false;
|
||||||
// Do this first time setting of button status texts
|
// Do this first time setting of button status texts
|
||||||
@ -1009,6 +1018,12 @@ void AdornedRulerPanel::ReCreateButtons()
|
|||||||
button = nullptr;
|
button = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( mGrabber )
|
||||||
|
{
|
||||||
|
mGrabber->Destroy();
|
||||||
|
mGrabber = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
size_t iButton = 0;
|
size_t iButton = 0;
|
||||||
// Make the short row of time ruler pushbottons.
|
// Make the short row of time ruler pushbottons.
|
||||||
// Don't bother with sizers. Their sizes and positions are fixed.
|
// Don't bother with sizers. Their sizes and positions are fixed.
|
||||||
@ -1017,12 +1032,14 @@ void AdornedRulerPanel::ReCreateButtons()
|
|||||||
|
|
||||||
wxPoint position( 1, 0 );
|
wxPoint position( 1, 0 );
|
||||||
|
|
||||||
Grabber * pGrabber = safenew Grabber(this, this->GetId());
|
if ( mEditMode )
|
||||||
pGrabber->SetAsSpacer( true );
|
{
|
||||||
//pGrabber->SetSize( 10, 27 ); // default is 10,27
|
mGrabber = safenew Grabber(this, this->GetId());
|
||||||
pGrabber->SetPosition( position );
|
mGrabber->SetAsSpacer( true );
|
||||||
|
//mGrabber->SetSize( 10, 27 ); // default is 10,27
|
||||||
position.x = 12;
|
mGrabber->SetPosition( position );
|
||||||
|
position.x = 12;
|
||||||
|
}else position.x = 0;
|
||||||
|
|
||||||
auto size = theTheme.ImageSize( bmpRecoloredUpSmall );
|
auto size = theTheme.ImageSize( bmpRecoloredUpSmall );
|
||||||
size.y = std::min(size.y, GetRulerHeight(false));
|
size.y = std::min(size.y, GetRulerHeight(false));
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "CellularPanel.h"
|
#include "CellularPanel.h"
|
||||||
#include "widgets/Ruler.h" // member variable
|
#include "widgets/Ruler.h" // member variable
|
||||||
|
#include "widgets/Grabber.h" // mGrabber
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "ViewInfo.h" // for PlayRegion
|
#include "ViewInfo.h" // for PlayRegion
|
||||||
|
|
||||||
@ -142,6 +143,9 @@ private:
|
|||||||
double mQuickPlayPos;
|
double mQuickPlayPos;
|
||||||
|
|
||||||
bool mIsSnapped;
|
bool mIsSnapped;
|
||||||
|
bool mEditMode;
|
||||||
|
|
||||||
|
Grabber *mGrabber;
|
||||||
|
|
||||||
PlayRegion mOldPlayRegion;
|
PlayRegion mOldPlayRegion;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user