本文整理汇总了C++中wxFileName::SetExt方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::SetExt方法的具体用法?C++ wxFileName::SetExt怎么用?C++ wxFileName::SetExt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::SetExt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LibraryFileBrowser
bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
const wxString& wildcard, const wxString& ext,
bool isDirectory )
{
wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
aFilename.SetExt( ext );
#ifndef __WXMAC__
if( isDirectory && doOpen )
{
wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
aFilename = dlg.GetPath();
aFilename.SetExt( ext );
}
else
#endif
{
wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
: wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
aFilename = dlg.GetPath();
aFilename.SetExt( ext );
}
return true;
}
示例2: OpenRescueLibrary
/**
* Function OpenRescueLibrary
* Creates the new rescue library. Must be called before calling any PerformAction()s.
*/
static void OpenRescueLibrary()
{
wxFileName fn( g_RootSheet->GetScreen()->GetFileName() );
fn.SetName( fn.GetName() + wxT( "-rescue" ) );
fn.SetExt( SchematicLibraryFileExtension );
m_library_fn.SetPath( fn.GetPath() );
m_library_fn.SetName( fn.GetName() );
m_library_fn.SetExt( wxT( "lib" ) );
std::unique_ptr<PART_LIB> rescue_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA,
fn.GetFullPath() ) );
m_rescue_lib = std::move( rescue_lib );
}
示例3: noUpdates
void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
{
static wxFileName fn; // Remember path between saves during this session only.
wxString FullFileName;
wxString file_ext, mask;
bool fmt_is_jpeg = false;
// First time path is set to the project path.
if( !fn.IsOk() )
fn = Parent()->Prj().GetProjectFullName();
if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
fmt_is_jpeg = true;
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext;
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "3D Image File Name:" ), fn.GetPath(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
if( FullFileName.IsEmpty() )
return;
fn = FullFileName;
// Be sure the screen area destroyed by the file dialog is redrawn before making
// a screen copy.
// Without this call, under Linux the screen refresh is made to late.
wxYield();
}
struct viewport_params
{
GLint originx;
GLint originy;
GLint x;
GLint y;
} viewport;
// Be sure we have the latest 3D view (remember 3D view is buffered)
Refresh();
wxYield();
// Build image from the 3D buffer
wxWindowUpdateLocker noUpdates( this );
glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );
unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
unsigned char* alphabuffer = (unsigned char*) malloc( viewport.x * viewport.y );
wxImage image( viewport.x, viewport.y );
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
glReadBuffer( GL_BACK_LEFT );
glReadPixels( viewport.originx, viewport.originy,
viewport.x, viewport.y,
GL_RGB, GL_UNSIGNED_BYTE, pixelbuffer );
glReadPixels( viewport.originx, viewport.originy,
viewport.x, viewport.y,
GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer );
image.SetData( pixelbuffer );
image.SetAlpha( alphabuffer );
image = image.Mirror( false );
wxBitmap bitmap( image );
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
if( wxTheClipboard->Open() )
{
wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
if( !wxTheClipboard->SetData( dobjBmp ) )
wxMessageBox( _( "Failed to copy image to clipboard" ) );
wxTheClipboard->Flush(); /* the data in clipboard will stay
* available after the application exits */
wxTheClipboard->Close();
}
}
else
{
wxImage image = bitmap.ConvertToImage();
if( !image.SaveFile( FullFileName,
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
wxMessageBox( _( "Can't save file" ) );
image.Destroy();
}
}
示例4: noUpdates
void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
{
wxString fullFileName;
bool fmt_is_jpeg = false;
if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
fmt_is_jpeg = true;
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
// Remember path between saves during this session only.
static wxFileName fn;
const wxString file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
const wxString mask = wxT( "*." ) + file_ext;
// First time path is set to the project path.
if( !fn.IsOk() )
fn = Parent()->Prj().GetProjectFullName();
fn.SetExt( file_ext );
fullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(),
m_defaultFileName, file_ext, mask, this,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
if( fullFileName.IsEmpty() )
return;
fn = fullFileName;
// Be sure the screen area destroyed by the file dialog is redrawn
// before making a screen copy.
// Without this call, under Linux the screen refresh is made to late.
wxYield();
}
// Be sure we have the latest 3D view (remember 3D view is buffered)
Refresh();
wxYield();
// Build image from the 3D buffer
wxWindowUpdateLocker noUpdates( this );
wxImage screenshotImage;
if( m_canvas )
m_canvas->GetScreenshot( screenshotImage );
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
wxBitmap bitmap( screenshotImage );
if( wxTheClipboard->Open() )
{
wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
if( !wxTheClipboard->SetData( dobjBmp ) )
wxMessageBox( _( "Failed to copy image to clipboard" ) );
wxTheClipboard->Flush(); /* the data in clipboard will stay
* available after the application exits */
wxTheClipboard->Close();
}
}
else
{
if( !screenshotImage.SaveFile( fullFileName,
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
wxMessageBox( _( "Can't save file" ) );
screenshotImage.Destroy();
}
}
示例5: Create_BOM_Lists
void DIALOG_BUILD_BOM::Create_BOM_Lists( int aTypeFile,
bool aIncludeSubComponents,
char aExportSeparatorSymbol,
bool aRunBrowser )
{
wxString wildcard;
static wxFileName fn;
wxFileName current = g_RootSheet->GetScreen()->GetFileName();
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
if( !fn.HasName() || fn.GetName()==NAMELESS_PROJECT )
{
fn.SetName( current.GetName() );
}
// else use a previous run's name, because fn was set before and user
// is probably just iteratively refining the BOM.
if( fn.GetPath().IsEmpty() )
{
fn.SetPath( current.GetPath() );
}
// else use a previous run's path, because fn was set before and user
// is probably just iteratively refining the BOM.
wxString bomDesc = _( "Bill of Materials" ); // translate once, use twice.
if( aTypeFile == 0 )
{
fn.SetExt( wxT( "lst" ) );
wildcard = bomDesc + wxT( " (*.lst)|*.lst" );
}
else
{
fn.SetExt( wxT( "csv" ) );
wildcard = bomDesc + wxT( " (*.csv)|*.csv" );
}
wxFileDialog dlg( this, bomDesc, fn.GetPath(),
fn.GetFullName(), wildcard, wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fn = dlg.GetPath(); // remember path+filename+ext for subsequent runs.
m_listFileName = dlg.GetPath();
// Close dialog, then show the list (if so requested)
switch( aTypeFile )
{
case 0: // list
CreatePartsAndLabelsFullList( aIncludeSubComponents );
break;
case 1: // spreadsheet, Single Part per line
CreateSpreadSheetPartsFullList( aIncludeSubComponents, s_Add_Location, false );
break;
case 2: // spreadsheet, group Part with same fields per line
CreateSpreadSheetPartsFullList( aIncludeSubComponents, s_Add_Location, true );
break;
case 3: // spreadsheet, one value per line and no sub-component
CreateSpreadSheetPartsShortList();
break;
}
EndModal( 1 );
if( aRunBrowser )
{
wxString editorname = wxGetApp().GetEditorName();
wxString filename = m_listFileName;
AddDelimiterString( filename );
ExecuteFile( this, editorname, filename );
}
}