mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-07 07:39:29 +02:00
More safenew
This commit is contained in:
parent
c438925a22
commit
8572b425c1
@ -1203,7 +1203,8 @@ bool AudacityApp::OnInit()
|
||||
|
||||
::wxInitAllImageHandlers();
|
||||
|
||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||
// AddHandler takes ownership
|
||||
wxFileSystem::AddHandler(safenew wxZipFSHandler);
|
||||
|
||||
//
|
||||
// Paths: set search path and temp dir path
|
||||
|
@ -340,7 +340,8 @@ public:
|
||||
{
|
||||
mProject = proj;
|
||||
|
||||
SetDataObject(new FileObject());
|
||||
// SetDataObject takes ownership
|
||||
SetDataObject(safenew FileObject());
|
||||
}
|
||||
|
||||
~DropTarget()
|
||||
@ -1110,9 +1111,11 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
// We can import now, so become a drag target
|
||||
// SetDropTarget(new AudacityDropTarget(this));
|
||||
// mTrackPanel->SetDropTarget(new AudacityDropTarget(this));
|
||||
mTrackPanel->SetDropTarget(new DropTarget(this));
|
||||
// SetDropTarget(safenew AudacityDropTarget(this));
|
||||
// mTrackPanel->SetDropTarget(safenew AudacityDropTarget(this));
|
||||
|
||||
// SetDropTarget takes ownership
|
||||
mTrackPanel->SetDropTarget(safenew DropTarget(this));
|
||||
#endif
|
||||
|
||||
wxTheApp->Connect(EVT_AUDIOIO_CAPTURE,
|
||||
|
@ -142,7 +142,8 @@ void SplashDialog::Show2( wxWindow * pParent )
|
||||
{
|
||||
if( pSelf == NULL )
|
||||
{
|
||||
pSelf = new SplashDialog( pParent );
|
||||
// pParent owns it
|
||||
pSelf = safenew SplashDialog( pParent );
|
||||
}
|
||||
pSelf->mpHtml->SetPage(HelpText( wxT("welcome") ));
|
||||
pSelf->Show( true );
|
||||
|
@ -218,7 +218,9 @@ void ODManager::Init()
|
||||
mMaxThreads = 5;
|
||||
|
||||
// wxLogDebug(wxT("Initializing ODManager...Creating manager thread"));
|
||||
ODManagerHelperThread* startThread = new ODManagerHelperThread;
|
||||
// This is a detached thread, so it deletes itself when it finishes
|
||||
// ... except on Mac where we we don't use wxThread for reasons unexplained
|
||||
ODManagerHelperThread* startThread = safenew ODManagerHelperThread;
|
||||
|
||||
// startThread->SetPriority(0);//default of 50.
|
||||
startThread->Create();
|
||||
@ -239,7 +241,6 @@ void ODManager::DecrementCurrentThreads()
|
||||
///Main loop for managing threads and tasks.
|
||||
void ODManager::Start()
|
||||
{
|
||||
ODTaskThread* thread;
|
||||
bool tasksInArray;
|
||||
bool paused;
|
||||
int numQueues=0;
|
||||
@ -278,7 +279,9 @@ void ODManager::Start()
|
||||
|
||||
mTasksMutex.Lock();
|
||||
//detach a NEW thread.
|
||||
thread = new ODTaskThread(mTasks[0]);//task);
|
||||
// This is a detached thread, so it deletes itself when it finishes
|
||||
// ... except on Mac where we we don't use wxThread for reasons unexplained
|
||||
auto thread = safenew ODTaskThread(mTasks[0]);//task);
|
||||
//thread->SetPriority(10);//default is 50.
|
||||
thread->Create();
|
||||
thread->Run();
|
||||
|
@ -222,7 +222,7 @@ class ODManagerHelperThread {
|
||||
class ODManagerHelperThread final : public wxThread
|
||||
{
|
||||
public:
|
||||
///Constructs a ODTaskThread
|
||||
///Constructs an ODManagerHelperThread
|
||||
///@param task the task to be launched as an
|
||||
ODManagerHelperThread(): wxThread(){}
|
||||
|
||||
|
@ -62,12 +62,6 @@ ExtImportPrefs::ExtImportPrefs(wxWindow * parent)
|
||||
PluginList(NULL), mCreateTable (false), mDragFocus (NULL),
|
||||
mFakeKeyEvent (false), mStopRecursiveSelection (false), last_selected (-1)
|
||||
{
|
||||
dragtext1 = new wxTextDataObject(wxT(""));
|
||||
dragtext2 = new wxTextDataObject(wxT(""));
|
||||
dragtarget1 = new ExtImportPrefsDropTarget(dragtext1);
|
||||
dragtarget2 = new ExtImportPrefsDropTarget(dragtext2);
|
||||
dragtarget1->SetPrefs (this);
|
||||
dragtarget2->SetPrefs (this);
|
||||
Populate();
|
||||
}
|
||||
|
||||
@ -121,7 +115,14 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
RuleTable->SetSelectionMode (wxGrid::wxGridSelectRows);
|
||||
RuleTable->AutoSizeColumns ();
|
||||
|
||||
RuleTable->SetDropTarget (dragtarget1);
|
||||
ExtImportPrefsDropTarget *dragtarget1 {};
|
||||
RuleTable->SetDropTarget (
|
||||
dragtarget1 = safenew ExtImportPrefsDropTarget(
|
||||
dragtext1 = safenew wxTextDataObject(wxT(""))
|
||||
)
|
||||
);
|
||||
dragtarget1->SetPrefs (this);
|
||||
|
||||
RuleTable->EnableDragCell (true);
|
||||
fillRuleTable = true;
|
||||
}
|
||||
@ -134,7 +135,15 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
PluginList->SetSingleStyle (wxLC_REPORT, true);
|
||||
PluginList->SetSingleStyle (wxLC_SINGLE_SEL, true);
|
||||
PluginList->InsertColumn (0, _("Importer order"));
|
||||
PluginList->SetDropTarget (dragtarget2);
|
||||
|
||||
ExtImportPrefsDropTarget *dragtarget2 {};
|
||||
PluginList->SetDropTarget (
|
||||
dragtarget2 = safenew ExtImportPrefsDropTarget(
|
||||
dragtext2 = safenew wxTextDataObject(wxT(""))
|
||||
)
|
||||
);
|
||||
dragtarget2->SetPrefs (this);
|
||||
|
||||
PluginList->SetColumnWidth (0, wxLIST_AUTOSIZE_USEHEADER);
|
||||
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
@ -646,9 +655,9 @@ void ExtImportPrefs::OnRuleTableCellClick (wxGridEvent& event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
ExtImportPrefsDropTarget::ExtImportPrefsDropTarget (wxDataObject *dataObject)
|
||||
ExtImportPrefsDropTarget::ExtImportPrefsDropTarget(wxDataObject *dataObject)
|
||||
: wxDropTarget(dataObject)
|
||||
{
|
||||
SetDataObject (dataObject);
|
||||
mPrefs = NULL;
|
||||
}
|
||||
|
||||
@ -779,11 +788,6 @@ void ExtImportPrefsDropTarget::OnLeave()
|
||||
{
|
||||
}
|
||||
|
||||
void ExtImportPrefsDropTarget::SetDataObject(wxDataObject* data)
|
||||
{
|
||||
this->m_dataObject = data;
|
||||
}
|
||||
|
||||
PrefsPanel *ExtImportPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -30,14 +30,14 @@ class ShuttleGui;
|
||||
class ExtImportPrefsDropTarget final : public wxDropTarget
|
||||
{
|
||||
public:
|
||||
ExtImportPrefsDropTarget (wxDataObject *dataObject = 0);
|
||||
// Takes ownership of the argument
|
||||
ExtImportPrefsDropTarget(wxDataObject* dataObject = nullptr);
|
||||
~ExtImportPrefsDropTarget ();
|
||||
wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
|
||||
bool OnDrop(wxCoord x, wxCoord y);
|
||||
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
|
||||
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
|
||||
void OnLeave();
|
||||
void SetDataObject(wxDataObject* data);
|
||||
void SetPrefs (ExtImportPrefs *prefs);
|
||||
private:
|
||||
ExtImportPrefs *mPrefs;
|
||||
@ -86,10 +86,8 @@ class ExtImportPrefs final : public PrefsPanel
|
||||
wxButton *MoveFilterUp;
|
||||
wxButton *MoveFilterDown;
|
||||
|
||||
wxTextDataObject *dragtext1;
|
||||
wxTextDataObject *dragtext2;
|
||||
ExtImportPrefsDropTarget *dragtarget1;
|
||||
ExtImportPrefsDropTarget *dragtarget2;
|
||||
wxTextDataObject *dragtext1 {};
|
||||
wxTextDataObject *dragtext2 {};
|
||||
|
||||
bool mCreateTable;
|
||||
wxWindow *mDragFocus;
|
||||
|
Loading…
x
Reference in New Issue
Block a user