本文整理汇总了C++中wxFileNameFromPath函数的典型用法代码示例。如果您正苦于以下问题:C++ wxFileNameFromPath函数的具体用法?C++ wxFileNameFromPath怎么用?C++ wxFileNameFromPath使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxFileNameFromPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DlgAddNewCmd
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;
//多个文件时自动批量添加;
}
示例2: wxFileSelector
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);
}
}
示例3: SetTitle
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_));
}
示例4: fname
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;
}
}
}
示例5: matchFileName
//普通匹配文件名
bool ThreadWork::matchFileName( wxString &path )
{
if( wxFileNameFromPath( path ).Find(parItems[1]) != wxNOT_FOUND )
return true;
return false;
}
示例6: wxFileSelector
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();
}
示例7: wxFindFirstFile
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;
}
示例8: filename
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());
}
示例9: ChooseInputFile
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
}
示例10: switch
// 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;
}
}
示例11: docTitle
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);
}
}
示例12: wxFileNameFromPath
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;
}
示例13: WXUNUSED
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);
}
示例14: wxFileNameFromPath
// 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();
}
示例15: OpenPaintMDIChildFrame
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);
}
}