本文整理汇总了C++中LabelTrack::Import方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelTrack::Import方法的具体用法?C++ LabelTrack::Import怎么用?C++ LabelTrack::Import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelTrack
的用法示例。
在下文中一共展示了LabelTrack::Import方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnImport
void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
{
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"),::wxGetCwd());
// Ask user for a filename
wxString fileName =
FileSelector(_("Select a text file containing labels..."),
path, // Path
wxT(""), // Name
wxT(".txt"), // Extension
_("Text files (*.txt)|*.txt|All files|*"),
wxRESIZE_BORDER, // Flags
this); // Parent
// They gave us one...
if (fileName != wxT("")) {
path =::wxPathOnly(fileName);
gPrefs->Write(wxT("/DefaultOpenPath"), path);
gPrefs->Flush();
wxTextFile f;
// Get at the data
f.Open(fileName);
if (!f.IsOpened()) {
wxMessageBox(_("Could not open file: ") + fileName);
}
else {
// Create a temporary label track and load the labels
// into it
LabelTrack *lt = new LabelTrack(mDirManager);
lt->Import(f);
// Add the labesls to our collection
AddLabels(lt);
// Done with the temporary track
delete lt;
}
// Repopulate the grid
TransferDataToWindow();
}
}
示例2: OnImportLabels
void AudacityProject::OnImportLabels(wxCommandEvent & event)
{
wxString path = gPrefs->Read("/DefaultOpenPath",::wxGetCwd());
wxString fileName =
wxFileSelector(_("Select a text file containing labels..."),
path, // Path
"", // Name
".txt", // Extension
_("Text files (*.txt)|*.txt|" "All files (*.*)|*.*"),
0, // Flags
this); // Parent
if (fileName != "") {
path =::wxPathOnly(fileName);
gPrefs->Write("/DefaultOpenPath", path);
wxTextFile f;
f.Open(fileName);
if (!f.IsOpened()) {
wxMessageBox(_("Could not open file: ") + fileName);
return;
}
LabelTrack *newTrack = new LabelTrack(&mDirManager);
newTrack->Import(f);
SelectNone();
mTracks->Add(newTrack);
newTrack->SetSelected(true);
PushState(wxString::
Format(_("Imported labels from '%s'"), fileName.c_str()));
FixScrollbars();
mTrackPanel->Refresh(false);
}
}