Exemplo n.º 1
0
bool DnDialogFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
{
    //只有一个文件时弹出添加命令窗口
    if (filenames.Count() == 1)
    {
        wxString cmd = filenames[0];
        cmd.Replace('\\','/');
        DlgAddNewCmd* dlg=new DlgAddNewCmd(NULL);
        dlg->cmdLine->SetValue(cmd);
        dlg->cmdName->SetValue(wxFileNameFromPath(cmd));
        cmd.Clear();
        if (dlg->ShowModal() == wxID_OK)
            m_pOwner->ReLoadCmds();
        dlg->Destroy();
        return true;
    }
    //多个文件时自动批量添加;
    for(int i = filenames.Count() - 1 ; i>=0; --i)
    {
        wxString cmd = filenames[i];
        cmd.Replace("\\","/");
        g_config->AddCmd(cmd,wxFileNameFromPath(cmd));
    }
    m_pOwner->ReLoadCmds();
    return true;
    //多个文件时自动批量添加;
}
Exemplo n.º 2
0
void Config::OnMpBrowse(wxCommandEvent& event)
{
  wxConfig *config = (wxConfig *)wxConfig::Get();
  wxString dd;
  config->Read(wxT("maxima"), &dd);
#if defined __WXMSW__
  wxString file = wxFileSelector(_("Select Maxima program"),
                                 wxPathOnly(dd), wxFileNameFromPath(dd),
                                 wxEmptyString, _("Bat files (*.bat)|*.bat|All|*"),
                                 wxFD_OPEN);
#else
  wxString file = wxFileSelector(_("Select Maxima program"),
                                 wxPathOnly(dd), wxFileNameFromPath(dd),
                                 wxEmptyString, _("All|*"),
                                 wxFD_OPEN);
#endif

  if (file.Length())
  {
    if (file.Right(8) == wxT("wxmaxima") || file.Right(12) == wxT("wxmaxima.exe") ||
        file.Right(12) == wxT("wxMaxima.exe"))
      wxMessageBox(_("Invalid entry for Maxima program.\n\nPlease enter the path to Maxima program again."),
                   _("Error"),
                   wxOK|wxICON_ERROR);
    else
      m_maximaProgram->SetValue(file);
  }
}
Exemplo n.º 3
0
void cbDiffEditor::updateTitle()
{
    //SetTitle(...) calls Manager::Get()->GetEditorManager() which can fail during shutdown
    if(!Manager::Get()->IsAppShuttingDown())
        SetTitle(_T("Diff: ") +
                 (diffctrl_->LeftModified() ? _("*") : _("")) + wxFileNameFromPath(leftFile_) +
                 _T(" ") +
                 (diffctrl_->RightModified() ? _("*") : _("")) + wxFileNameFromPath(rightFile_));
}
Exemplo n.º 4
0
void wxFileCtrl::GoToParentDir()
{
    if (!IsTopMostDir(m_dirName))
    {
        size_t len = m_dirName.Len();
        if (wxEndsWithPathSeparator(m_dirName))
            m_dirName.Remove( len-1, 1 );
        wxString fname( wxFileNameFromPath(m_dirName) );
        m_dirName = wxPathOnly( m_dirName );
#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
        if (!m_dirName.empty())
        {
            if (m_dirName.Last() == wxT('.'))
                m_dirName = wxEmptyString;
        }
#elif defined(__UNIX__)
        if (m_dirName.empty())
            m_dirName = wxT("/");
#endif
        UpdateFiles();
        long id = FindItem( 0, fname );
        if (id != wxNOT_FOUND)
        {
            ignoreChanges = true;
            SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
            EnsureVisible( id );
            ignoreChanges = false;
        }
    }
}
Exemplo n.º 5
0
//普通匹配文件名
bool ThreadWork::matchFileName( wxString &path )
{
	if( wxFileNameFromPath( path ).Find(parItems[1]) != wxNOT_FOUND )
		return true;
	
	return false;
}
Exemplo n.º 6
0
void MyFrame::OnSnapshotToBMP(wxCommandEvent &)
{
    wxString filename = wxFileSelector( wxT("Save Image"),
                                        wxPathOnly(m_bmp_filename),
                                        wxFileNameFromPath(m_bmp_filename),
                                        wxT("*.bmp"),
                                        wxT("BMP files (*.bmp)|*.bmp"),
                                        wxFD_SAVE|wxFD_OVERWRITE_PROMPT, this);

    if (filename == wxEmptyString) 
    {
        SetupVideoMenus();
        return;
    }

    wxString extension = filename.AfterLast('.').Lower();

    if (m_captureMenu->IsChecked(ID_NOPREVIEWONCAP))
    {
        m_vidCapWin->Preview(false);
        m_vidCapWin->Overlay(false);
    }

    bool saved = false;

    if (extension == wxT("bmp"))
        saved = m_vidCapWin->SnapshotToBMP( filename );

    if (saved) 
        m_bmp_filename = filename;

    SetupVideoMenus();
}
Exemplo n.º 7
0
wxString wxFindFirstFile(const wxString& spec, int flags)
{
    wxFileName::SplitPath(spec, &gs_dirPath, NULL, NULL);
    if ( gs_dirPath.empty() )
        gs_dirPath = wxT(".");
    if ( !wxEndsWithPathSeparator(gs_dirPath ) )
        gs_dirPath << wxFILE_SEP_PATH;

    gs_dir.reset(new wxDir(gs_dirPath));

    if ( !gs_dir->IsOpened() )
    {
        wxLogSysError(_("Cannot enumerate files '%s'"), spec);
        return wxEmptyString;
    }

    int dirFlags;
    switch (flags)
    {
        case wxDIR:  dirFlags = wxDIR_DIRS; break;
        case wxFILE: dirFlags = wxDIR_FILES; break;
        default:     dirFlags = wxDIR_DIRS | wxDIR_FILES; break;
    }

    wxString result;
    gs_dir->GetFirst(&result, wxFileNameFromPath(spec), dirFlags);
    if ( result.empty() )
        return result;

    return gs_dirPath + result;
}
Exemplo n.º 8
0
void DeviceFrame::OnDeviceOpenSound(wxCommandEvent &) {
  wxString filename(GetSoundFile());
  if (filename.empty()) {
	return;
  }

  audiere::SampleSourcePtr source = audiere::OpenSampleSource(wxString2CStr(filename));
  if (!source) {
    wxMessageBox(
      wxT("Could not open source: ") + filename,
      wxT("Open Sound"), wxOK | wxCENTRE, this);
    return;
  }

  audiere::OutputStreamPtr stream = audiere::OpenSound(m_device, source);
  if (!stream) {
    wxMessageBox(
      wxT("Could not open sound: ") + filename,
      wxT("Open Sound"), wxOK | wxCENTRE, this);
    return;
  }

  // get the basename of the path for the window title
  wxString basename = wxFileNameFromPath(filename);
  new StreamFrame(this, wxT("Sound: ") + basename, stream.get(), source.get());
}
Exemplo n.º 9
0
void ChooseInputFile(bool force)
{
#if wxUSE_FILEDLG
    if (force || InputFile.empty())
    {
        wxString s = wxFileSelector(_T("Choose LaTeX input file"), wxPathOnly(InputFile), wxFileNameFromPath(InputFile), _T("tex"), _T("*.tex"));
        if (!s.empty())
        {
            // Different file, so clear index entries.
            ClearKeyWordTable();
            ResetContentsLevels(0);
            passNumber = 1;
            errorCount = 0;

            InputFile = s;
            wxString str = wxFileNameFromPath(InputFile);
            wxString buf;
            buf.Printf(_T("Tex2RTF [%s]"), str.c_str());
            frame->SetTitle((wxChar *)buf.c_str());
            OutputFile = wxEmptyString;
        }
    }
#else
    wxUnusedVar(force);
#endif // wxUSE_FILEDLG
}
Exemplo n.º 10
0
// Update the column content of the item at _Index
void CGameListCtrl::UpdateItemAtColumn(long _Index, int column)
{
	GameListItem& rISOFile = *m_ISOFiles[_Index];

	switch(column)
	{
		case COLUMN_PLATFORM:
		{
			SetItemColumnImage(_Index, COLUMN_PLATFORM,
			                   m_PlatformImageIndex[rISOFile.GetPlatform()]);
			break;
		}
		case COLUMN_BANNER:
		{
			int ImageIndex = -1;

			if (rISOFile.GetBitmap().IsOk())
				ImageIndex = m_imageListSmall->Add(rISOFile.GetBitmap());

			SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
			break;
		}
		case COLUMN_TITLE:
		{
			wxString name = StrToWxStr(rISOFile.GetName());
			int disc_number = rISOFile.GetDiscNumber() + 1;

			if (disc_number > 1 &&
			    name.Lower().find(wxString::Format("disc %i", disc_number)) == std::string::npos &&
			    name.Lower().find(wxString::Format("disc%i", disc_number)) == std::string::npos)
			{
				name = wxString::Format(_("%s (Disc %i)"), name.c_str(), disc_number);
			}

			SetItem(_Index, COLUMN_TITLE, name, -1);
			break;
		}
		case COLUMN_MAKER:
			SetItem(_Index, COLUMN_MAKER, StrToWxStr(rISOFile.GetCompany()), -1);
			break;
		case COLUMN_FILENAME:
			SetItem(_Index, COLUMN_FILENAME,
			        wxFileNameFromPath(StrToWxStr(rISOFile.GetFileName())), -1);
			break;
		case COLUMN_EMULATION_STATE:
			SetItemColumnImage(_Index, COLUMN_EMULATION_STATE,
			                   m_EmuStateImageIndex[rISOFile.GetEmuState()]);
			break;
		case COLUMN_COUNTRY:
			SetItemColumnImage(_Index, COLUMN_COUNTRY,
			                   m_FlagImageIndex[rISOFile.GetCountry()]);
			break;
		case COLUMN_SIZE:
			SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1);
			break;
		case COLUMN_ID:
			SetItem(_Index, COLUMN_ID, rISOFile.GetUniqueID(), -1);
			break;
	}
}
Exemplo n.º 11
0
void ecConfigToolView::OnChangeFilename()
{
    if (wxGetApp().GetTopWindow() && GetDocument())
    {
        wxString docTitle(wxFileNameFromPath(GetDocument()->GetFilename()));
        wxStripExtension(docTitle);
        GetDocument()->SetTitle(docTitle);

        wxString name(GetDocument()->GetFilename());
        wxStripExtension(name);

        ((ecConfigToolDoc*) GetDocument())->SetInstallTree(name + wxT("_install"));
        ((ecConfigToolDoc*) GetDocument())->SetBuildTree(name + wxT("_build"));

        wxString title;

        wxString modifiedMarker;
        if (GetDocument()->IsModified())
            modifiedMarker = wxT("*");

        title = docTitle + modifiedMarker + wxString(wxT(" - ")) + wxGetApp().GetSettings().GetAppName();

        ((wxFrame*) wxGetApp().GetTopWindow())->SetTitle(title);
    }
}
Exemplo n.º 12
0
bool TranslationMemoryUpdater::Update(const wxArrayString& files)
{
    m_progress->SetGaugeMax((int)files.GetCount());
    m_progress->ResetGauge();

    bool res = true;
    wxString f;
    size_t cnt = files.GetCount();
    for (size_t i = 0; i < cnt; i++)
    {
        f = files[i];
        m_progress->UpdateMessage(wxString(_("Scanning file: ")) + 
                                  wxFileNameFromPath(f));
        
        if (f.Matches("*.po"))
            res = UpdateFromPO(f);
        else if (f.Matches("*.mo"))
            res = UpdateFromMO(f);
#if HAVE_RPM
        else if (f.Matches("*.rpm"))
            res = UpdateFromRPM(f);
#endif

        m_progress->UpdateGauge();
        wxYield();
        if (m_progress->Cancelled()) return false;
    }
    return res;
}
Exemplo n.º 13
0
        void MainFrame::OnMenuCompile(wxCommandEvent& WXUNUSED(e))
        {
            TerminalWidget* terminalWidget = static_cast<TerminalWidget*>(m_mgr.GetPane("pane_output").window);

            wxString executablePath = wxStandardPaths::Get().GetExecutablePath();
            wxString executableDir = wxPathOnly(executablePath);

            wxString compilerPath = wxPathOnly(executableDir) + "\\TDM-GCC-32\\bin\\";

            if (!wxFileExists(compilerPath + "g++.exe"))
                compilerPath = executableDir + "\\TDM-GCC-32\\bin\\";

            if (!wxFileExists(compilerPath + "g++.exe"))
            {
                wxMessageBox("Error, cannot find the compiler. Are you sure there is "
                    "'TDM-GCC-32' folder in '" + executableDir + "' ?", "SimplyCpp error", wxICON_ERROR, this);
                return;
            }

            wxExecuteEnv env;
            env.cwd = wxPathOnly(((EditorWidget*)m_notebook->GetCurrentPage())->GetFileName());
            env.env.insert(wxStringToStringHashMap_wxImplementation_Pair("PATH", compilerPath));

            wxString fileName = wxFileNameFromPath(((EditorWidget*)m_notebook->GetCurrentPage())->GetFileName());
            wxString exeName = wxString(fileName);
            exeName.Replace(".cpp", ".exe");

            terminalWidget->RunCommand(compilerPath + "g++.exe " + fileName + " -s -o " + exeName, env);
        }
