mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-09 08:31:13 +02:00
Remove some naked new amd delete in: toolbars
This commit is contained in:
parent
23516a7732
commit
52d12c6913
@ -289,7 +289,7 @@ void ControlToolBar::ArrangeButtons()
|
||||
if( mSizer )
|
||||
{
|
||||
Detach( mSizer );
|
||||
delete mSizer;
|
||||
std::unique_ptr < wxSizer > {mSizer}; // DELETE it
|
||||
}
|
||||
|
||||
Add((mSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
|
||||
@ -359,7 +359,7 @@ void ControlToolBar::ReCreateButtons()
|
||||
recordShift = mRecord->WasShiftDown();
|
||||
Detach( mSizer );
|
||||
|
||||
delete mSizer;
|
||||
std::unique_ptr < wxSizer > {mSizer}; // DELETE it
|
||||
mSizer = NULL;
|
||||
}
|
||||
|
||||
@ -1185,7 +1185,7 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu
|
||||
new2->Clear(cutStart, cutEnd);
|
||||
}
|
||||
|
||||
mCutPreviewTracks = new TrackList();
|
||||
mCutPreviewTracks = std::make_unique<TrackList>();
|
||||
mCutPreviewTracks->Add(std::move(new1));
|
||||
if (track2)
|
||||
mCutPreviewTracks->Add(std::move(new2));
|
||||
@ -1196,11 +1196,8 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu
|
||||
void ControlToolBar::ClearCutPreviewTracks()
|
||||
{
|
||||
if (mCutPreviewTracks)
|
||||
{
|
||||
mCutPreviewTracks->Clear(); /* DELETE track contents too */
|
||||
delete mCutPreviewTracks;
|
||||
mCutPreviewTracks = NULL;
|
||||
}
|
||||
mCutPreviewTracks->Clear();
|
||||
mCutPreviewTracks.reset();
|
||||
}
|
||||
|
||||
// works out the width of the field in the status bar needed for the state (eg play, record pause)
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef __AUDACITY_CONTROL_TOOLBAR__
|
||||
#define __AUDACITY_CONTROL_TOOLBAR__
|
||||
|
||||
#include "../MemoryX.h"
|
||||
#include "ToolBar.h"
|
||||
#include "../Theme.h"
|
||||
|
||||
@ -160,7 +161,7 @@ class ControlToolBar final : public ToolBar {
|
||||
|
||||
wxBoxSizer *mSizer;
|
||||
|
||||
TrackList* mCutPreviewTracks;
|
||||
std::unique_ptr<TrackList> mCutPreviewTracks;
|
||||
|
||||
// strings for status bar
|
||||
wxString mStatePlay;
|
||||
|
@ -67,8 +67,6 @@ DeviceToolBar::DeviceToolBar()
|
||||
|
||||
DeviceToolBar::~DeviceToolBar()
|
||||
{
|
||||
delete mPlayBitmap;
|
||||
delete mRecordBitmap;
|
||||
}
|
||||
|
||||
void DeviceToolBar::Create(wxWindow *parent)
|
||||
@ -102,7 +100,7 @@ void DeviceToolBar::Populate()
|
||||
|
||||
// Input device
|
||||
if( mRecordBitmap == NULL )
|
||||
mRecordBitmap = new wxBitmap(theTheme.Bitmap(bmpMic));
|
||||
mRecordBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpMic));
|
||||
|
||||
Add(safenew wxStaticBitmap(this,
|
||||
wxID_ANY,
|
||||
@ -122,7 +120,7 @@ void DeviceToolBar::Populate()
|
||||
|
||||
// Output device
|
||||
if( mPlayBitmap == NULL )
|
||||
mPlayBitmap = new wxBitmap(theTheme.Bitmap(bmpSpeaker));
|
||||
mPlayBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpSpeaker));
|
||||
Add(safenew wxStaticBitmap(this,
|
||||
wxID_ANY,
|
||||
*mPlayBitmap), 0, wxALIGN_CENTER);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#ifndef __AUDACITY_DEVICE_TOOLBAR__
|
||||
#define __AUDACITY_DEVICE_TOOLBAR__
|
||||
|
||||
#include "../MemoryX.h"
|
||||
#include <vector>
|
||||
#include "ToolBar.h"
|
||||
|
||||
@ -67,8 +68,7 @@ class DeviceToolBar final : public ToolBar {
|
||||
|
||||
void ShowComboDialog(wxChoice *combo, const wxString &title);
|
||||
|
||||
wxBitmap *mPlayBitmap;
|
||||
wxBitmap *mRecordBitmap;
|
||||
std::unique_ptr<wxBitmap> mPlayBitmap, mRecordBitmap;
|
||||
|
||||
wxChoice *mInput;
|
||||
wxChoice *mOutput;
|
||||
|
@ -66,8 +66,6 @@ MixerToolBar::MixerToolBar()
|
||||
|
||||
MixerToolBar::~MixerToolBar()
|
||||
{
|
||||
delete mPlayBitmap;
|
||||
delete mRecordBitmap;
|
||||
}
|
||||
|
||||
void MixerToolBar::Create(wxWindow *parent)
|
||||
@ -78,7 +76,7 @@ void MixerToolBar::Create(wxWindow *parent)
|
||||
void MixerToolBar::Populate()
|
||||
{
|
||||
if( mRecordBitmap == NULL )
|
||||
mRecordBitmap = new wxBitmap(theTheme.Bitmap(bmpMic));
|
||||
mRecordBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpMic));
|
||||
|
||||
Add(safenew wxStaticBitmap(this,
|
||||
wxID_ANY,
|
||||
@ -91,7 +89,7 @@ void MixerToolBar::Populate()
|
||||
Add(mInputSlider, 0, wxALIGN_CENTER);
|
||||
|
||||
if( mPlayBitmap == NULL )
|
||||
mPlayBitmap = new wxBitmap(theTheme.Bitmap(bmpSpeaker));
|
||||
mPlayBitmap = std::make_unique<wxBitmap>(theTheme.Bitmap(bmpSpeaker));
|
||||
|
||||
Add(safenew wxStaticBitmap(this,
|
||||
wxID_ANY,
|
||||
|
@ -11,6 +11,7 @@
|
||||
#ifndef __AUDACITY_MIXER_TOOLBAR__
|
||||
#define __AUDACITY_MIXER_TOOLBAR__
|
||||
|
||||
#include "../MemoryX.h"
|
||||
#include "ToolBar.h"
|
||||
|
||||
class wxImage;
|
||||
@ -60,8 +61,7 @@ class MixerToolBar final : public ToolBar {
|
||||
void InitializeMixerToolBar();
|
||||
void SetToolTips();
|
||||
|
||||
wxBitmap *mPlayBitmap;
|
||||
wxBitmap *mRecordBitmap;
|
||||
std::unique_ptr<wxBitmap> mPlayBitmap, mRecordBitmap;
|
||||
|
||||
ASlider *mInputSlider;
|
||||
ASlider *mOutputSlider;
|
||||
|
@ -349,7 +349,7 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
||||
pt[ 2 ].y = 0;
|
||||
|
||||
// Create the shaped region
|
||||
mDown = new wxRegion( 3, &pt[0] );
|
||||
mDown = std::make_unique<wxRegion>( 3, &pt[0] );
|
||||
|
||||
// Create the down arrow
|
||||
pt[ 0 ].x = 9;
|
||||
@ -360,7 +360,7 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
||||
pt[ 2 ].y = 18;
|
||||
|
||||
// Create the shaped region
|
||||
mLeft = new wxRegion( 3, &pt[0] );
|
||||
mLeft = std::make_unique<wxRegion>( 3, &pt[0] );
|
||||
|
||||
// Create the indicator frame
|
||||
mIndicator = new wxFrame( NULL,
|
||||
@ -465,10 +465,6 @@ ToolManager::~ToolManager()
|
||||
|
||||
// Must destroy the window since it doesn't have a parent
|
||||
mIndicator->Destroy();
|
||||
|
||||
// Delete the indicator regions
|
||||
delete mLeft;
|
||||
delete mDown;
|
||||
}
|
||||
|
||||
// This table describes the default configuration of the toolbars as
|
||||
@ -1159,14 +1155,14 @@ void ToolManager::OnMouse( wxMouseEvent & event )
|
||||
p.x = dr.GetLeft() + ( dr.GetWidth() / 2 )
|
||||
- (box.GetWidth() / 2);
|
||||
p.y = dr.GetBottom() - box.GetHeight();
|
||||
mCurrent = mDown;
|
||||
mCurrent = mDown.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.x = dr.GetLeft() + r.GetLeft();
|
||||
p.y = dr.GetTop() + r.GetTop() +
|
||||
( ( r.GetHeight() - mLeft->GetBox().GetHeight() ) / 2 );
|
||||
mCurrent = mLeft;
|
||||
mCurrent = mLeft.get();
|
||||
}
|
||||
|
||||
// Change the shape while hidden and then show it if okay
|
||||
|
@ -13,6 +13,7 @@
|
||||
#ifndef __AUDACITY_TOOLMANAGER__
|
||||
#define __AUDACITY_TOOLMANAGER__
|
||||
|
||||
#include "../MemoryX.h"
|
||||
#include <wx/defs.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/timer.h>
|
||||
@ -97,8 +98,7 @@ class ToolManager final : public wxEvtHandler
|
||||
wxRect mBarPos;
|
||||
|
||||
wxFrame *mIndicator;
|
||||
wxRegion *mLeft;
|
||||
wxRegion *mDown;
|
||||
std::unique_ptr<wxRegion> mLeft, mDown;
|
||||
wxRegion *mCurrent;
|
||||
|
||||
wxTimer mTimer;
|
||||
|
@ -93,15 +93,12 @@ TranscriptionToolBar::TranscriptionToolBar()
|
||||
{
|
||||
mPlaySpeed = 1.0 * 100.0;
|
||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||
mVk = new VoiceKey();
|
||||
mVk = std::make_unique<VoiceKey>();
|
||||
#endif
|
||||
}
|
||||
|
||||
TranscriptionToolBar::~TranscriptionToolBar()
|
||||
{
|
||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||
delete mVk;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TranscriptionToolBar::Create(wxWindow * parent)
|
||||
|
@ -98,13 +98,13 @@ class TranscriptionToolBar final : public ToolBar {
|
||||
void OnAutomateSelection(wxCommandEvent & event);
|
||||
void OnSensitivitySlider(wxCommandEvent & event);
|
||||
|
||||
void Populate() override;
|
||||
void Repaint(wxDC * WXUNUSED(dc)) override {}
|
||||
void EnableDisableButtons() override;
|
||||
void UpdatePrefs() override;
|
||||
//void Populate() override;
|
||||
//void Repaint(wxDC * WXUNUSED(dc)) override {}
|
||||
//void EnableDisableButtons() override;
|
||||
//void UpdatePrefs() override;
|
||||
|
||||
void OnFocus(wxFocusEvent &event);
|
||||
void OnCaptureKey(wxCommandEvent &event);
|
||||
//void OnFocus(wxFocusEvent &event);
|
||||
//void OnCaptureKey(wxCommandEvent &event);
|
||||
|
||||
double GetSensitivity();
|
||||
void SetKeyType(wxCommandEvent & event);
|
||||
@ -144,7 +144,7 @@ class TranscriptionToolBar final : public ToolBar {
|
||||
|
||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||
double mSensitivity;
|
||||
VoiceKey *mVk;
|
||||
std::unique_ptr<VoiceKey> mVk;
|
||||
wxChoice *mKeyTypeChoice;
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user