bool OpenCLTraceOptions::AreSettingsValid(gtString& invalidMessageStr)
{
    if (m_pAPIsToTraceRB->isChecked() &&
        (Util::ItemsSelectedInTreeWidget(m_pAPIsToTraceTW) == 0))
    {
        invalidMessageStr = L"At least one item under \"APIs to trace\" must be selected.";
        return false;
    }

    SaveCurrentSettings();
    return true;
}
//=============================================================================
void CXProgressWnd::Close() 
//=============================================================================
{
	if (m_bPersistentPosition)
		SaveCurrentSettings();

	m_bCancelled = TRUE;
	Hide();

	if (m_pParent && IsWindow(m_pParent->m_hWnd))
		m_pParent->SetForegroundWindow();
}
BOOL CProgressWnd::DestroyWindow() 
{
    if (m_bPersistantPosition)
        SaveCurrentSettings();

    if (m_bModal)
    {
        m_bModal = FALSE;
        CWnd *pMainWnd = AfxGetMainWnd();

        if (m_wRenenableWnd)
            m_wRenenableWnd->EnableWindow(TRUE);
    }
	
    return CWnd::DestroyWindow();
}
void CProgressWnd::OnCancel() 
{
    if (m_bEnableCancel)
    {
        if (m_bPersistantPosition)
            SaveCurrentSettings();

        m_bCancelled = TRUE;
        Hide();

        if (m_bModal)
            PostMessage(WM_CLOSE);

        CWnd *pWnd = AfxGetMainWnd();
        if (pWnd && ::IsWindow(pWnd->m_hWnd))
            pWnd->SetForegroundWindow();
    }
}
//=============================================================================
BOOL CXProgressWnd::DestroyWindow() 
//=============================================================================
{
	if (m_bPersistentPosition)
		SaveCurrentSettings();

	if (IsWindow(m_avi.m_hWnd))
	{
		m_avi.Stop();
		m_avi.Close();
	}

	if (m_bModal)
	{
		m_bModal = FALSE;

		if (m_wRenenableWnd && IsWindow(m_wRenenableWnd->m_hWnd))
			m_wRenenableWnd->EnableWindow(TRUE);
	}
	
	return CWnd::DestroyWindow();
}
void ConfigurationManagerDlg::OnWorkspaceConfigSelected(wxCommandEvent &event)
{
	if (event.GetString() == clCMD_NEW) {
		OnButtonNew(event);
	} else if (event.GetString() == clCMD_EDIT) {
		//popup the delete dialog for configurations
		EditWorkspaceConfDlg *dlg = new EditWorkspaceConfDlg(this);
		dlg->ShowModal();
		dlg->Destroy();

		//once done, restore dialog
		PopulateConfigurations();
	} else {
		if (m_dirty) {
			if ( wxMessageBox(wxString::Format(wxT("Settings for workspace configuration '%s' have changed, would you like to save them?"), m_currentWorkspaceConfiguration.GetData()), wxT("EmbeddedLite"), wxYES_NO|wxICON_QUESTION) == wxYES) {
				SaveCurrentSettings();
			}
			m_dirty = false;
		}
		m_currentWorkspaceConfiguration = event.GetString();
		LoadWorkspaceConfiguration(event.GetString());
	}
}
void ConfigurationManagerDlg::OnButtonApply(wxCommandEvent &event)
{
	wxUnusedVar(event);
	SaveCurrentSettings();
}