Exemplo n.º 14
0
// Return just the filename, not the path (basename)
wxChar *wxFileNameFromPath (wxChar *path)
{
    wxString p = path;
    wxString n = wxFileNameFromPath(p);

    return path + p.length() - n.length();
}
Exemplo n.º 15
0
void SubMainFrame::OpenFile(wxString strFilename)
{
    OpenPaintMDIChildFrame *childFrame = new OpenPaintMDIChildFrame(this, wxID_ANY, wxFileNameFromPath(strFilename));
    if(childFrame && childFrame->Open(strFilename))
    {
        AddFileToHistory(strFilename);
        wxLogDebug(wxT("Opened file: %s") , strFilename);
    }
}
Exemplo n.º 16
0
wxString wxcXmlResourceCmp::GetInternalFileName(const wxString& name, const wxArrayString& flist)
{
    wxString name2 = name;
    name2.Replace(wxT(":"), wxT("_"));
    name2.Replace(wxT("/"), wxT("_"));
    name2.Replace(wxT("\\"), wxT("_"));
    name2.Replace(wxT("*"), wxT("_"));
    name2.Replace(wxT("?"), wxT("_"));

    wxString s = wxFileNameFromPath(m_outputCppFile) + wxT("$") + name2;

    if(wxFileExists(s) && flist.Index(s) == wxNOT_FOUND) {
        for(int i = 0;; i++) {
            s.Printf(wxFileNameFromPath(m_outputCppFile) + wxT("$%03i-") + name2, i);
            if(!wxFileExists(s) || flist.Index(s) != wxNOT_FOUND) break;
        }
    }
    return s;
}
Exemplo n.º 17
0
///正则方式匹配文件名
bool ThreadWork::regexMatchFileName( wxString &path )
{
	
	wxRegEx re( parItems[1], wxRE_ADVANCED );
	if(  !re.IsValid() )
		return false;
	if( re.Matches( wxFileNameFromPath( path ) ) )
		return true;
	
	return false;
}
Exemplo n.º 18
0
wxString AudacityProject::GetName()
{
   wxString name = wxFileNameFromPath(mFileName);

   // Chop off the extension
   int len = name.Len();
   if (len > 4 && name.Mid(len - 4) == ".aup")
      name = name.Mid(0, len - 4);

   return name;
}
Exemplo n.º 19
0
void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
{
    ChooseInputFile();
    if (!InputFile.empty() && wxFileExists(InputFile))
    {
        textWindow->LoadFile(InputFile);
        wxChar buf[300];
        wxString str(wxFileNameFromPath(OutputFile));
        wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
        frame->SetTitle(buf);
    }
}
Exemplo n.º 20
0
void Properties::onPropertyChanging(wxPropertyGridEvent& event, Map* map)
{
	if (event.GetPropertyName() == "Name")
	{
		map->setName(event.GetValue().GetString().c_str());
	}
	else if (event.GetPropertyName() == "Texture")
	{
		map->setTexture(wxFileNameFromPath(event.GetValue().GetString()).c_str());
	}

	City::getSingleton().updateViews(map);
}
Exemplo n.º 21
0
/**
* This method is responsible for setting everything up in the doc/view framework
* and opening the request file for editing in a new notebook tab.
* @param path Path to the filename being opened
*/
void HtMainFrame::DoOpenFile (const wxString &path)
{
   wxDocManager *docm = wxGetApp().doc_manager.get();

   // TODO: fazer as checagens no arquivo antes de tentar abrir.
   //       Ex: verificar se ele pode ser aberto como leitura/escrita, se o usuário tem permissão etc.

   // check if the requested file ain't already open
   wxList &docs = docm->GetDocuments();
   for (wxList::iterator i = docs.begin(); i != docs.end(); i++)
   {
      HexDoc *doc = dynamic_cast <HexDoc *> (*i);

      if (doc->GetFilename() == path)
      {
         // it's open already... focus it and we're done
         HexFrame *frame = static_cast<HexView *>(doc->GetFirstView())->GetFrame();

         auto *nb = GetNotebook();
         auto frmIdx = nb->FindPage(static_cast<wxWindow *>(frame));

         if (frmIdx != wxNOT_FOUND)
         {
            nb->SetSelection(frmIdx);
            frame->SetFocus();
         }

         return;
      }
   }

   // the view is created automatically when we create the doc
   HexDoc *doc = (HexDoc *)docm->CreateDocument(path, wxDOC_SILENT);

   if (doc)
   {
      HexView *view = (HexView *)doc->GetFirstView();

      HexFrame *frame = new HexFrame(view, this, wxID_ANY, wxFileNameFromPath(path));
      history.AddFileToHistory(path);

#ifdef WXDEBUG
      DebugPanel *dbgPanel = dynamic_cast<DebugPanel *>(FindWindowById(HT_DebugPanel));
      view->AddToDebugPanel(dbgPanel);
#endif
   }
   else // TODO: melhorar essa mensagem de erro.
      wxMessageBox(wxString::Format("Não foi possível abrir o arquivo\n%s", path), "Erro", wxOK | wxICON_ERROR, this);
}
Exemplo n.º 22
0
void FilePathPanel::OntxtFilenameText(wxCommandEvent& event)
{
    if (!txtFilename || txtFilename->GetValue().IsEmpty())
        return;
    wxString name = wxFileNameFromPath(txtFilename->GetValue());
    while (name.Replace(_T(" "), _T("_")))
        ;
    while (name.Replace(_T("\t"), _T("_")))
        ;
    while (name.Replace(_T("."), _T("_")))
        ;
    name.MakeUpper();
    name << _T("_INCLUDED");
    txtGuard->SetValue(name);
}
Exemplo n.º 23
0
void Properties::onPropertyChanging(wxPropertyGridEvent& event, Building* object)
{
	if (event.GetPropertyName() == "Height")
	{
		object->setHeight(event.GetValue().GetDouble());
	}
	else if (event.GetPropertyName() == "Number")
	{
		object->setNumber(event.GetValue().GetLong());
	}
	else if (event.GetPropertyName() == "Texture")
	{
		object->setTexture(wxFileNameFromPath(event.GetValue().GetString()).c_str());
	}
}
Exemplo n.º 24
0
   void LoadVSTPlugins() {
      wxString home = DirManager::GetHomeDir();
      wxString pathChar = DirManager::GetPathChar();
      wxString vstDirPath = home + pathChar + "vst";
      wxString fname;

      fname =
          wxFindFirstFile((const char *) (vstDirPath + pathChar +
                                          "*.DLL"));

      while (fname != "") {
         HANDLE hLib = LoadLibrary(fname);

         if (hLib != NULL) {

            // get the address of the main() function

            vstPluginMain pDllMain =
                (vstPluginMain) GetProcAddress((HINSTANCE) hLib, "main");

            if (pDllMain != NULL) {

               AEffect *theEffect;

               theEffect = (pDllMain) (audioMaster);

               if (theEffect->magic == kEffectMagic) {
                  wxString title = wxFileNameFromPath(fname);
                  int len = title.Len();
                  if (len > 4 && (title.Mid(len - 4) == ".DLL"
                                  || title.Mid(len - 4) == ".dll"))
                     title = title.Mid(0, len - 4);

                  VSTEffect *vst = new VSTEffect(title, theEffect);
                  Effect::RegisterEffect(vst);
               }
            }

            audacityVSTID++;
         } else {
            FreeLibrary((HINSTANCE) hLib);
         }

         fname = wxFindNextFile();
      }
   }
