Footprint editor: add save view to PNG file.
Factor out save current canvas view to image file code from symbol editor code so it can be used anywhere. Add ability to save to any image format supported by wxBitmapType. See https://docs.wxwidgets.org/3.0/gdicmn_8h.html#a90a1eb6d85b5044a99b706fd979f27f5. Currently only PNG output is implemented. Please note that there is a minor bug that appears to be due to the scroll bars which causes unfilled areas on the right and bottom edges of the image. This always existed in the save symbol editor view image but it was not as noticeable because by default the background color is white. It is very noticeable in the footprint editor with a black background. The usual smattering of coding policy and comment fixes. Fixes lp:1802127 https://bugs.launchpad.net/kicad/+bug/1802127
This commit is contained in:
parent
6860320b1b
commit
f1f4473d8b
|
@ -38,6 +38,7 @@
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <eda_base_frame.h>
|
#include <eda_base_frame.h>
|
||||||
|
#include <draw_frame.h>
|
||||||
|
|
||||||
|
|
||||||
struct SCALED_BITMAP_ID {
|
struct SCALED_BITMAP_ID {
|
||||||
|
@ -191,6 +192,34 @@ wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SaveCanvasImageToFile( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
|
||||||
|
wxBitmapType aBitmapType )
|
||||||
|
{
|
||||||
|
wxCHECK( aFrame != nullptr, false );
|
||||||
|
|
||||||
|
bool retv = true;
|
||||||
|
|
||||||
|
// Make a screen copy of the canvas:
|
||||||
|
wxSize image_size = aFrame->GetGalCanvas()->GetClientSize();
|
||||||
|
|
||||||
|
wxClientDC dc( aFrame->GetGalCanvas() );
|
||||||
|
wxBitmap bitmap( image_size.x, image_size.y );
|
||||||
|
wxMemoryDC memdc;
|
||||||
|
|
||||||
|
memdc.SelectObject( bitmap );
|
||||||
|
memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
|
||||||
|
memdc.SelectObject( wxNullBitmap );
|
||||||
|
|
||||||
|
wxImage image = bitmap.ConvertToImage();
|
||||||
|
|
||||||
|
if( !image.SaveFile( aFileName, aBitmapType ) )
|
||||||
|
retv = false;
|
||||||
|
|
||||||
|
image.Destroy();
|
||||||
|
return retv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
||||||
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL )
|
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -273,6 +273,7 @@ void EDA_DRAW_FRAME::unitsChangeRefresh()
|
||||||
UpdateMsgPanel();
|
UpdateMsgPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::CommonSettingsChanged()
|
void EDA_DRAW_FRAME::CommonSettingsChanged()
|
||||||
{
|
{
|
||||||
EDA_BASE_FRAME::CommonSettingsChanged();
|
EDA_BASE_FRAME::CommonSettingsChanged();
|
||||||
|
@ -348,6 +349,7 @@ void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
||||||
{
|
{
|
||||||
// Checks all the toolbars and returns true if the given tool id is toggled.
|
// Checks all the toolbars and returns true if the given tool id is toggled.
|
||||||
|
@ -463,7 +465,9 @@ bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName )
|
|
||||||
|
int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||||
|
wxString* aFullFileName )
|
||||||
{
|
{
|
||||||
int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
|
int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
|
||||||
|
|
||||||
|
@ -473,6 +477,7 @@ int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxSt
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -634,6 +639,7 @@ void EDA_DRAW_FRAME::SetNoToolSelected()
|
||||||
SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
{
|
{
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
@ -743,6 +749,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
|
||||||
DisplayUnitsMsg();
|
DisplayUnitsMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
|
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
@ -873,6 +880,7 @@ void EDA_DRAW_FRAME::UpdateMsgPanel()
|
||||||
SetMsgPanel( item );
|
SetMsgPanel( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME: There needs to be a better way for child windows to load preferences.
|
// FIXME: There needs to be a better way for child windows to load preferences.
|
||||||
// This function pushes four preferences from a parent window to a child window
|
// This function pushes four preferences from a parent window to a child window
|
||||||
// i.e. from eeschema to the schematic symbol editor
|
// i.e. from eeschema to the schematic symbol editor
|
||||||
|
@ -882,6 +890,7 @@ void EDA_DRAW_FRAME::PushPreferences( const EDA_DRAW_PANEL* aParentCanvas )
|
||||||
m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
|
m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
|
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
|
||||||
int aExplicitCommand )
|
int aExplicitCommand )
|
||||||
{
|
{
|
||||||
|
@ -1085,7 +1094,8 @@ wxPoint EDA_DRAW_FRAME::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize ) const
|
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition,
|
||||||
|
wxRealPoint* aGridSize ) const
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = GetScreen(); // virtual call
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
|
return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
|
||||||
|
@ -1156,6 +1166,7 @@ void EDA_DRAW_FRAME::RefreshCrossHair( const wxPoint &aOldPos,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos,
|
bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos,
|
||||||
bool aSnapToGrid )
|
bool aSnapToGrid )
|
||||||
{
|
{
|
||||||
|
@ -1265,11 +1276,13 @@ bool EDA_DRAW_FRAME::isBusy() const
|
||||||
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BOX2I EDA_DRAW_FRAME::GetDocumentExtents() const
|
const BOX2I EDA_DRAW_FRAME::GetDocumentExtents() const
|
||||||
{
|
{
|
||||||
return BOX2I();
|
return BOX2I();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
|
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1541,6 +1554,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
|
||||||
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
|
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
||||||
|
|
||||||
|
|
||||||
|
@ -1775,3 +1789,9 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_DRAW_FRAME::saveCanvasImageToFile( const wxString& aFileName, wxBitmapType aBitmapType )
|
||||||
|
{
|
||||||
|
return SaveCanvasImageToFile( this, aFileName, aBitmapType );
|
||||||
|
}
|
||||||
|
|
|
@ -351,6 +351,7 @@ void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
||||||
{
|
{
|
||||||
// Checks all the toolbars and returns true if the given tool id is toggled.
|
// Checks all the toolbars and returns true if the given tool id is toggled.
|
||||||
|
@ -467,7 +468,8 @@ bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName )
|
int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||||
|
wxString* aFullFileName )
|
||||||
{
|
{
|
||||||
int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
|
int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
|
||||||
|
|
||||||
|
@ -608,7 +610,6 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||||
{
|
{
|
||||||
m_FrameSize = GetClientSize( );
|
m_FrameSize = GetClientSize( );
|
||||||
|
@ -657,6 +658,7 @@ void EDA_DRAW_FRAME::SetNoToolSelected()
|
||||||
SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
{
|
{
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
@ -762,6 +764,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
|
||||||
DisplayUnitsMsg();
|
DisplayUnitsMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
|
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
@ -900,6 +903,7 @@ void EDA_DRAW_FRAME::UpdateMsgPanel()
|
||||||
SetMsgPanel( item );
|
SetMsgPanel( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME: There needs to be a better way for child windows to load preferences.
|
// FIXME: There needs to be a better way for child windows to load preferences.
|
||||||
// This function pushes four preferences from a parent window to a child window
|
// This function pushes four preferences from a parent window to a child window
|
||||||
// i.e. from eeschema to the schematic symbol editor
|
// i.e. from eeschema to the schematic symbol editor
|
||||||
|
@ -909,8 +913,9 @@ void EDA_DRAW_FRAME::PushPreferences( const EDA_DRAW_PANEL* aParentCanvas )
|
||||||
m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
|
m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
|
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
|
||||||
int aExplicitCommand )
|
int aExplicitCommand )
|
||||||
{
|
{
|
||||||
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
||||||
|
|
||||||
|
@ -1560,6 +1565,7 @@ bool EDA_DRAW_FRAME::isBusy() const
|
||||||
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
|
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
|
||||||
{
|
{
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
|
@ -1856,8 +1862,10 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
|
||||||
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
|
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
|
void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DrawPageOnClipboard( this );
|
DrawPageOnClipboard( this );
|
||||||
|
@ -1903,6 +1911,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
|
||||||
wxSize dcsize = DrawArea.GetSize();
|
wxSize dcsize = DrawArea.GetSize();
|
||||||
|
|
||||||
int maxdim = std::max( dcsize.x, dcsize.y );
|
int maxdim = std::max( dcsize.x, dcsize.y );
|
||||||
|
|
||||||
// the max size in pixels of the bitmap used to byuild the sheet copy
|
// the max size in pixels of the bitmap used to byuild the sheet copy
|
||||||
const int maxbitmapsize = 3000;
|
const int maxbitmapsize = 3000;
|
||||||
|
|
||||||
|
@ -2006,8 +2015,8 @@ void DrawPageLayout( wxDC* aDC, EDA_RECT* aClipBox,
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
|
void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
|
||||||
double aScalar, const wxString &aFilename,
|
double aScalar, const wxString &aFilename,
|
||||||
const wxString &aSheetLayer )
|
const wxString &aSheetLayer )
|
||||||
{
|
{
|
||||||
if( !m_showBorderAndTitleBlock )
|
if( !m_showBorderAndTitleBlock )
|
||||||
return;
|
return;
|
||||||
|
@ -2055,9 +2064,16 @@ wxString EDA_DRAW_FRAME::GetScreenDesc() const
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BOX2I EDA_DRAW_FRAME::GetDocumentExtents() const
|
const BOX2I EDA_DRAW_FRAME::GetDocumentExtents() const
|
||||||
{
|
{
|
||||||
BOX2I rv;
|
BOX2I rv;
|
||||||
rv.SetMaximum();
|
rv.SetMaximum();
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_DRAW_FRAME::saveCanvasImageToFile( const wxString& aFileName, wxBitmapType aBitmapType )
|
||||||
|
{
|
||||||
|
return SaveCanvasImageToFile( this, aFileName, aBitmapType );
|
||||||
|
}
|
||||||
|
|
|
@ -672,11 +672,12 @@ public:
|
||||||
void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
|
void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an image (screenshot) of the current component in PNG or JPEG format.
|
* Creates an image (screenshot) of the current symbol.
|
||||||
|
*
|
||||||
* @param aFileName = the full filename
|
* @param aFileName = the full filename
|
||||||
* @param aFmt_jpeg = true to use JPEG file format, false to use PNG file format
|
* @param aBitmapType = bitmap file format
|
||||||
*/
|
*/
|
||||||
void CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg );
|
void CreateImageFile( const wxString& aFileName, wxBitmapType aBitmapType = wxBITMAP_TYPE_PNG );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a page
|
* Print a page
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <eeschema_id.h>
|
#include <eeschema_id.h>
|
||||||
#include <sch_screen.h>
|
#include <sch_screen.h>
|
||||||
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
|
@ -59,87 +60,68 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
|
||||||
switch( event.GetId() )
|
switch( event.GetId() )
|
||||||
{
|
{
|
||||||
case ID_LIBEDIT_GEN_PNG_FILE:
|
case ID_LIBEDIT_GEN_PNG_FILE:
|
||||||
{
|
{
|
||||||
bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
|
mask = wxT( "*." ) + file_ext;
|
||||||
|
wxFileName fn( part->GetName() );
|
||||||
|
fn.SetExt( "png" );
|
||||||
|
|
||||||
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
|
wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
mask = wxT( "*." ) + file_ext;
|
|
||||||
wxFileName fn( part->GetName() );
|
|
||||||
fn.SetExt( file_ext );
|
|
||||||
|
|
||||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
wxFileDialog dlg( this, _( "Image File Name" ), projectPath,
|
||||||
|
fn.GetFullName(), PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
|
||||||
fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir,
|
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
|
||||||
fn.GetFullName(), file_ext, mask, this,
|
return;
|
||||||
wxFD_SAVE, true );
|
|
||||||
|
|
||||||
if( fullFileName.IsEmpty() )
|
// calling wxYield is mandatory under Linux, after closing the file selector dialog
|
||||||
return;
|
// to refresh the screen before creating the PNG or JPEG image from screen
|
||||||
|
wxYield();
|
||||||
// calling wxYield is mandatory under Linux, after closing the file selector dialog
|
CreateImageFile( dlg.GetPath(), wxBITMAP_TYPE_PNG );
|
||||||
// to refresh the screen before creating the PNG or JPEG image from screen
|
}
|
||||||
wxYield();
|
|
||||||
CreatePNGorJPEGFile( fullFileName, fmt_is_jpeg );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_GEN_SVG_FILE:
|
case ID_LIBEDIT_GEN_SVG_FILE:
|
||||||
{
|
{
|
||||||
file_ext = wxT( "svg" );
|
file_ext = wxT( "svg" );
|
||||||
mask = wxT( "*." ) + file_ext;
|
mask = wxT( "*." ) + file_ext;
|
||||||
wxFileName fn( part->GetName() );
|
wxFileName fn( part->GetName() );
|
||||||
fn.SetExt( file_ext );
|
fn.SetExt( file_ext );
|
||||||
|
|
||||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
|
|
||||||
fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir,
|
fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir,
|
||||||
fn.GetFullName(), file_ext, mask, this,
|
fn.GetFullName(), file_ext, mask, this,
|
||||||
wxFD_SAVE, true );
|
wxFD_SAVE, true );
|
||||||
|
|
||||||
if( fullFileName.IsEmpty() )
|
if( fullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
|
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
|
||||||
PAGE_INFO pageTemp = pageSave;
|
PAGE_INFO pageTemp = pageSave;
|
||||||
|
|
||||||
wxSize componentSize = part->GetUnitBoundingBox( m_unit, m_convert ).GetSize();
|
wxSize componentSize = part->GetUnitBoundingBox( m_unit, m_convert ).GetSize();
|
||||||
|
|
||||||
// Add a small margin to the plot bounding box
|
// Add a small margin to the plot bounding box
|
||||||
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
|
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
|
||||||
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
|
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
|
||||||
|
|
||||||
GetScreen()->SetPageSettings( pageTemp );
|
GetScreen()->SetPageSettings( pageTemp );
|
||||||
SVG_PlotComponent( fullFileName );
|
SVG_PlotComponent( fullFileName );
|
||||||
GetScreen()->SetPageSettings( pageSave );
|
GetScreen()->SetPageSettings( pageSave );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg )
|
void LIB_EDIT_FRAME::CreateImageFile( const wxString& aFileName, wxBitmapType aBitmapType )
|
||||||
{
|
{
|
||||||
// Make a screen copy of the canvas:
|
if( !saveCanvasImageToFile( aFileName, aBitmapType ) )
|
||||||
wxSize image_size = GetGalCanvas()->GetClientSize();
|
|
||||||
|
|
||||||
wxClientDC dc( GetGalCanvas() );
|
|
||||||
wxBitmap bitmap( image_size.x, image_size.y );
|
|
||||||
wxMemoryDC memdc;
|
|
||||||
|
|
||||||
memdc.SelectObject( bitmap );
|
|
||||||
memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
|
|
||||||
memdc.SelectObject( wxNullBitmap );
|
|
||||||
|
|
||||||
wxImage image = bitmap.ConvertToImage();
|
|
||||||
|
|
||||||
if( !image.SaveFile( aFileName, aFmt_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "Can't save file \"%s\"" ), GetChars( aFileName ) );
|
msg.Printf( _( "Can't save file \"%s\"." ), aFileName );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
image.Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,7 +174,8 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
|
||||||
delete plotter;
|
delete plotter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData)
|
|
||||||
|
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
|
||||||
{
|
{
|
||||||
LIB_PART* part = GetCurPart();
|
LIB_PART* part = GetCurPart();
|
||||||
|
|
||||||
|
@ -206,8 +189,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMod
|
||||||
* So we must plot it with an offset = pagesize/2.
|
* So we must plot it with an offset = pagesize/2.
|
||||||
*/
|
*/
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
plot_offset.x = pagesize.x/2;
|
plot_offset.x = pagesize.x / 2;
|
||||||
plot_offset.y = pagesize.y/2;
|
plot_offset.y = pagesize.y / 2;
|
||||||
|
|
||||||
part->Draw( m_canvas, aDC, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS::Default() );
|
part->Draw( m_canvas, aDC, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS::Default() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,12 @@
|
||||||
// #include <wx/bitmap.h> // only to define wxBitmap
|
// #include <wx/bitmap.h> // only to define wxBitmap
|
||||||
class wxBitmap; // only to define wxBitmap
|
class wxBitmap; // only to define wxBitmap
|
||||||
class EDA_BASE_FRAME;
|
class EDA_BASE_FRAME;
|
||||||
|
class EDA_DRAW_FRAME;
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
class wxAuiToolBar;
|
class wxAuiToolBar;
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <wx/gdicmn.h> // wxBitmapType
|
||||||
|
|
||||||
|
|
||||||
/// PNG memory record (file in memory).
|
/// PNG memory record (file in memory).
|
||||||
|
@ -46,7 +48,7 @@ struct BITMAP_OPAQUE
|
||||||
};
|
};
|
||||||
|
|
||||||
// declared as single element _array_, so its name assigns to pointer
|
// declared as single element _array_, so its name assigns to pointer
|
||||||
#define EXTERN_BITMAP(x) extern const BITMAP_OPAQUE x[1];
|
#define EXTERN_BITMAP( x ) extern const BITMAP_OPAQUE x[1];
|
||||||
|
|
||||||
|
|
||||||
/// a BITMAP_DEF is really a const pointer to an opaque
|
/// a BITMAP_DEF is really a const pointer to an opaque
|
||||||
|
@ -55,16 +57,14 @@ typedef const BITMAP_OPAQUE *BITMAP_DEF;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function KiBitmap
|
* Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
|
||||||
* constructs a wxBitmap from a memory record, held in a
|
|
||||||
* BITMAP_DEF.
|
|
||||||
*/
|
*/
|
||||||
wxBitmap KiBitmap( BITMAP_DEF aBitmap );
|
wxBitmap KiBitmap( BITMAP_DEF aBitmap );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function KiScaledBitmap
|
* Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
|
||||||
* Constructs a wxBitmap from a memory record, scaling it if device DPI demands it.
|
*
|
||||||
* Internally this may use caching to avoid scaling the same image twice. If caching
|
* Internally this may use caching to avoid scaling the same image twice. If caching
|
||||||
* is used, it's guaranteed threadsafe.
|
* is used, it's guaranteed threadsafe.
|
||||||
*
|
*
|
||||||
|
@ -74,8 +74,7 @@ wxBitmap KiBitmap( BITMAP_DEF aBitmap );
|
||||||
wxBitmap KiScaledBitmap( BITMAP_DEF aBitmap, EDA_BASE_FRAME* aWindow );
|
wxBitmap KiScaledBitmap( BITMAP_DEF aBitmap, EDA_BASE_FRAME* aWindow );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function KiScaledBitmap
|
* Overload of the above function that takes another wxBitmap as a parameter.
|
||||||
* Overload of the above function that takes another wxBitmap as a parameter
|
|
||||||
*
|
*
|
||||||
* @param aBitmap bitmap definition
|
* @param aBitmap bitmap definition
|
||||||
* @param aWindow target window for scaling context
|
* @param aWindow target window for scaling context
|
||||||
|
@ -83,27 +82,32 @@ wxBitmap KiScaledBitmap( BITMAP_DEF aBitmap, EDA_BASE_FRAME* aWindow );
|
||||||
wxBitmap KiScaledBitmap( const wxBitmap& aBitmap, EDA_BASE_FRAME* aWindow );
|
wxBitmap KiScaledBitmap( const wxBitmap& aBitmap, EDA_BASE_FRAME* aWindow );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function KiScaledSeparator
|
* Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
|
||||||
* Adds a separator to the given toolbar scaled the same way as KiScaledBitmap.
|
|
||||||
*/
|
*/
|
||||||
void KiScaledSeparator( wxAuiToolBar* aToolbar, EDA_BASE_FRAME* aWindow );
|
void KiScaledSeparator( wxAuiToolBar* aToolbar, EDA_BASE_FRAME* aWindow );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function KiIconScale
|
* Return the automatic scale factor that would be used for a given window by
|
||||||
* Returns the automatic scale factor that would be used for a given window by
|
|
||||||
* KiScaledBitmap and KiScaledSeparator.
|
* KiScaledBitmap and KiScaledSeparator.
|
||||||
*/
|
*/
|
||||||
int KiIconScale( wxWindow* aWindow );
|
int KiIconScale( wxWindow* aWindow );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function KiBitmapNew
|
* Allocate a wxBitmap on heap from a memory record, held in a BITMAP_DEF.
|
||||||
* allocates a wxBitmap on heap from a memory record, held in a
|
|
||||||
* BITMAP_DEF.
|
|
||||||
*
|
*
|
||||||
* @return wxBitmap* - caller owns it.
|
* @return wxBitmap* - caller owns it.
|
||||||
*/
|
*/
|
||||||
wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap );
|
wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the current view as an image file.
|
||||||
|
*
|
||||||
|
* @param aFrame The current draw frame view to save.
|
||||||
|
* @param aFileName The file name to save the image. This will overwrite an exisiting file.
|
||||||
|
* @param aBitmapType The type of bitmap create as defined by wxImage.
|
||||||
|
* @return True if the file was successfully saved or false if the file failed to be saved.
|
||||||
|
*/
|
||||||
|
bool SaveCanvasImageToFile( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
|
||||||
|
wxBitmapType aBitmapType = wxBITMAP_TYPE_PNG );
|
||||||
|
|
||||||
#endif // BITMAP_TYPES_H_
|
#endif // BITMAP_TYPES_H_
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -72,8 +72,7 @@ static const wxString LastGridSizeIdKeyword( wxT( "_LastGridSize" ) );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class EDA_DRAW_FRAME
|
* The base class for create windows for drawing purpose. The Eeschema, Pcbnew and
|
||||||
* is the base class for create windows for drawing purpose. The Eeschema, Pcbnew and
|
|
||||||
* GerbView main windows are just a few examples of classes derived from EDA_DRAW_FRAME.
|
* GerbView main windows are just a few examples of classes derived from EDA_DRAW_FRAME.
|
||||||
*/
|
*/
|
||||||
class EDA_DRAW_FRAME : public KIWAY_PLAYER
|
class EDA_DRAW_FRAME : public KIWAY_PLAYER
|
||||||
|
@ -184,8 +183,7 @@ protected:
|
||||||
double bestZoom( double sizeX, double sizeY, double scaleFactor, wxPoint centre );
|
double bestZoom( double sizeX, double sizeY, double scaleFactor, wxPoint centre );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function unitsChangeRefresh
|
* Called when when the units setting has changed to allow for any derived classes
|
||||||
* is called when when the units setting has changed to allow for any derived classes
|
|
||||||
* to handle refreshing and controls that have units based measurements in them. The
|
* to handle refreshing and controls that have units based measurements in them. The
|
||||||
* default version only updates the status bar. Don't forget to call the default
|
* default version only updates the status bar. Don't forget to call the default
|
||||||
* in your derived class or the status bar will not get updated properly.
|
* in your derived class or the status bar will not get updated properly.
|
||||||
|
@ -195,22 +193,21 @@ protected:
|
||||||
void CommonSettingsChanged() override;
|
void CommonSettingsChanged() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function LibraryFileBrowser
|
* @param doOpen if true runs an Open Library browser, otherwise New Library
|
||||||
* @param doOpen if true runs an Open Library browser, otherwise New Library
|
* @param aFilename for New may contain a default name; in both cases return the chosen
|
||||||
* @param aFilename for New may contain a default name; in both cases return the chosen
|
* filename.
|
||||||
* filename.
|
* @param wildcard a wildcard to filter the displayed files
|
||||||
* @param wildcard a wildcard to filter the displayed files
|
* @param ext the library file extension
|
||||||
* @param ext the library file extension
|
* @param isDirectory indicates the library files are directories
|
||||||
* @param isDirectory indicates the library files are directories
|
* @return true for OK; false for Cancel.
|
||||||
* @return true for OK; false for Cancel.
|
*/
|
||||||
*/
|
|
||||||
bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
||||||
const wxString& wildcard, const wxString& ext, bool isDirectory );
|
const wxString& wildcard, const wxString& ext, bool isDirectory );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GeneralControlKeyMovement
|
|
||||||
* Handle the common part of GeneralControl dedicated to global
|
* Handle the common part of GeneralControl dedicated to global
|
||||||
* cursor keys (i.e. cursor movement by keyboard)
|
* cursor keys (i.e. cursor movement by keyboard)
|
||||||
|
*
|
||||||
* @param aHotKey is the hotkey code
|
* @param aHotKey is the hotkey code
|
||||||
* @param aPos is the position of the cursor (initial then new)
|
* @param aPos is the position of the cursor (initial then new)
|
||||||
* @param aSnapToGrid = true to force the cursor position on grid
|
* @param aSnapToGrid = true to force the cursor position on grid
|
||||||
|
@ -233,6 +230,9 @@ protected:
|
||||||
*/
|
*/
|
||||||
bool saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
bool saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
||||||
|
|
||||||
|
bool saveCanvasImageToFile( const wxString& aFileName,
|
||||||
|
wxBitmapType aBitmapType = wxBITMAP_TYPE_PNG );
|
||||||
|
|
||||||
///> Key in KifaceSettings to store the canvas type.
|
///> Key in KifaceSettings to store the canvas type.
|
||||||
static const wxChar CANVAS_TYPE_KEY[];
|
static const wxChar CANVAS_TYPE_KEY[];
|
||||||
|
|
||||||
|
@ -246,7 +246,9 @@ public:
|
||||||
|
|
||||||
~EDA_DRAW_FRAME();
|
~EDA_DRAW_FRAME();
|
||||||
|
|
||||||
/** this function capture the key event before it is sent to the GUI.
|
/**
|
||||||
|
* Capture the key event before it is sent to the GUI.
|
||||||
|
*
|
||||||
* the basic frame does not capture this event.
|
* the basic frame does not capture this event.
|
||||||
* editor frames should override this event function to capture and filter
|
* editor frames should override this event function to capture and filter
|
||||||
* these keys when they are used as hotkeys, and skip it if the key is not
|
* these keys when they are used as hotkeys, and skip it if the key is not
|
||||||
|
@ -255,15 +257,14 @@ public:
|
||||||
virtual void OnCharHook( wxKeyEvent& event );
|
virtual void OnCharHook( wxKeyEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function LockFile
|
* Mark a schematic file as being in use. Use ReleaseFile() to undo this.
|
||||||
* marks a schematic file as being in use. Use ReleaseFile() to undo this.
|
*
|
||||||
* @param aFileName = full path to the file.
|
* @param aFileName = full path to the file.
|
||||||
* @return false if the file was already locked, true otherwise.
|
* @return false if the file was already locked, true otherwise.
|
||||||
*/
|
*/
|
||||||
bool LockFile( const wxString& aFileName );
|
bool LockFile( const wxString& aFileName );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReleaseFile
|
|
||||||
* Release the current file marked in use. See m_file_checker.
|
* Release the current file marked in use. See m_file_checker.
|
||||||
*/
|
*/
|
||||||
void ReleaseFile();
|
void ReleaseFile();
|
||||||
|
@ -272,29 +273,25 @@ public:
|
||||||
virtual const PAGE_INFO& GetPageSettings() const = 0;
|
virtual const PAGE_INFO& GetPageSettings() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetPageSizeIU
|
* Works off of GetPageSettings() to return the size of the paper page in
|
||||||
* works off of GetPageSettings() to return the size of the paper page in
|
|
||||||
* the internal units of this particular view.
|
* the internal units of this particular view.
|
||||||
*/
|
*/
|
||||||
virtual const wxSize GetPageSizeIU() const = 0;
|
virtual const wxSize GetPageSizeIU() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetUserUnits
|
* Return the user units currently in use.
|
||||||
* returns the user units currently in use
|
|
||||||
*/
|
*/
|
||||||
EDA_UNITS_T GetUserUnits() const override { return m_UserUnits; }
|
EDA_UNITS_T GetUserUnits() const override { return m_UserUnits; }
|
||||||
void SetUserUnits( EDA_UNITS_T aUnits ) { m_UserUnits = aUnits; }
|
void SetUserUnits( EDA_UNITS_T aUnits ) { m_UserUnits = aUnits; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetAuxOrigin
|
* Return the origin of the axis used for plotting and various exports.
|
||||||
* returns the origin of the axis used for plotting and various exports.
|
|
||||||
*/
|
*/
|
||||||
virtual const wxPoint& GetAuxOrigin() const = 0;
|
virtual const wxPoint& GetAuxOrigin() const = 0;
|
||||||
virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
|
virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGridOrigin
|
* Return the absolute coordinates of the origin of the snap grid. This is
|
||||||
* returns the absolute coordinates of the origin of the snap grid. This is
|
|
||||||
* treated as a relative offset, and snapping will occur at multiples of the grid
|
* treated as a relative offset, and snapping will occur at multiples of the grid
|
||||||
* size relative to this point.
|
* size relative to this point.
|
||||||
*/
|
*/
|
||||||
|
@ -306,26 +303,25 @@ public:
|
||||||
|
|
||||||
//-----<BASE_SCREEN API moved here>------------------------------------------
|
//-----<BASE_SCREEN API moved here>------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Function GetCrossHairPosition
|
* Return the current cross hair position in logical (drawing) coordinates.
|
||||||
* return the current cross hair position in logical (drawing) coordinates.
|
*
|
||||||
* @param aInvertY Inverts the Y axis position.
|
* @param aInvertY Inverts the Y axis position.
|
||||||
* @return The cross hair position in drawing coordinates.
|
* @return The cross hair position in drawing coordinates.
|
||||||
*/
|
*/
|
||||||
wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
|
wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetCrossHairPosition
|
* Set the screen cross hair position to \a aPosition in logical (drawing) units.
|
||||||
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
|
*
|
||||||
* @param aPosition The new cross hair position.
|
* @param aPosition The new cross hair position.
|
||||||
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
||||||
* \a aPosition.
|
* \a aPosition.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
|
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetCursorPosition
|
* Return the current cursor position in logical (drawing) units.
|
||||||
* returns the current cursor position in logical (drawing) units.
|
*
|
||||||
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
||||||
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
||||||
* if \a aOnGrid is true.
|
* if \a aOnGrid is true.
|
||||||
|
@ -334,8 +330,8 @@ public:
|
||||||
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
|
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNearestGridPosition
|
* Return the nearest \a aGridSize location to \a aPosition.
|
||||||
* returns the nearest \a aGridSize location to \a aPosition.
|
*
|
||||||
* @param aPosition The position to check.
|
* @param aPosition The position to check.
|
||||||
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
||||||
* grid size is used.
|
* grid size is used.
|
||||||
|
@ -344,8 +340,8 @@ public:
|
||||||
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
|
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetCursorScreenPosition
|
* Return the cross hair position in device (display) units.b
|
||||||
* returns the cross hair position in device (display) units.b
|
*
|
||||||
* @return The current cross hair position.
|
* @return The current cross hair position.
|
||||||
*/
|
*/
|
||||||
wxPoint GetCrossHairScreenPosition() const;
|
wxPoint GetCrossHairScreenPosition() const;
|
||||||
|
@ -353,7 +349,6 @@ public:
|
||||||
void SetMousePosition( const wxPoint& aPosition );
|
void SetMousePosition( const wxPoint& aPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function RefPos
|
|
||||||
* Return the reference position, coming from either the mouse position
|
* Return the reference position, coming from either the mouse position
|
||||||
* or the cursor position.
|
* or the cursor position.
|
||||||
*
|
*
|
||||||
|
@ -369,7 +364,6 @@ public:
|
||||||
|
|
||||||
//-----</BASE_SCREEN API moved here>-----------------------------------------
|
//-----</BASE_SCREEN API moved here>-----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
|
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
|
||||||
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
|
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
|
||||||
|
|
||||||
|
@ -396,8 +390,7 @@ public:
|
||||||
virtual wxString GetScreenDesc() const;
|
virtual wxString GetScreenDesc() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetScreen
|
* Return a pointer to a BASE_SCREEN or one of its
|
||||||
* returns a pointer to a BASE_SCREEN or one of its
|
|
||||||
* derivatives. It is overloaded by derived classes to return
|
* derivatives. It is overloaded by derived classes to return
|
||||||
* SCH_SCREEN or PCB_SCREEN.
|
* SCH_SCREEN or PCB_SCREEN.
|
||||||
*/
|
*/
|
||||||
|
@ -418,8 +411,7 @@ public:
|
||||||
void OnMouseEvent( wxMouseEvent& event );
|
void OnMouseEvent( wxMouseEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function SkipNextLeftButtonReleaseEvent
|
* After calling this function, if the left mouse button
|
||||||
* after calling this function, if the left mouse button
|
|
||||||
* is down, the next left mouse button release event will be ignored.
|
* is down, the next left mouse button release event will be ignored.
|
||||||
* It is is usefull for instance when closing a dialog on a mouse click,
|
* It is is usefull for instance when closing a dialog on a mouse click,
|
||||||
* to skip the next mouse left button release event
|
* to skip the next mouse left button release event
|
||||||
|
@ -434,14 +426,12 @@ public:
|
||||||
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
|
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetHotkeyConfig()
|
* Return a structure containing currently used hotkey mapping.
|
||||||
* Returns a structure containing currently used hotkey mapping.
|
|
||||||
*/
|
*/
|
||||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const { return m_hotkeysDescrList; }
|
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const { return m_hotkeysDescrList; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetHotKeyDescription
|
* Search lists of hot key identifiers (HK_xxx) used in the frame to find a matching
|
||||||
* Searches lists of hot key identifiers (HK_xxx) used in the frame to find a matching
|
|
||||||
* hot key descriptor.
|
* hot key descriptor.
|
||||||
* @param aCommand is the hot key identifier.
|
* @param aCommand is the hot key identifier.
|
||||||
* @return Hot key descriptor or NULL if none found.
|
* @return Hot key descriptor or NULL if none found.
|
||||||
|
@ -452,7 +442,6 @@ public:
|
||||||
EDA_ITEM* aItem = NULL );
|
EDA_ITEM* aItem = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function AddMenuZoomAndGrid (virtual)
|
|
||||||
* Add standard zoom commands and submenu zoom and grid selection to a popup menu
|
* Add standard zoom commands and submenu zoom and grid selection to a popup menu
|
||||||
* uses zoom hotkeys info base to add hotkeys info to menu commands
|
* uses zoom hotkeys info base to add hotkeys info to menu commands
|
||||||
* @param aMasterMenu = the menu to populate.
|
* @param aMasterMenu = the menu to populate.
|
||||||
|
@ -460,8 +449,7 @@ public:
|
||||||
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
|
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetZoomLevelIndicator
|
* Return a human readable value which can be displayed as zoom
|
||||||
* returns a human readable value which can be displayed as zoom
|
|
||||||
* level indicator in dialogs.
|
* level indicator in dialogs.
|
||||||
* this can be a percentage or other indicator.
|
* this can be a percentage or other indicator.
|
||||||
* it is virtual because it could be different for pcbnew, gerbview or eeschema
|
* it is virtual because it could be different for pcbnew, gerbview or eeschema
|
||||||
|
@ -471,8 +459,7 @@ public:
|
||||||
virtual const wxString GetZoomLevelIndicator() const;
|
virtual const wxString GetZoomLevelIndicator() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetZoomLevelCoeff
|
* Return the coefficient to convert internal display scale factor to zoom level.
|
||||||
* returns the coefficient to convert internal display scale factor to zoom level.
|
|
||||||
*/
|
*/
|
||||||
inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
|
inline double GetZoomLevelCoeff() const { return m_zoomLevelCoeff; }
|
||||||
|
|
||||||
|
@ -505,12 +492,13 @@ public:
|
||||||
wxAuiToolBarItem* GetToolbarTool( int aToolId );
|
wxAuiToolBarItem* GetToolbarTool( int aToolId );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetToolID
|
* Set the tool command ID to \a aId and sets the cursor to \a aCursor.
|
||||||
* sets the tool command ID to \a aId and sets the cursor to \a aCursor. The
|
*
|
||||||
* command ID must be greater or equal ::ID_NO_TOOL_SELECTED. If the command
|
* The command ID must be greater or equal ::ID_NO_TOOL_SELECTED. If the command
|
||||||
* ID is less than ::ID_NO_TOOL_SELECTED, the tool command ID is set to
|
* ID is less than ::ID_NO_TOOL_SELECTED, the tool command ID is set to
|
||||||
* ::ID_NO_TOOL_SELECTED. On debug builds, an assertion will be raised when
|
* ::ID_NO_TOOL_SELECTED. On debug builds, an assertion will be raised when
|
||||||
* \a aId is invalid.
|
* \a aId is invalid.
|
||||||
|
*
|
||||||
* @param aId New tool command ID if greater than or equal to ::ID_NO_TOOL_SELECTED.
|
* @param aId New tool command ID if greater than or equal to ::ID_NO_TOOL_SELECTED.
|
||||||
If less than zero, the current tool command ID is retained.
|
If less than zero, the current tool command ID is retained.
|
||||||
* @param aCursor Sets the cursor shape if greater than or equal to zero.
|
* @param aCursor Sets the cursor shape if greater than or equal to zero.
|
||||||
|
@ -535,7 +523,6 @@ public:
|
||||||
* These parameters are saved in KiCad config for each main frame
|
* These parameters are saved in KiCad config for each main frame
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Function IsGridVisible() , virtual
|
|
||||||
* @return true if the grid must be shown
|
* @return true if the grid must be shown
|
||||||
*/
|
*/
|
||||||
virtual bool IsGridVisible() const
|
virtual bool IsGridVisible() const
|
||||||
|
@ -544,7 +531,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetGridVisibility() , virtual
|
|
||||||
* It may be overloaded by derived classes
|
* It may be overloaded by derived classes
|
||||||
* @param aVisible = true if the grid must be shown
|
* @param aVisible = true if the grid must be shown
|
||||||
*/
|
*/
|
||||||
|
@ -554,7 +540,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGridColor() , virtual
|
|
||||||
* @return the color of the grid
|
* @return the color of the grid
|
||||||
*/
|
*/
|
||||||
virtual COLOR4D GetGridColor()
|
virtual COLOR4D GetGridColor()
|
||||||
|
@ -563,7 +548,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetGridColor() , virtual
|
|
||||||
* @param aColor = the new color of the grid
|
* @param aColor = the new color of the grid
|
||||||
*/
|
*/
|
||||||
virtual void SetGridColor( COLOR4D aColor )
|
virtual void SetGridColor( COLOR4D aColor )
|
||||||
|
@ -572,9 +556,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGridPosition
|
* Return the nearest grid position to \a aPosition if a screen is defined and snap to
|
||||||
* returns the nearest grid position to \a aPosition if a screen is defined and snap to
|
|
||||||
* grid is enabled. Otherwise, the original positions is returned.
|
* grid is enabled. Otherwise, the original positions is returned.
|
||||||
|
*
|
||||||
* @see m_snapToGrid and m_BaseScreen members.
|
* @see m_snapToGrid and m_BaseScreen members.
|
||||||
* @param aPosition The position to test.
|
* @param aPosition The position to test.
|
||||||
* @return The wxPoint of the appropriate cursor position.
|
* @return The wxPoint of the appropriate cursor position.
|
||||||
|
@ -582,20 +566,18 @@ public:
|
||||||
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetNextGrid()
|
* Change the grid size settings to the next one available.
|
||||||
* changes the grid size settings to the next one available.
|
|
||||||
*/
|
*/
|
||||||
virtual void SetNextGrid();
|
virtual void SetNextGrid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetPrevGrid()
|
* Change the grid size settings to the previous one available.
|
||||||
* changes the grid size settings to the previous one available.
|
|
||||||
*/
|
*/
|
||||||
virtual void SetPrevGrid();
|
virtual void SetPrevGrid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetPresetGrid()
|
* Change the grid size to one of the preset values.
|
||||||
* changes the grid size to one of the preset values.
|
*
|
||||||
* @param aIndex is the index from the list.
|
* @param aIndex is the index from the list.
|
||||||
*/
|
*/
|
||||||
void SetPresetGrid( int aIndex );
|
void SetPresetGrid( int aIndex );
|
||||||
|
@ -613,8 +595,8 @@ public:
|
||||||
virtual void OnSelectGrid( wxCommandEvent& event );
|
virtual void OnSelectGrid( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions OnSelectZoom
|
* Set the zoom factor when selected by the zoom list box in the main tool bar.
|
||||||
* sets the zoom factor when selected by the zoom list box in the main tool bar.
|
*
|
||||||
* @note List position 0 is fit to page
|
* @note List position 0 is fit to page
|
||||||
* List position >= 1 = zoom (1 to zoom max)
|
* List position >= 1 = zoom (1 to zoom max)
|
||||||
* Last list position is custom zoom not in zoom list.
|
* Last list position is custom zoom not in zoom list.
|
||||||
|
@ -635,8 +617,7 @@ public:
|
||||||
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
|
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GeneralControl
|
* Perform application specific control using \a aDC at \a aPosition in logical units.
|
||||||
* performs application specific control using \a aDC at \a aPosition in logical units.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Override this function for application specific control. This function gets
|
* Override this function for application specific control. This function gets
|
||||||
* called on every mouse and key event.
|
* called on every mouse and key event.
|
||||||
|
@ -652,8 +633,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnSize
|
* Recalculate the size of toolbars and display panel when the frame size changes.
|
||||||
* recalculates the size of toolbars and display panel when the frame size changes.
|
|
||||||
*/
|
*/
|
||||||
virtual void OnSize( wxSizeEvent& event );
|
virtual void OnSize( wxSizeEvent& event );
|
||||||
|
|
||||||
|
@ -662,65 +642,63 @@ public:
|
||||||
virtual void OnZoom( wxCommandEvent& event );
|
virtual void OnZoom( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetNextZoom()
|
* Change the zoom to the next one available.
|
||||||
* changes the zoom to the next one available.
|
|
||||||
*/
|
*/
|
||||||
void SetNextZoom();
|
void SetNextZoom();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* changes the zoom to the next one available redraws the screen
|
* Change the zoom to the next one available redraws the screen
|
||||||
* and warp the mouse pointer on request.
|
* and warp the mouse pointer on request.
|
||||||
|
*
|
||||||
* @param aCenterPoint is the reference point for zooming
|
* @param aCenterPoint is the reference point for zooming
|
||||||
* @param aWarpPointer = true to move the pointer to the aCenterPoint
|
* @param aWarpPointer = true to move the pointer to the aCenterPoint
|
||||||
*/
|
*/
|
||||||
void SetNextZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
|
void SetNextZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetPrevZoom()
|
* Change the zoom to the previous one available.
|
||||||
* changes the zoom to the previous one available.
|
|
||||||
*/
|
*/
|
||||||
void SetPrevZoom();
|
void SetPrevZoom();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* changes the zoom to the previous one available redraws the screen
|
* Change the zoom to the previous one available redraws the screen
|
||||||
* and warp the mouse pointer on request.
|
* and warp the mouse pointer on request.
|
||||||
|
*
|
||||||
* @param aCenterPoint is the reference point for zooming
|
* @param aCenterPoint is the reference point for zooming
|
||||||
* @param aWarpPointer = true to move the pointer to the aCenterPoint
|
* @param aWarpPointer = true to move the pointer to the aCenterPoint
|
||||||
*/
|
*/
|
||||||
void SetPreviousZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
|
void SetPreviousZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetPresetZoom()
|
* Change zoom to one of the preset values.
|
||||||
* changes zoom to one of the preset values.
|
*
|
||||||
* @param aIndex is the zoom index from the list.
|
* @param aIndex is the zoom index from the list.
|
||||||
*/
|
*/
|
||||||
void SetPresetZoom( int aIndex );
|
void SetPresetZoom( int aIndex );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function RedrawScreen
|
* Redraw the entire screen area by updating the scroll bars and mouse pointer in
|
||||||
* redraws the entire screen area by updating the scroll bars and mouse pointer in
|
|
||||||
* order to have \a aCenterPoint at the center of the screen.
|
* order to have \a aCenterPoint at the center of the screen.
|
||||||
|
*
|
||||||
* @param aCenterPoint The position in logical units to center the scroll bars.
|
* @param aCenterPoint The position in logical units to center the scroll bars.
|
||||||
* @param aWarpPointer Moves the mouse cursor to \a aCenterPoint if true.
|
* @param aWarpPointer Moves the mouse cursor to \a aCenterPoint if true.
|
||||||
*/
|
*/
|
||||||
virtual void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
|
virtual void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function RedrawScreen2
|
* Put the crosshair back to the screen position it had before zooming.
|
||||||
* puts the crosshair back to the screen position it had before zooming
|
*
|
||||||
* @param posBefore screen position of the crosshair before zooming
|
* @param posBefore screen position of the crosshair before zooming
|
||||||
*/
|
*/
|
||||||
virtual void RedrawScreen2( const wxPoint& posBefore );
|
virtual void RedrawScreen2( const wxPoint& posBefore );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HardRedraw
|
* Rebuild the GAL and redraws the screen. Call when something went wrong.
|
||||||
* rebuilds the GAL and redraws the screen. Call when something went wrong.
|
|
||||||
*/
|
*/
|
||||||
virtual void HardRedraw();
|
virtual void HardRedraw();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Zoom_Automatique
|
* Redraw the screen with best zoom level and the best centering
|
||||||
* redraws the screen with best zoom level and the best centering
|
|
||||||
* that shows all the page or the board
|
* that shows all the page or the board
|
||||||
*/
|
*/
|
||||||
virtual void Zoom_Automatique( bool aWarpPointer );
|
virtual void Zoom_Automatique( bool aWarpPointer );
|
||||||
|
@ -732,14 +710,13 @@ public:
|
||||||
virtual double BestZoom() = 0;
|
virtual double BestZoom() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetZoom
|
|
||||||
* @return The current zoom level.
|
* @return The current zoom level.
|
||||||
*/
|
*/
|
||||||
double GetZoom();
|
double GetZoom();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DrawWorkSheet
|
|
||||||
* Draws on screen the page layout with the frame and the basic inscriptions.
|
* Draws on screen the page layout with the frame and the basic inscriptions.
|
||||||
|
*
|
||||||
* @param aDC The device context.
|
* @param aDC The device context.
|
||||||
* @param aScreen screen to draw
|
* @param aScreen screen to draw
|
||||||
* @param aLineWidth The pen width to use to draw the layout.
|
* @param aLineWidth The pen width to use to draw the layout.
|
||||||
|
@ -760,16 +737,15 @@ public:
|
||||||
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnActivate (virtual)
|
* Called when activating the frame.
|
||||||
* is called when activating the frame.
|
*
|
||||||
* In derived classes with a overriding OnActivate function,
|
* In derived classes with a overriding OnActivate function,
|
||||||
* do not forget to call this EDA_DRAW_FRAME::OnActivate( event ) basic function.
|
* do not forget to call this EDA_DRAW_FRAME::OnActivate( event ) basic function.
|
||||||
*/
|
*/
|
||||||
virtual void OnActivate( wxActivateEvent& event );
|
virtual void OnActivate( wxActivateEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UpdateStatusBar
|
* Update the status bar information.
|
||||||
* updates the status bar information.
|
|
||||||
*
|
*
|
||||||
* The base method updates the absolute and relative coordinates and the
|
* The base method updates the absolute and relative coordinates and the
|
||||||
* zoom information. If you override this virtual method, make sure to call
|
* zoom information. If you override this virtual method, make sure to call
|
||||||
|
@ -783,8 +759,7 @@ public:
|
||||||
virtual void UpdateStatusBar();
|
virtual void UpdateStatusBar();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DisplayUnitsMsg
|
* Display current unit pane on the status bar.
|
||||||
* displays current unit pane on the status bar.
|
|
||||||
*/
|
*/
|
||||||
void DisplayUnitsMsg();
|
void DisplayUnitsMsg();
|
||||||
|
|
||||||
|
@ -804,8 +779,7 @@ public:
|
||||||
int aExplicitCommand = 0 );
|
int aExplicitCommand = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function BlockCommand
|
* Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the
|
||||||
* Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the
|
|
||||||
* keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging
|
* keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging
|
||||||
* the mouse.
|
* the mouse.
|
||||||
*
|
*
|
||||||
|
@ -815,7 +789,6 @@ public:
|
||||||
virtual int BlockCommand( EDA_KEY aKey );
|
virtual int BlockCommand( EDA_KEY aKey );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HandleBlockPlace( )
|
|
||||||
* Called after HandleBlockEnd, when a block command needs to be
|
* Called after HandleBlockEnd, when a block command needs to be
|
||||||
* executed after the block is moved to its new place
|
* executed after the block is moved to its new place
|
||||||
* (bloc move, drag, copy .. )
|
* (bloc move, drag, copy .. )
|
||||||
|
@ -824,7 +797,6 @@ public:
|
||||||
virtual void HandleBlockPlace( wxDC* DC );
|
virtual void HandleBlockPlace( wxDC* DC );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HandleBlockEnd( )
|
|
||||||
* Handle the "end" of a block command,
|
* Handle the "end" of a block command,
|
||||||
* i.e. is called at the end of the definition of the area of a block.
|
* i.e. is called at the end of the definition of the area of a block.
|
||||||
* depending on the current block command, this command is executed
|
* depending on the current block command, this command is executed
|
||||||
|
@ -836,8 +808,7 @@ public:
|
||||||
virtual bool HandleBlockEnd( wxDC* DC );
|
virtual bool HandleBlockEnd( wxDC* DC );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function CopyToClipboard
|
* Copy the current page or the current block to the clipboard.
|
||||||
* copies the current page or the current block to the clipboard.
|
|
||||||
*/
|
*/
|
||||||
void CopyToClipboard( wxCommandEvent& event );
|
void CopyToClipboard( wxCommandEvent& event );
|
||||||
|
|
||||||
|
@ -871,8 +842,7 @@ public:
|
||||||
void ClearMsgPanel( void );
|
void ClearMsgPanel( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetMsgPanel
|
* Clear the message panel and populates it with the contents of \a aList.
|
||||||
* clears the message panel and populates it with the contents of \a aList.
|
|
||||||
*
|
*
|
||||||
* @param aList is the list of #MSG_PANEL_ITEM objects to fill the message panel.
|
* @param aList is the list of #MSG_PANEL_ITEM objects to fill the message panel.
|
||||||
*/
|
*/
|
||||||
|
@ -881,14 +851,12 @@ public:
|
||||||
void SetMsgPanel( EDA_ITEM* aItem );
|
void SetMsgPanel( EDA_ITEM* aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UpdateMsgPanel
|
* Redraw the message panel.
|
||||||
* redraws the message panel.
|
|
||||||
*/
|
*/
|
||||||
virtual void UpdateMsgPanel();
|
virtual void UpdateMsgPanel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PushPreferences
|
* Push preferences from a parent window to a child window.
|
||||||
* Pushes a few preferences from a parent window to a child window.
|
|
||||||
* (i.e. from eeschema to schematic symbol editor)
|
* (i.e. from eeschema to schematic symbol editor)
|
||||||
*
|
*
|
||||||
* @param aParentCanvas is the parent canvas to push preferences from.
|
* @param aParentCanvas is the parent canvas to push preferences from.
|
||||||
|
@ -896,9 +864,8 @@ public:
|
||||||
void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
|
void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PrintPage
|
* Print the page pointed by current screen, set by the calling print function.
|
||||||
* used to print a page
|
*
|
||||||
* Print the page pointed by current screen, set by the calling print function
|
|
||||||
* @param aDC = wxDC given by the calling print function
|
* @param aDC = wxDC given by the calling print function
|
||||||
* @param aPrintMask = not used here
|
* @param aPrintMask = not used here
|
||||||
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
||||||
|
@ -912,8 +879,7 @@ public:
|
||||||
static EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting();
|
static EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UseGalCanvas
|
* Use to switch between standard and GAL-based canvas.
|
||||||
* used to switch between standard and GAL-based canvas.
|
|
||||||
*
|
*
|
||||||
* @param aEnable True for GAL-based canvas, false for standard canvas.
|
* @param aEnable True for GAL-based canvas, false for standard canvas.
|
||||||
*/
|
*/
|
||||||
|
@ -935,8 +901,7 @@ public:
|
||||||
bool IsGalCanvasActive() const { return m_galCanvasActive; }
|
bool IsGalCanvasActive() const { return m_galCanvasActive; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGalCanvas
|
* Return a pointer to GAL-based canvas of given EDA draw frame.
|
||||||
* returns a pointer to GAL-based canvas of given EDA draw frame.
|
|
||||||
*
|
*
|
||||||
* @return Pointer to GAL-based canvas.
|
* @return Pointer to GAL-based canvas.
|
||||||
*/
|
*/
|
||||||
|
@ -944,13 +909,11 @@ public:
|
||||||
void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
|
void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetToolManager
|
* Return the tool manager instance, if any.
|
||||||
* returns the tool manager instance, if any.
|
|
||||||
*/
|
*/
|
||||||
TOOL_MANAGER* GetToolManager() const { return m_toolManager; }
|
TOOL_MANAGER* GetToolManager() const { return m_toolManager; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetDisplayOptions
|
|
||||||
* A way to pass info to draw functions. the base class has no knowledge about
|
* A way to pass info to draw functions. the base class has no knowledge about
|
||||||
* these options. It is virtual because this function must be overloaded to
|
* these options. It is virtual because this function must be overloaded to
|
||||||
* pass usefull info.
|
* pass usefull info.
|
||||||
|
@ -958,14 +921,12 @@ public:
|
||||||
virtual void* GetDisplayOptions() { return NULL; }
|
virtual void* GetDisplayOptions() { return NULL; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGalDisplayOptions
|
* Return a reference to the gal rendering options used by GAL for rendering.
|
||||||
* Returns a reference to the gal rendering options used by GAL for rendering.
|
|
||||||
*/
|
*/
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return m_galDisplayOptions; }
|
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return m_galDisplayOptions; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SyncMenusAndToolbars
|
* Update the toolbars and menus (mostly settings/check buttons/checkboxes)
|
||||||
* Updates the toolbars and menus (mostly settings/check buttons/checkboxes)
|
|
||||||
* with the current controller state
|
* with the current controller state
|
||||||
*/
|
*/
|
||||||
virtual void SyncMenusAndToolbars( wxEvent& aEvent ) {};
|
virtual void SyncMenusAndToolbars( wxEvent& aEvent ) {};
|
||||||
|
|
|
@ -99,6 +99,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||||
EVT_TOOL( ID_MODEDIT_SAVE_AS, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_TOOL( ID_MODEDIT_SAVE_AS, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_MODEDIT_REVERT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_TOOL( ID_MODEDIT_REVERT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
|
EVT_TOOL( ID_MODEDIT_SAVE_PNG, FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng )
|
||||||
|
|
||||||
EVT_TOOL( ID_MODEDIT_CUT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_TOOL( ID_MODEDIT_CUT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_MODEDIT_COPY_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_TOOL( ID_MODEDIT_COPY_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
|
@ -952,7 +953,8 @@ void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxID_PREFERENCES:
|
case wxID_PREFERENCES:
|
||||||
ShowPreferences( g_Pcbnew_Editor_Hotkeys_Descr, g_Module_Editor_Hotkeys_Descr, wxT( "pcbnew" ) );
|
ShowPreferences( g_Pcbnew_Editor_Hotkeys_Descr, g_Module_Editor_Hotkeys_Descr,
|
||||||
|
wxT( "pcbnew" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1062,3 +1064,32 @@ void FOOTPRINT_EDIT_FRAME::UpdateMsgPanel()
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxString fullFileName;
|
||||||
|
|
||||||
|
LIB_ID id = GetLoadedFPID();
|
||||||
|
|
||||||
|
if( id.empty() )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "No footprint selected." ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFileName fn( id.GetLibItemName() );
|
||||||
|
fn.SetExt( "png" );
|
||||||
|
|
||||||
|
wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
|
|
||||||
|
wxFileDialog dlg( this, _( "Footprint Image File Name" ), projectPath,
|
||||||
|
fn.GetFullName(), PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
|
||||||
|
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// calling wxYield is mandatory under Linux, after closing the file selector dialog
|
||||||
|
// to refresh the screen before creating the PNG or JPEG image from screen
|
||||||
|
wxYield();
|
||||||
|
saveCanvasImageToFile( dlg.GetPath() );
|
||||||
|
}
|
||||||
|
|
|
@ -79,8 +79,7 @@ public:
|
||||||
double BestZoom() override;
|
double BestZoom() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetConfigurationSettings
|
* Return the footprint editor settings list.
|
||||||
* returns the footpr<EFBFBD>int editor settings list.
|
|
||||||
*
|
*
|
||||||
* Currently, only the settings that are needed at start
|
* Currently, only the settings that are needed at start
|
||||||
* up by the main window are defined here. There are other locally used
|
* up by the main window are defined here. There are other locally used
|
||||||
|
@ -112,14 +111,12 @@ public:
|
||||||
void ProcessPreferences( wxCommandEvent& event );
|
void ProcessPreferences( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function RedrawActiveWindoow
|
* Draw the footprint editor BOARD, and others elements such as axis and grid.
|
||||||
* draws the footprint editor BOARD, and others elements such as axis and grid.
|
|
||||||
*/
|
*/
|
||||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReCreateHToolbar
|
* Create the main horizontal toolbar for the footprint editor.
|
||||||
* create the main horizontal toolbar for the footprint editor
|
|
||||||
*/
|
*/
|
||||||
void ReCreateHToolbar() override;
|
void ReCreateHToolbar() override;
|
||||||
|
|
||||||
|
@ -128,17 +125,16 @@ public:
|
||||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnLeftDClick
|
* Handle the double click in the footprint editor.
|
||||||
* handles the double click in the footprint editor:
|
*
|
||||||
* If the double clicked item is editable: call the corresponding editor.
|
* If the double clicked item is editable: call the corresponding editor.
|
||||||
*/
|
*/
|
||||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
|
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnRightClick
|
* Handle the right mouse click in the footprint editor.
|
||||||
* handles the right mouse click in the footprint editor:
|
*
|
||||||
* Create the pop up menu
|
* Create the pop up menu. After this menu is built, the standard ZOOM menu is added
|
||||||
* After this menu is built, the standard ZOOM menu is added
|
|
||||||
*/
|
*/
|
||||||
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
|
||||||
|
|
||||||
|
@ -155,11 +151,12 @@ public:
|
||||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||||
void OnToggleSearchTree( wxCommandEvent& event );
|
void OnToggleSearchTree( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void OnSaveFootprintAsPng( wxCommandEvent& event );
|
||||||
|
|
||||||
bool IsSearchTreeShown();
|
bool IsSearchTreeShown();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveLibraryAs
|
* Save a library to a new name and/or library type.
|
||||||
* saves a library to a new name and/or library type.
|
|
||||||
*
|
*
|
||||||
* @note Saving as a new library type requires the plug-in to support saving libraries
|
* @note Saving as a new library type requires the plug-in to support saving libraries
|
||||||
* @see PLUGIN::FootprintSave and PLUGIN::FootprintLibCreate
|
* @see PLUGIN::FootprintSave and PLUGIN::FootprintLibCreate
|
||||||
|
@ -170,8 +167,7 @@ public:
|
||||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
|
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnHotKey
|
* Handle hot key events.
|
||||||
* handle hot key events.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Some commands are relative to the item under the mouse cursor. Commands are
|
* Some commands are relative to the item under the mouse cursor. Commands are
|
||||||
* case insensitive
|
* case insensitive
|
||||||
|
@ -189,8 +185,7 @@ public:
|
||||||
bool OnHotkeyDuplicateItem( int aIdCommand );
|
bool OnHotkeyDuplicateItem( int aIdCommand );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Show3D_Frame
|
* Display 3D view of the footprint (module) being edited.
|
||||||
* displays 3D view of the footprint (module) being edited.
|
|
||||||
*/
|
*/
|
||||||
void Show3D_Frame( wxCommandEvent& event ) override;
|
void Show3D_Frame( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
|
@ -198,12 +193,12 @@ public:
|
||||||
void OnVerticalToolbar( wxCommandEvent& aEvent );
|
void OnVerticalToolbar( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handle ID_ZOOM_SELECTION and ID_NO_TOOL_SELECTED tools
|
* Handle ID_ZOOM_SELECTION and ID_NO_TOOL_SELECTED tools
|
||||||
*/
|
*/
|
||||||
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handle most of tools og the vertical right toolbar ("Tools" toolbar)
|
* Handle most of tools og the vertical right toolbar ("Tools" toolbar)
|
||||||
*/
|
*/
|
||||||
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
|
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
|
@ -219,8 +214,7 @@ public:
|
||||||
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) override;
|
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function LoadModuleFromBoard
|
* Called from the main toolbar to load a footprint from board mainly to edit it.
|
||||||
* called from the main toolbar to load a footprint from board mainly to edit it.
|
|
||||||
*/
|
*/
|
||||||
void LoadModuleFromBoard( wxCommandEvent& event );
|
void LoadModuleFromBoard( wxCommandEvent& event );
|
||||||
|
|
||||||
|
@ -232,8 +226,8 @@ public:
|
||||||
LIB_TREE_MODEL_ADAPTER::PTR& GetLibTreeAdapter() { return m_adapter; }
|
LIB_TREE_MODEL_ADAPTER::PTR& GetLibTreeAdapter() { return m_adapter; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveFootprint
|
* Save in an existing library a given footprint.
|
||||||
* Save in an existing library a given footprint
|
*
|
||||||
* @param aModule = the given footprint
|
* @param aModule = the given footprint
|
||||||
* @return : true if OK, false if abort
|
* @return : true if OK, false if abort
|
||||||
*/
|
*/
|
||||||
|
@ -243,7 +237,6 @@ public:
|
||||||
bool RevertFootprint();
|
bool RevertFootprint();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual Function OnModify()
|
|
||||||
* Must be called after a footprint change
|
* Must be called after a footprint change
|
||||||
* in order to set the "modify" flag of the current screen
|
* in order to set the "modify" flag of the current screen
|
||||||
* and prepare, if needed the refresh of the 3D frame showing the footprint
|
* and prepare, if needed the refresh of the 3D frame showing the footprint
|
||||||
|
@ -252,7 +245,6 @@ public:
|
||||||
virtual void OnModify() override;
|
virtual void OnModify() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ToPrinter
|
|
||||||
* Install the print dialog
|
* Install the print dialog
|
||||||
*/
|
*/
|
||||||
void ToPrinter( wxCommandEvent& event );
|
void ToPrinter( wxCommandEvent& event );
|
||||||
|
@ -260,8 +252,8 @@ public:
|
||||||
// BOARD handling
|
// BOARD handling
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Clear_Pcb
|
* Delete all and reinitialize the current board.
|
||||||
* delete all and reinitialize the current board
|
*
|
||||||
* @param aQuery = true to prompt user for confirmation, false to initialize silently
|
* @param aQuery = true to prompt user for confirmation, false to initialize silently
|
||||||
*/
|
*/
|
||||||
bool Clear_Pcb( bool aQuery );
|
bool Clear_Pcb( bool aQuery );
|
||||||
|
@ -270,8 +262,8 @@ public:
|
||||||
virtual int BlockCommand( EDA_KEY key ) override;
|
virtual int BlockCommand( EDA_KEY key ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HandleBlockPlace
|
* Handle the BLOCK PLACE command.
|
||||||
* handles the BLOCK PLACE command
|
*
|
||||||
* Last routine for block operation for:
|
* Last routine for block operation for:
|
||||||
* - block move & drag
|
* - block move & drag
|
||||||
* - block copy & paste
|
* - block copy & paste
|
||||||
|
@ -279,7 +271,6 @@ public:
|
||||||
virtual void HandleBlockPlace( wxDC* DC ) override;
|
virtual void HandleBlockPlace( wxDC* DC ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HandleBlockEnd( )
|
|
||||||
* Handle the "end" of a block command,
|
* Handle the "end" of a block command,
|
||||||
* i.e. is called at the end of the definition of the area of a block.
|
* i.e. is called at the end of the definition of the area of a block.
|
||||||
* depending on the current block command, this command is executed
|
* depending on the current block command, this command is executed
|
||||||
|
@ -301,15 +292,14 @@ public:
|
||||||
void RemoveStruct( EDA_ITEM* Item );
|
void RemoveStruct( EDA_ITEM* Item );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Transform
|
* Perform a geometric transform on the current footprint.
|
||||||
* performs a geometric transform on the current footprint.
|
|
||||||
*/
|
*/
|
||||||
void Transform( MODULE* module, int transform );
|
void Transform( MODULE* module, int transform );
|
||||||
|
|
||||||
// importing / exporting Footprint
|
// importing / exporting Footprint
|
||||||
/**
|
/**
|
||||||
* Function Export_Module
|
|
||||||
* Create a file containing only one footprint.
|
* Create a file containing only one footprint.
|
||||||
|
*
|
||||||
* Used to export a footprint
|
* Used to export a footprint
|
||||||
* Exported files have the standard ext .emp
|
* Exported files have the standard ext .emp
|
||||||
* This is the same format as .mod files but restricted to only one footprint
|
* This is the same format as .mod files but restricted to only one footprint
|
||||||
|
@ -320,27 +310,27 @@ public:
|
||||||
void Export_Module( MODULE* aModule );
|
void Export_Module( MODULE* aModule );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Import_Module
|
|
||||||
* Read a file containing only one footprint.
|
* Read a file containing only one footprint.
|
||||||
|
*
|
||||||
* Used to import (after exporting) a footprint
|
* Used to import (after exporting) a footprint
|
||||||
* Exported files have the standard ext .emp
|
* Exported files have the standard ext .emp
|
||||||
* This is the same format as .mod files but restricted to only one footprint
|
* This is the same format as .mod files but restricted to only one footprint
|
||||||
* The import function can also read gpcb footprint file, in Newlib format
|
* The import function can also read gpcb footprint file, in Newlib format
|
||||||
* (One footprint per file, Newlib files have no special ext.)
|
* (One footprint per file, Newlib files have no special ext.)
|
||||||
*/
|
*/
|
||||||
MODULE* Import_Module( const wxString& aName = wxT("") );
|
MODULE* Import_Module( const wxString& aName = wxT("") );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Load_Module_From_BOARD
|
* Load in Modedit a footprint from the main board.
|
||||||
* load in Modedit a footprint from the main board
|
*
|
||||||
* @param Module = the module to load. If NULL, a module reference will we asked to user
|
* @param Module = the module to load. If NULL, a module reference will we asked to user
|
||||||
* @return true if a module isloaded, false otherwise.
|
* @return true if a module isloaded, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool Load_Module_From_BOARD( MODULE* Module );
|
bool Load_Module_From_BOARD( MODULE* Module );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SelectFootprint
|
* Display the list of modules currently existing on the BOARD.
|
||||||
* Display the list of modules currently existing on the BOARD
|
*
|
||||||
* @return a pointer to a module if this module is selected or NULL otherwise
|
* @return a pointer to a module if this module is selected or NULL otherwise
|
||||||
* @param aPcb = the board from modules can be loaded
|
* @param aPcb = the board from modules can be loaded
|
||||||
*/
|
*/
|
||||||
|
@ -349,8 +339,8 @@ public:
|
||||||
// functions to edit footprint edges
|
// functions to edit footprint edges
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Edit_Edge_Width
|
* Change the width of module perimeter lines, EDGE_MODULEs.
|
||||||
* changes the width of module perimeter lines, EDGE_MODULEs.
|
*
|
||||||
* param ModuleSegmentWidth (global) = new width
|
* param ModuleSegmentWidth (global) = new width
|
||||||
* @param aEdge = edge to edit, or NULL. If aEdge == NULL change
|
* @param aEdge = edge to edit, or NULL. If aEdge == NULL change
|
||||||
* the width of all footprint's edges
|
* the width of all footprint's edges
|
||||||
|
@ -358,25 +348,24 @@ public:
|
||||||
void Edit_Edge_Width( EDGE_MODULE* aEdge );
|
void Edit_Edge_Width( EDGE_MODULE* aEdge );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Edit_Edge_Layer
|
* Change the EDGE_MODULE Edge layer, (The new layer will be asked)
|
||||||
* changes the EDGE_MODULE Edge layer, (The new layer will be asked)
|
|
||||||
* if Edge == NULL change the layer of the entire footprint edges
|
* if Edge == NULL change the layer of the entire footprint edges
|
||||||
|
*
|
||||||
* @param Edge = edge to edit, or NULL
|
* @param Edge = edge to edit, or NULL
|
||||||
*/
|
*/
|
||||||
void Edit_Edge_Layer( EDGE_MODULE* Edge );
|
void Edit_Edge_Layer( EDGE_MODULE* Edge );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Delete_Edge_Module
|
* Delete EDGE_MODULE ddge.
|
||||||
* deletes EDGE_MODULE Edge
|
*
|
||||||
* @param Edge = edge to delete
|
* @param Edge = edge to delete
|
||||||
*/
|
*/
|
||||||
void Delete_Edge_Module( EDGE_MODULE* Edge );
|
void Delete_Edge_Module( EDGE_MODULE* Edge );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Begin_Edge_Module
|
* Creates a new edge item (line, arc ..).
|
||||||
* creates a new edge item (line, arc ..).
|
*
|
||||||
* @param Edge = if NULL: create new edge else terminate edge and create a
|
* @param Edge = if NULL: create new edge else terminate edge and create a new edge
|
||||||
* new edge
|
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
* @param type_edge = S_SEGMENT,S_ARC ..
|
* @param type_edge = S_SEGMENT,S_ARC ..
|
||||||
* @return the new created edge.
|
* @return the new created edge.
|
||||||
|
@ -384,8 +373,7 @@ public:
|
||||||
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, STROKE_T type_edge );
|
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, STROKE_T type_edge );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function End_Edge_Module
|
* Terminate a move or create edge function.
|
||||||
* terminates a move or create edge function
|
|
||||||
*/
|
*/
|
||||||
void End_Edge_Module( EDGE_MODULE* Edge );
|
void End_Edge_Module( EDGE_MODULE* Edge );
|
||||||
|
|
||||||
|
@ -396,8 +384,7 @@ public:
|
||||||
void Place_EdgeMod( EDGE_MODULE* drawitem );
|
void Place_EdgeMod( EDGE_MODULE* drawitem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DlgGlobalChange_PadSettings
|
* Change pad characteristics for the given footprint
|
||||||
* changes pad characteristics for the given footprint
|
|
||||||
* or all footprints which look like the given footprint.
|
* or all footprints which look like the given footprint.
|
||||||
* Options are set by the opened dialog.
|
* Options are set by the opened dialog.
|
||||||
* @param aPad is the pattern. The given footprint is the parent of this pad
|
* @param aPad is the pattern. The given footprint is the parent of this pad
|
||||||
|
@ -405,15 +392,15 @@ public:
|
||||||
void PushPadProperties( D_PAD* aPad );
|
void PushPadProperties( D_PAD* aPad );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DeleteModuleFromLibrary
|
* Delete the given module from its library.
|
||||||
* deletes the given module from its library.
|
|
||||||
*/
|
*/
|
||||||
bool DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aConfirm );
|
bool DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aConfirm );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsElementVisible
|
* Test whether a given element category is visible.
|
||||||
* tests whether a given element category is visible. Keep this as an
|
*
|
||||||
* inline function.
|
* Keep this as an inline function.
|
||||||
|
*
|
||||||
* @param aElement is from the enum by the same name
|
* @param aElement is from the enum by the same name
|
||||||
* @return bool - true if the element is visible.
|
* @return bool - true if the element is visible.
|
||||||
* @see enum PCB_LAYER_ID
|
* @see enum PCB_LAYER_ID
|
||||||
|
@ -430,13 +417,11 @@ public:
|
||||||
void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
|
void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsGridVisible() , virtual
|
|
||||||
* @return true if the grid must be shown
|
* @return true if the grid must be shown
|
||||||
*/
|
*/
|
||||||
virtual bool IsGridVisible() const override;
|
virtual bool IsGridVisible() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetGridVisibility() , virtual
|
|
||||||
* It may be overloaded by derived classes
|
* It may be overloaded by derived classes
|
||||||
* if you want to store/retrieve the grid visibility in configuration.
|
* if you want to store/retrieve the grid visibility in configuration.
|
||||||
* @param aVisible = true if the grid must be shown
|
* @param aVisible = true if the grid must be shown
|
||||||
|
@ -444,7 +429,6 @@ public:
|
||||||
virtual void SetGridVisibility( bool aVisible ) override;
|
virtual void SetGridVisibility( bool aVisible ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGridColor() , virtual
|
|
||||||
* @return the color of the grid
|
* @return the color of the grid
|
||||||
*/
|
*/
|
||||||
virtual COLOR4D GetGridColor() override;
|
virtual COLOR4D GetGridColor() override;
|
||||||
|
@ -459,8 +443,7 @@ public:
|
||||||
virtual void UseGalCanvas( bool aEnable ) override;
|
virtual void UseGalCanvas( bool aEnable ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OpenProjectFiles (was LoadOnePcbFile)
|
* Load a KiCad board (.kicad_pcb) from \a aFileName.
|
||||||
* loads a KiCad board (.kicad_pcb) from \a aFileName.
|
|
||||||
*
|
*
|
||||||
* @param aFileSet - hold the BOARD file to load, a vector of one element.
|
* @param aFileSet - hold the BOARD file to load, a vector of one element.
|
||||||
*
|
*
|
||||||
|
@ -505,7 +488,8 @@ public:
|
||||||
void SyncLibraryTree( bool aProgress );
|
void SyncLibraryTree( bool aProgress );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redraws the message panel.
|
* Redraw the message panel.
|
||||||
|
*
|
||||||
* If a item is currently selected, displays the item info.
|
* If a item is currently selected, displays the item info.
|
||||||
* If nothing selected, display the current footprint info, or
|
* If nothing selected, display the current footprint info, or
|
||||||
* clear the message panel if nothing is edited
|
* clear the message panel if nothing is edited
|
||||||
|
@ -533,8 +517,7 @@ protected:
|
||||||
void initLibraryTree();
|
void initLibraryTree();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UpdateTitle
|
* Updates window title according to getLibNickName().
|
||||||
* updates window title according to getLibNickName().
|
|
||||||
*/
|
*/
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
|
@ -562,15 +545,14 @@ private:
|
||||||
bool saveFootprintInLibrary( MODULE* aModule, const wxString& aLibraryName );
|
bool saveFootprintInLibrary( MODULE* aModule, const wxString& aLibraryName );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function moveExact
|
|
||||||
* Move the selected item exactly, popping up a dialog to allow the
|
* Move the selected item exactly, popping up a dialog to allow the
|
||||||
* user the enter the move delta
|
* user the enter the move delta
|
||||||
*/
|
*/
|
||||||
void moveExact();
|
void moveExact();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function duplicateItems
|
|
||||||
* Duplicate the item under the cursor
|
* Duplicate the item under the cursor
|
||||||
|
*
|
||||||
* @param aIncrement increment the number of pad (if that is what is selected)
|
* @param aIncrement increment the number of pad (if that is what is selected)
|
||||||
*/
|
*/
|
||||||
void duplicateItems( bool aIncrement ) override;
|
void duplicateItems( bool aIncrement ) override;
|
||||||
|
|
|
@ -121,6 +121,14 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
|
|
||||||
|
AddMenuItem( fileMenu,
|
||||||
|
ID_MODEDIT_SAVE_PNG,
|
||||||
|
_( "Export View as PN&G..." ),
|
||||||
|
_( "Create a PNG file from the current view" ),
|
||||||
|
KiBitmap( plot_xpm ) );
|
||||||
|
|
||||||
|
fileMenu->AppendSeparator();
|
||||||
|
|
||||||
// Close editor
|
// Close editor
|
||||||
AddMenuItem( fileMenu, wxID_EXIT,
|
AddMenuItem( fileMenu, wxID_EXIT,
|
||||||
_( "&Exit" ),
|
_( "&Exit" ),
|
||||||
|
|
|
@ -250,7 +250,7 @@ enum pcbnew_ids
|
||||||
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
|
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
|
||||||
ID_POPUP_PCB_ITEM_SELECTION_START,
|
ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||||
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
|
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||||
|
|
||||||
ID_POPUP_PCB_SPREAD_SELECTED_MODULES,
|
ID_POPUP_PCB_SPREAD_SELECTED_MODULES,
|
||||||
ID_POPUP_PCB_SPREAD_OFF_BOARD_MODULES,
|
ID_POPUP_PCB_SPREAD_OFF_BOARD_MODULES,
|
||||||
ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES,
|
ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES,
|
||||||
|
@ -350,6 +350,7 @@ enum pcbnew_ids
|
||||||
ID_MODEDIT_ADD_LIBRARY,
|
ID_MODEDIT_ADD_LIBRARY,
|
||||||
ID_MODEDIT_SAVE,
|
ID_MODEDIT_SAVE,
|
||||||
ID_MODEDIT_SAVE_AS,
|
ID_MODEDIT_SAVE_AS,
|
||||||
|
ID_MODEDIT_SAVE_PNG,
|
||||||
ID_MODEDIT_REVERT_PART,
|
ID_MODEDIT_REVERT_PART,
|
||||||
ID_MODEDIT_DELETE_PART,
|
ID_MODEDIT_DELETE_PART,
|
||||||
ID_MODEDIT_COPY_PART,
|
ID_MODEDIT_COPY_PART,
|
||||||
|
|
Loading…
Reference in New Issue