Exemplo n.º 25
0
void ecViewerOptionsDialog::OnBrowseForBrowser(wxCommandEvent& event)
{
    wxString currentViewer = ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT))->GetValue();

    wxFileDialog dialog(this, _("Choose a browser executable"), wxPathOnly(currentViewer),
        wxFileNameFromPath(currentViewer),
#ifdef __WXMSW__
        wxT("Executable files (*.exe)|*.exe"));
#else
        wxT("All files (*)|*"));
#endif

    if (dialog.ShowModal() == wxID_OK)
    {
        ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT))->SetValue(dialog.GetPath());
    }
}
Exemplo n.º 26
0
void ChooseOutputFile(bool force)
{
    wxChar extensionBuf[10];
    wxChar wildBuf[10];
    wxStrcpy(wildBuf, _T("*."));
    wxString path;
    if (!OutputFile.empty())
        path = wxPathOnly(OutputFile);
    else if (!InputFile.empty())
        path = wxPathOnly(InputFile);

    switch (convertMode)
    {
        case TEX_RTF:
        {
            wxStrcpy(extensionBuf, _T("rtf"));
            wxStrcat(wildBuf, _T("rtf"));
            break;
        }
        case TEX_XLP:
        {
            wxStrcpy(extensionBuf, _T("xlp"));
            wxStrcat(wildBuf, _T("xlp"));
            break;
        }
        case TEX_HTML:
        {
            wxStrcpy(extensionBuf, _T("html"));
            wxStrcat(wildBuf, _T("html"));
            break;
        }
    }
#if wxUSE_FILEDLG
    if (force || OutputFile.empty())
    {
        wxString s = wxFileSelector(_T("Choose output file"), path, wxFileNameFromPath(OutputFile),
                                    extensionBuf, wildBuf);
        if (!s.empty())
            OutputFile = s;
    }
#else
    wxUnusedVar(force);
#endif // wxUSE_FILEDLG
}
Exemplo n.º 27
0
void DeviceFrame::DoOpenEffect(audiere::SoundEffectType type, wxString typestring) {
  wxString filename(GetSoundFile());
  if (filename.empty()) {
    return;
  }

  audiere::SoundEffectPtr effect = audiere::OpenSoundEffect(m_device, wxString2CStr(filename), type);
  if (effect) {
    wxString basename = wxFileNameFromPath(filename);
    wxString title;
    title.sprintf(wxT("Sound Effect (%s): %s"),
                  typestring.c_str(), basename.c_str());
    new SoundEffectFrame(this, title, effect);
  } else {
    wxMessageBox(
      wxT("Could not open sound effect: ") + filename,
      wxT("Open Sound Effect"), wxOK | wxCENTRE, this);
  }
}
Exemplo n.º 28
0
Arquivo: run.cpp Projeto: bihai/fbide
void MyFrame::GoToError ( int Linenr, wxString FileName ) {
    if ( wxFileNameFromPath(FileName).Lower()!="fbidetemp.bas") {
        int result = bufferList.FileLoaded(FileName);
        if (result != -1) {
            if (FBNotebook->GetSelection()!=result) {
                FBNotebook->SetSelection(result);
            }
        }
        else {
            NewSTCPage(FileName, true);
        }
    }

    if (stc->GetCurrentLine()!=(int)Linenr) {
        stc->ScrollToLine((int)Linenr-(stc->LinesOnScreen()/2));
        stc->GotoLine((int)Linenr);

    }
    stc->SetFocus();
    stc->EnsureCaretVisible();
}
Exemplo n.º 29
0
void DeviceFrame::OnDeviceOpenStream(wxCommandEvent &) {
  wxString filename(GetSoundFile());
  if (filename.empty()) {
    return;
  }

#if wxUSE_UNICODE
  wxCharBuffer buffFilename = filename.mb_str(wxConvUTF8);
  audiere::SampleSourcePtr source = audiere::OpenSampleSource(buffFilename.data());
#else
  audiere::SampleSourcePtr source = audiere::OpenSampleSource(filename);
#endif
  if (!source) {
    wxMessageBox(
      wxT("Could not open sample source: ") + filename,
      wxT("Open Stream"), wxOK | wxCENTRE, this);
    return;
  }

  audiere::LoopPointSourcePtr loop_source =
    audiere::CreateLoopPointSource(source);
  if (loop_source) {
    source = loop_source.get();
  }

  audiere::OutputStreamPtr stream = audiere::OpenSound(
    m_device,
    source,
    true);
  if (!stream) {
    wxMessageBox(
      wxT("Could not open output stream: ") + filename,
      wxT("Open Stream"), wxOK | wxCENTRE, this);
    return;
  }

  // get the basename of the path for the window title
  wxString basename = wxFileNameFromPath(filename);
  new StreamFrame(this, wxT("Stream: ") + basename, stream.get(), source.get(), loop_source.get());
}
bool mmAttachmentManage::DeleteAttachment(const wxString& FileToDelete)
{
    if (wxFileExists(FileToDelete))
    {
        if (Model_Infotable::instance().GetBoolInfo("ATTACHMENTSTRASH", false))
        {
            wxString DeletedAttachmentFolder = mmex::getPathAttachment(mmAttachmentManage::InfotablePathSetting()) + m_PathSep + "Deleted";

            if (!wxDirExists(DeletedAttachmentFolder))
            {
                if (wxMkdir(DeletedAttachmentFolder))
                    mmAttachmentManage::CreateReadmeFile(DeletedAttachmentFolder);
                else
                    return false;
            }

            wxString FileToTrash = DeletedAttachmentFolder + m_PathSep
                + wxDateTime::Now().FormatISODate() + "_" + wxFileNameFromPath(FileToDelete);

            if (!wxRenameFile(FileToDelete, FileToTrash))
                return false;
        }
        else if (!wxRemoveFile(FileToDelete))
            return false;
    }
    else
    {
        wxString msgStr = wxString() << _("Attachment not found:") << "\n"
            << "'" << FileToDelete << "'" << "\n"
            << "\n"
            << _("Do you want to continue and delete attachment on database?") << "\n";
        int DeleteResponse = wxMessageBox(msgStr, _("Delete attachment failed"), wxYES_NO | wxNO_DEFAULT | wxICON_ERROR);
        if (DeleteResponse == wxYES)
            return true;
        else
            return false;
    }
    return true;
}