Merged module-editor branch (http://www.ohwr.org/projects/cern-kicad/wiki/ModuleEditor).
This commit is contained in:
commit
f45836bfc6
|
@ -228,6 +228,7 @@ set( COMMON_SRCS
|
|||
|
||||
math/math_util.cpp
|
||||
|
||||
tool/tool_action.cpp
|
||||
tool/tool_base.cpp
|
||||
tool/tool_manager.cpp
|
||||
tool/tool_dispatcher.cpp
|
||||
|
|
|
@ -1033,10 +1033,10 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
|||
m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
|
||||
m_auimgr.Update();
|
||||
|
||||
SetGalCanvasActive( aEnable );
|
||||
// Reset current tool on switch();
|
||||
SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
|
||||
|
||||
if( aEnable )
|
||||
GetGalCanvas()->SetFocus();
|
||||
m_galCanvasActive = aEnable;
|
||||
}
|
||||
|
||||
//-----< BASE_SCREEN API moved here >--------------------------------------------
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include <tool/tool_dispatcher.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
#include <profile.h>
|
||||
#endif /* __WXDEBUG__ */
|
||||
|
@ -50,8 +52,9 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
|||
GalType aGalType ) :
|
||||
wxWindow( aParentWindow, aWindowId, aPosition, aSize )
|
||||
{
|
||||
m_parent = aParentWindow;
|
||||
m_gal = NULL;
|
||||
m_currentGal = GAL_TYPE_NONE;
|
||||
m_backend = GAL_TYPE_NONE;
|
||||
m_view = NULL;
|
||||
m_painter = NULL;
|
||||
m_eventDispatcher = NULL;
|
||||
|
@ -68,32 +71,27 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
|||
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
||||
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this );
|
||||
|
||||
/* Generic events for the Tool Dispatcher */
|
||||
Connect( wxEVT_MOTION, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_LEFT_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_LEFT_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_LEFT_DCLICK, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_RIGHT_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_RIGHT_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_RIGHT_DCLICK, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_MIDDLE_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_MIDDLE_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_MIDDLE_DCLICK, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_MOUSEWHEEL, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_CHAR_HOOK, wxEventHandler( EDA_DRAW_PANEL_GAL::skipEvent ) );
|
||||
Connect( wxEVT_CHAR, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this );
|
||||
Connect( KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE,
|
||||
wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
|
||||
const wxEventType events[] =
|
||||
{
|
||||
wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK,
|
||||
wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
|
||||
wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
|
||||
wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE
|
||||
};
|
||||
|
||||
BOOST_FOREACH( wxEventType eventType, events )
|
||||
{
|
||||
Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ),
|
||||
NULL, m_eventDispatcher );
|
||||
}
|
||||
|
||||
// Set up timer that prevents too frequent redraw commands
|
||||
m_refreshTimer.SetOwner( this );
|
||||
m_pendingRefresh = false;
|
||||
m_drawing = false;
|
||||
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
|
||||
|
||||
this->SetFocus();
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +158,7 @@ void EDA_DRAW_PANEL_GAL::onRefreshTimer( wxTimerEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect )
|
||||
void EDA_DRAW_PANEL_GAL::Refresh( bool aEraseBackground, const wxRect* aRect )
|
||||
{
|
||||
if( m_pendingRefresh )
|
||||
return;
|
||||
|
@ -183,6 +181,50 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
|
||||
{
|
||||
m_eventDispatcher = aEventDispatcher;
|
||||
|
||||
#if wxCHECK_VERSION( 3, 0, 0 )
|
||||
if( m_eventDispatcher )
|
||||
{
|
||||
m_parent->Connect( wxEVT_TOOL,
|
||||
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
|
||||
NULL, m_eventDispatcher );
|
||||
}
|
||||
else
|
||||
{
|
||||
// While loops are used to be sure, that we are removing all event handlers
|
||||
while( m_parent->Disconnect( wxEVT_TOOL,
|
||||
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
|
||||
NULL, m_eventDispatcher ) );
|
||||
}
|
||||
#else
|
||||
if( m_eventDispatcher )
|
||||
{
|
||||
m_parent->Connect( wxEVT_COMMAND_MENU_SELECTED,
|
||||
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
|
||||
NULL, m_eventDispatcher );
|
||||
|
||||
m_parent->Connect( wxEVT_COMMAND_TOOL_CLICKED,
|
||||
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
|
||||
NULL, m_eventDispatcher );
|
||||
}
|
||||
else
|
||||
{
|
||||
// While loops are used to be sure, that we are removing all event handlers
|
||||
while( m_parent->Disconnect( wxEVT_COMMAND_MENU_SELECTED,
|
||||
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
|
||||
NULL, m_eventDispatcher ) );
|
||||
|
||||
while( m_parent->Disconnect( wxEVT_COMMAND_TOOL_CLICKED,
|
||||
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
|
||||
NULL, m_eventDispatcher ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::StartDrawing()
|
||||
{
|
||||
m_pendingRefresh = false;
|
||||
|
@ -201,10 +243,32 @@ void EDA_DRAW_PANEL_GAL::StopDrawing()
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::RENDER_SETTINGS* rSettings = m_view->GetPainter()->GetSettings();
|
||||
|
||||
SetTopLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
m_view->UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetTopLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
m_view->ClearTopLayers();
|
||||
m_view->SetTopLayer( aLayer );
|
||||
m_view->UpdateAllLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
|
||||
{
|
||||
// Do not do anything if the currently used GAL is correct
|
||||
if( aGalType == m_currentGal && m_gal != NULL )
|
||||
if( aGalType == m_backend && m_gal != NULL )
|
||||
return;
|
||||
|
||||
// Prevent refreshing canvas during backend switch
|
||||
|
@ -235,21 +299,16 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
|
|||
if( m_view )
|
||||
m_view->SetGAL( m_gal );
|
||||
|
||||
m_currentGal = aGalType;
|
||||
m_backend = aGalType;
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::onEvent( wxEvent& aEvent )
|
||||
{
|
||||
if( !m_eventDispatcher )
|
||||
{
|
||||
aEvent.Skip();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eventDispatcher->DispatchWxEvent( aEvent );
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
@ -260,10 +319,3 @@ void EDA_DRAW_PANEL_GAL::onEnter( wxEvent& aEvent )
|
|||
// Getting focus is necessary in order to receive key events properly
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::skipEvent( wxEvent& aEvent )
|
||||
{
|
||||
// This is necessary for CHAR_HOOK event to generate KEY_UP and KEY_DOWN events
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ void CAIRO_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
|
|||
{
|
||||
clean();
|
||||
|
||||
assert( m_width > 0 );
|
||||
assert( m_height > 0 );
|
||||
|
||||
m_width = aWidth;
|
||||
m_height = aHeight;
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
|||
|
||||
SetSize( aParent->GetSize() );
|
||||
screenSize = VECTOR2I( aParent->GetSize() );
|
||||
|
||||
cursorPixels = NULL;
|
||||
cursorPixelsSaved = NULL;
|
||||
initCursor();
|
||||
|
||||
// Grid color settings are different in Cairo and OpenGL
|
||||
|
@ -808,6 +811,13 @@ void CAIRO_GAL::ClearTarget( RENDER_TARGET aTarget )
|
|||
}
|
||||
|
||||
|
||||
void CAIRO_GAL::SetCursorSize( unsigned int aCursorSize )
|
||||
{
|
||||
GAL::SetCursorSize( aCursorSize );
|
||||
initCursor();
|
||||
}
|
||||
|
||||
|
||||
void CAIRO_GAL::DrawCursor( const VECTOR2D& aCursorPosition )
|
||||
{
|
||||
// Now we should only store the position of the mouse cursor
|
||||
|
@ -890,6 +900,12 @@ void CAIRO_GAL::skipMouseEvent( wxMouseEvent& aEvent )
|
|||
|
||||
void CAIRO_GAL::initCursor()
|
||||
{
|
||||
if( cursorPixels )
|
||||
delete cursorPixels;
|
||||
|
||||
if( cursorPixelsSaved )
|
||||
delete cursorPixelsSaved;
|
||||
|
||||
cursorPixels = new wxBitmap( cursorSize, cursorSize );
|
||||
cursorPixelsSaved = new wxBitmap( cursorSize, cursorSize );
|
||||
|
||||
|
|
|
@ -134,9 +134,6 @@ void GAL::DrawGrid()
|
|||
// Draw the grid
|
||||
// For the drawing the start points, end points and increments have
|
||||
// to be calculated in world coordinates
|
||||
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
|
||||
(long) gridOrigin.y % (long) gridSize.y );
|
||||
|
||||
VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
|
||||
VECTOR2D worldEndPoint = screenWorldMatrix * VECTOR2D( screenSize );
|
||||
|
||||
|
@ -160,10 +157,10 @@ void GAL::DrawGrid()
|
|||
assert( gridEndY >= gridStartY );
|
||||
|
||||
// Correct the index, else some lines are not correctly painted
|
||||
gridStartX -= ( gridOrigin.x / gridSize.x ) + 1;
|
||||
gridStartY -= ( gridOrigin.y / gridSize.y ) + 1;
|
||||
gridEndX += ( gridOrigin.x / gridSize.x ) + 1;
|
||||
gridEndY += ( gridOrigin.y / gridSize.y ) + 1;
|
||||
gridStartX -= abs( gridOrigin.x / gridSize.x ) + 1;
|
||||
gridStartY -= abs( gridOrigin.y / gridSize.y ) + 1;
|
||||
gridEndX += abs( gridOrigin.x / gridSize.x ) + 1;
|
||||
gridEndY += abs( gridOrigin.y / gridSize.y ) + 1;
|
||||
|
||||
// Draw the grid behind all other layers
|
||||
SetLayerDepth( depthRange.y * 0.75 );
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
using namespace KIGFX;
|
||||
|
||||
OPENGL_COMPOSITOR::OPENGL_COMPOSITOR() :
|
||||
m_initialized( false ), m_current( 0 )
|
||||
m_initialized( false ), m_current( 0 ), m_currentFbo( DIRECT_RENDERING )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,6 @@ void OPENGL_COMPOSITOR::Initialize()
|
|||
if( m_initialized )
|
||||
return;
|
||||
|
||||
// Get the maximum number of buffers
|
||||
glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &m_maxBuffers );
|
||||
|
||||
// We need framebuffer objects for drawing the screen contents
|
||||
// Generate framebuffer and a depth buffer
|
||||
glGenFramebuffersEXT( 1, &m_framebuffer );
|
||||
|
@ -68,15 +65,13 @@ void OPENGL_COMPOSITOR::Initialize()
|
|||
|
||||
// Use here a size of 24 bits for the depth buffer, 8 bits for the stencil buffer
|
||||
// this is required later for anti-aliasing
|
||||
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL, m_width, m_height );
|
||||
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, m_width, m_height );
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER_EXT, m_depthBuffer );
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER_EXT, m_depthBuffer );
|
||||
|
||||
// Unbind the framebuffer, so by default all the rendering goes directly to the display
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, DIRECT_RENDERING );
|
||||
m_currentFbo = 0;
|
||||
m_currentFbo = DIRECT_RENDERING;
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
@ -96,9 +91,14 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
|||
{
|
||||
wxASSERT( m_initialized );
|
||||
|
||||
if( usedBuffers() >= m_maxBuffers )
|
||||
unsigned int maxBuffers;
|
||||
|
||||
// Get the maximum number of buffers
|
||||
glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &maxBuffers );
|
||||
|
||||
if( usedBuffers() >= maxBuffers )
|
||||
{
|
||||
DisplayError( NULL, wxT( "Cannot create more framebuffers. OpenGL rendering "
|
||||
DisplayError( NULL, _( "Cannot create more framebuffers. OpenGL rendering "
|
||||
"backend requires at least 3 framebuffers. You may try to update/change "
|
||||
"your graphic drivers." ) );
|
||||
return 0; // Unfortunately we have no more free buffers left
|
||||
|
@ -114,7 +114,7 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
|||
|
||||
// Set texture parameters
|
||||
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, m_width, m_height, 0, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, NULL );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
|
@ -122,7 +122,8 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
|||
// Bind the texture to the specific attachment point, clear and rebind the screen
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_framebuffer );
|
||||
m_currentFbo = m_framebuffer;
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachmentPoint, GL_TEXTURE_2D, textureTarget, 0 );
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachmentPoint,
|
||||
GL_TEXTURE_2D, textureTarget, 0 );
|
||||
|
||||
// Check the status, exit if the framebuffer can't be created
|
||||
GLenum status = glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT );
|
||||
|
@ -132,38 +133,38 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
|||
switch( status )
|
||||
{
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||
DisplayError( NULL, wxT( "Cannot create the framebuffer." ) );
|
||||
DisplayError( NULL, _( "Cannot create the framebuffer." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||
DisplayError( NULL, wxT( "The framebuffer attachment points are incomplete." ) );
|
||||
DisplayError( NULL, _( "The framebuffer attachment points are incomplete." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||
DisplayError( NULL, wxT( "The framebuffer does not have at least "
|
||||
DisplayError( NULL, _( "The framebuffer does not have at least "
|
||||
"one image attached to it." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||
DisplayError( NULL, wxT( "The framebuffer read buffer is incomplete." ) );
|
||||
DisplayError( NULL, _( "The framebuffer read buffer is incomplete." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||
DisplayError( NULL, wxT( "The combination of internal formats of the attached images "
|
||||
DisplayError( NULL, _( "The combination of internal formats of the attached images "
|
||||
"violates an implementation-dependent set of restrictions." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
||||
DisplayError( NULL, wxT( "GL_RENDERBUFFER_SAMPLES is not the same "
|
||||
DisplayError( NULL, _( "GL_RENDERBUFFER_SAMPLES is not the same "
|
||||
"for all attached renderbuffers" ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
|
||||
DisplayError( NULL, wxT( "Framebuffer incomplete layer targets errors." ) );
|
||||
DisplayError( NULL, _( "Framebuffer incomplete layer targets errors." ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( NULL, wxT( "Cannot create the framebuffer." ) );
|
||||
DisplayError( NULL, _( "Cannot create the framebuffer." ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -192,7 +193,6 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
|||
// Change the rendering destination to the selected attachment point
|
||||
if( aBufferHandle == DIRECT_RENDERING )
|
||||
{
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, DIRECT_RENDERING );
|
||||
m_currentFbo = DIRECT_RENDERING;
|
||||
}
|
||||
else if( m_currentFbo != m_framebuffer )
|
||||
|
@ -221,12 +221,7 @@ void OPENGL_COMPOSITOR::ClearBuffer()
|
|||
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
|
||||
{
|
||||
wxASSERT( m_initialized );
|
||||
|
||||
if( aBufferHandle == 0 || aBufferHandle > usedBuffers() )
|
||||
{
|
||||
DisplayError( NULL, wxT( "Wrong framebuffer handle" ) );
|
||||
return;
|
||||
}
|
||||
wxASSERT( aBufferHandle != 0 && aBufferHandle <= usedBuffers() );
|
||||
|
||||
// Switch to the main framebuffer and blit the scene
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER, DIRECT_RENDERING );
|
||||
|
@ -274,8 +269,8 @@ void OPENGL_COMPOSITOR::clean()
|
|||
{
|
||||
wxASSERT( m_initialized );
|
||||
|
||||
glDeleteFramebuffersEXT( 1, &m_framebuffer );
|
||||
glDeleteRenderbuffersEXT( 1, &m_depthBuffer );
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER, DIRECT_RENDERING );
|
||||
m_currentFbo = DIRECT_RENDERING;
|
||||
|
||||
OPENGL_BUFFERS::const_iterator it;
|
||||
|
||||
|
@ -286,8 +281,8 @@ void OPENGL_COMPOSITOR::clean()
|
|||
|
||||
m_buffers.clear();
|
||||
|
||||
glDeleteFramebuffersEXT( 1, &m_framebuffer );
|
||||
glDeleteRenderbuffersEXT( 1, &m_depthBuffer );
|
||||
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
GLuint OPENGL_COMPOSITOR::m_currentFbo = DIRECT_RENDERING;
|
||||
|
|
|
@ -45,6 +45,8 @@ void InitTesselatorCallbacks( GLUtesselator* aTesselator );
|
|||
|
||||
const int glAttributes[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 };
|
||||
|
||||
wxGLContext* OPENGL_GAL::glContext = NULL;
|
||||
|
||||
OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
||||
wxEvtHandler* aPaintListener, const wxString& aName ) :
|
||||
wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize,
|
||||
|
@ -54,7 +56,9 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
|||
overlayManager( false )
|
||||
{
|
||||
// Create the OpenGL-Context
|
||||
if( glContext == NULL )
|
||||
glContext = new wxGLContext( this );
|
||||
|
||||
parentWindow = aParent;
|
||||
mouseListener = aMouseListener;
|
||||
paintListener = aPaintListener;
|
||||
|
@ -113,8 +117,6 @@ OPENGL_GAL::~OPENGL_GAL()
|
|||
|
||||
gluDeleteTess( tesselator );
|
||||
ClearCache();
|
||||
|
||||
delete glContext;
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,23 +124,22 @@ void OPENGL_GAL::BeginDrawing()
|
|||
{
|
||||
SetCurrent( *glContext );
|
||||
|
||||
clientDC = new wxClientDC( this );
|
||||
clientDC = new wxPaintDC( this );
|
||||
|
||||
// Initialize GLEW, FBOs & VBOs
|
||||
if( !isGlewInitialized )
|
||||
initGlew();
|
||||
|
||||
if( !isFramebufferInitialized )
|
||||
{
|
||||
// Set up the view port
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glViewport( 0, 0, (GLsizei) screenSize.x, (GLsizei) screenSize.y );
|
||||
|
||||
// Create the screen transformation
|
||||
glOrtho( 0, (GLint) screenSize.x, 0, (GLsizei) screenSize.y,
|
||||
-depthRange.x, -depthRange.y );
|
||||
glOrtho( 0, (GLint) screenSize.x, 0, (GLsizei) screenSize.y, -depthRange.x, -depthRange.y );
|
||||
|
||||
if( !isFramebufferInitialized )
|
||||
{
|
||||
// Prepare rendering target buffers
|
||||
compositor.Initialize();
|
||||
mainBuffer = compositor.CreateBuffer();
|
||||
|
@ -967,7 +968,7 @@ void OPENGL_GAL::initGlew()
|
|||
exit( 1 );
|
||||
}
|
||||
|
||||
// Vertex buffer have to be supported
|
||||
// Vertex buffer has to be supported
|
||||
if( !GLEW_ARB_vertex_buffer_object )
|
||||
{
|
||||
DisplayError( parentWindow, wxT( "Vertex buffer objects are not supported!" ) );
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
#include <gal/opengl/cached_container.h>
|
||||
#include <gal/opengl/noncached_container.h>
|
||||
#include <gal/opengl/shader.h>
|
||||
#include <wx/log.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
|
@ -45,9 +46,11 @@ VERTEX_CONTAINER* VERTEX_CONTAINER::MakeContainer( bool aCached )
|
|||
|
||||
|
||||
VERTEX_CONTAINER::VERTEX_CONTAINER( unsigned int aSize ) :
|
||||
m_freeSpace( aSize ), m_currentSize( aSize ), m_initialSize( aSize ), m_failed( false )
|
||||
m_freeSpace( aSize ), m_currentSize( aSize ), m_initialSize( aSize ),
|
||||
m_failed( false ), m_dirty( true )
|
||||
{
|
||||
m_vertices = static_cast<VERTEX*>( malloc( aSize * sizeof( VERTEX ) ) );
|
||||
memset( m_vertices, 0x00, aSize * sizeof( VERTEX ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ RENDER_SETTINGS::RENDER_SETTINGS()
|
|||
m_highlightEnabled = false;
|
||||
m_hiContrastEnabled = false;
|
||||
m_hiContrastFactor = 0.2;
|
||||
m_highlightNetcode = -1;
|
||||
m_outlineWidth = 1;
|
||||
m_worksheetLineWidth = 100000;
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@ ACTION_MANAGER::~ACTION_MANAGER()
|
|||
|
||||
void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
|
||||
{
|
||||
// Check if the TOOL_ACTION was not registered before
|
||||
assert( aAction->GetId() == -1 );
|
||||
// TOOL_ACTIONs are supposed to be named [appName.]toolName.actionName (with dots between)
|
||||
// action name without specifying at least toolName is not valid
|
||||
assert( aAction->GetName().find( '.', 0 ) != std::string::npos );
|
||||
|
@ -54,15 +52,14 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
|
|||
assert( m_actionNameIndex.find( aAction->m_name ) == m_actionNameIndex.end() );
|
||||
assert( m_actionIdIndex.find( aAction->m_id ) == m_actionIdIndex.end() );
|
||||
|
||||
aAction->setId( MakeActionId( aAction->m_name ) );
|
||||
if( aAction->m_id == -1 )
|
||||
aAction->m_id = MakeActionId( aAction->m_name );
|
||||
|
||||
m_actionNameIndex[aAction->m_name] = aAction;
|
||||
m_actionIdIndex[aAction->m_id] = aAction;
|
||||
|
||||
if( aAction->HasHotKey() )
|
||||
m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction );
|
||||
|
||||
aAction->setActionMgr( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,10 +68,6 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction )
|
|||
m_actionNameIndex.erase( aAction->m_name );
|
||||
m_actionIdIndex.erase( aAction->m_id );
|
||||
|
||||
// Indicate that the ACTION_MANAGER no longer care about the object
|
||||
aAction->setActionMgr( NULL );
|
||||
aAction->setId( -1 );
|
||||
|
||||
if( aAction->HasHotKey() )
|
||||
{
|
||||
std::list<TOOL_ACTION*>& actions = m_actionHotKeys[aAction->m_currentHotKey];
|
||||
|
@ -96,24 +89,14 @@ int ACTION_MANAGER::MakeActionId( const std::string& aActionName )
|
|||
}
|
||||
|
||||
|
||||
bool ACTION_MANAGER::RunAction( const std::string& aActionName ) const
|
||||
TOOL_ACTION* ACTION_MANAGER::FindAction( const std::string& aActionName ) const
|
||||
{
|
||||
std::map<std::string, TOOL_ACTION*>::const_iterator it = m_actionNameIndex.find( aActionName );
|
||||
|
||||
if( it == m_actionNameIndex.end() )
|
||||
return false; // no action with given name found
|
||||
if( it != m_actionNameIndex.end() )
|
||||
return it->second;
|
||||
|
||||
RunAction( it->second );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ACTION_MANAGER::RunAction( const TOOL_ACTION* aAction ) const
|
||||
{
|
||||
TOOL_EVENT event = aAction->MakeEvent();
|
||||
|
||||
m_toolMgr->ProcessEvent( event );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,6 +143,8 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
|
|||
|
||||
if( tool )
|
||||
{
|
||||
// Choose the action that goes to the tool with highest priority
|
||||
// (i.e. is on the top of active tools stack)
|
||||
priority = m_toolMgr->GetPriority( tool->GetId() );
|
||||
|
||||
if( priority >= 0 && priority > highestPriority )
|
||||
|
@ -170,13 +155,16 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
|
|||
}
|
||||
}
|
||||
|
||||
if( !global && !context ) // currently there is no valid action to run
|
||||
return false;
|
||||
|
||||
if( context )
|
||||
RunAction( context );
|
||||
else if( global )
|
||||
RunAction( global );
|
||||
|
||||
{
|
||||
m_toolMgr->RunAction( *context, true );
|
||||
return true;
|
||||
}
|
||||
else if( global )
|
||||
{
|
||||
m_toolMgr->RunAction( *global, true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,47 @@ CONTEXT_MENU::CONTEXT_MENU( const CONTEXT_MENU& aMenu ) :
|
|||
}
|
||||
|
||||
|
||||
CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
|
||||
{
|
||||
Clear();
|
||||
|
||||
m_titleSet = aMenu.m_titleSet;
|
||||
m_selected = aMenu.m_selected;
|
||||
m_tool = aMenu.m_tool;
|
||||
m_toolActions = aMenu.m_toolActions;
|
||||
m_customHandler = aMenu.m_customHandler;
|
||||
|
||||
// Copy all the menu entries
|
||||
for( unsigned i = 0; i < aMenu.GetMenuItemCount(); ++i )
|
||||
{
|
||||
wxMenuItem* item = aMenu.FindItemByPosition( i );
|
||||
|
||||
if( item->IsSubMenu() )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
|
||||
assert( dynamic_cast<CONTEXT_MENU*>( item->GetSubMenu() ) );
|
||||
#endif
|
||||
|
||||
CONTEXT_MENU* menu = new CONTEXT_MENU( static_cast<const CONTEXT_MENU&>( *item->GetSubMenu() ) );
|
||||
AppendSubMenu( menu, item->GetItemLabel(), wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMenuItem* newItem = new wxMenuItem( this, item->GetId(), item->GetItemLabel(),
|
||||
wxEmptyString, item->GetKind() );
|
||||
|
||||
Append( newItem );
|
||||
copyItem( item, newItem );
|
||||
}
|
||||
}
|
||||
|
||||
setupEvents();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::setupEvents()
|
||||
{
|
||||
Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
|
@ -144,11 +185,12 @@ void CONTEXT_MENU::Clear()
|
|||
{
|
||||
m_titleSet = false;
|
||||
|
||||
// Remove all the entries from context menu
|
||||
for( unsigned i = 0; i < GetMenuItemCount(); ++i )
|
||||
Destroy( FindItemByPosition( 0 ) );
|
||||
|
||||
GetMenuItems().DeleteContents( true );
|
||||
GetMenuItems().Clear();
|
||||
m_toolActions.clear();
|
||||
GetMenuItems().DeleteContents( false ); // restore the default so destructor does not go wild
|
||||
|
||||
assert( GetMenuItemCount() == 0 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <tool/tool_action.h>
|
||||
|
||||
std::string TOOL_ACTION::GetToolName() const
|
||||
{
|
||||
int dotCount = std::count( m_name.begin(), m_name.end(), '.' );
|
||||
|
||||
switch( dotCount )
|
||||
{
|
||||
case 0:
|
||||
assert( false ); // Invalid action name format
|
||||
return "";
|
||||
|
||||
case 1:
|
||||
return m_name;
|
||||
|
||||
case 2:
|
||||
return m_name.substr( 0, m_name.rfind( '.' ) );
|
||||
|
||||
default:
|
||||
assert( false ); // TODO not implemented
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -88,8 +88,8 @@ struct TOOL_DISPATCHER::BUTTON_STATE
|
|||
};
|
||||
|
||||
|
||||
TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame ) :
|
||||
m_toolMgr( aToolMgr ), m_editFrame( aEditFrame )
|
||||
TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr ) :
|
||||
m_toolMgr( aToolMgr )
|
||||
{
|
||||
m_buttons.push_back( new BUTTON_STATE( BUT_LEFT, wxEVT_LEFT_DOWN,
|
||||
wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK ) );
|
||||
|
@ -118,7 +118,7 @@ void TOOL_DISPATCHER::ResetState()
|
|||
|
||||
KIGFX::VIEW* TOOL_DISPATCHER::getView()
|
||||
{
|
||||
return m_editFrame->GetGalCanvas()->GetView();
|
||||
return static_cast<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->GetGalCanvas()->GetView();
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,7 +229,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
{
|
||||
motion = true;
|
||||
m_lastMousePos = pos;
|
||||
m_editFrame->UpdateStatusBar();
|
||||
static_cast<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->UpdateStatusBar();
|
||||
}
|
||||
|
||||
for( unsigned int i = 0; i < m_buttons.size(); i++ )
|
||||
|
@ -245,7 +245,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
// TODO That's a big ugly workaround, somehow DRAWPANEL_GAL loses focus
|
||||
// after second LMB click and currently I have no means to do better debugging
|
||||
if( type == wxEVT_LEFT_UP )
|
||||
m_editFrame->GetGalCanvas()->SetFocus();
|
||||
static_cast<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->GetGalCanvas()->SetFocus();
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
|
@ -288,27 +288,10 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
|
||||
void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent )
|
||||
{
|
||||
boost::optional<TOOL_EVENT> evt;
|
||||
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_ZOOM_IN: // toolbar button "Zoom In"
|
||||
evt = COMMON_ACTIONS::zoomInCenter.MakeEvent();
|
||||
break;
|
||||
|
||||
case ID_ZOOM_OUT: // toolbar button "Zoom In"
|
||||
evt = COMMON_ACTIONS::zoomOutCenter.MakeEvent();
|
||||
break;
|
||||
|
||||
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
|
||||
evt = COMMON_ACTIONS::zoomFitScreen.MakeEvent();
|
||||
break;
|
||||
|
||||
default:
|
||||
aEvent.Skip();
|
||||
break;
|
||||
}
|
||||
boost::optional<TOOL_EVENT> evt = COMMON_ACTIONS::TranslateLegacyId( aEvent.GetId() );
|
||||
|
||||
if( evt )
|
||||
m_toolMgr->ProcessEvent( *evt );
|
||||
else
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ const std::string TOOL_EVENT::Format() const
|
|||
{ TA_CONTEXT_MENU_CHOICE, "context-menu-choice" },
|
||||
{ TA_UNDO_REDO, "undo-redo" },
|
||||
{ TA_ACTION, "action" },
|
||||
{ TA_ACTIVATE, "activate" },
|
||||
{ 0, "" }
|
||||
};
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <stack>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
@ -32,8 +34,10 @@
|
|||
#include <boost/range/adaptor/map.hpp>
|
||||
|
||||
#include <wx/event.h>
|
||||
#include <wx/clipbrd.h>
|
||||
|
||||
#include <view/view.h>
|
||||
#include <view/view_controls.h>
|
||||
|
||||
#include <tool/tool_base.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
|
@ -51,6 +55,32 @@ using boost::optional;
|
|||
/// Struct describing the current execution state of a TOOL
|
||||
struct TOOL_MANAGER::TOOL_STATE
|
||||
{
|
||||
TOOL_STATE( TOOL_BASE* aTool ) :
|
||||
theTool( aTool )
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
TOOL_STATE( const TOOL_STATE& aState )
|
||||
{
|
||||
theTool = aState.theTool;
|
||||
idle = aState.idle;
|
||||
pendingWait = aState.pendingWait;
|
||||
pendingContextMenu = aState.pendingContextMenu;
|
||||
contextMenu = aState.contextMenu;
|
||||
contextMenuTrigger = aState.contextMenuTrigger;
|
||||
cofunc = aState.cofunc;
|
||||
wakeupEvent = aState.wakeupEvent;
|
||||
waitEvents = aState.waitEvents;
|
||||
transitions = aState.transitions;
|
||||
// do not copy stateStack
|
||||
}
|
||||
|
||||
~TOOL_STATE()
|
||||
{
|
||||
assert( stateStack.empty() );
|
||||
}
|
||||
|
||||
/// The tool itself
|
||||
TOOL_BASE* theTool;
|
||||
|
||||
|
@ -83,6 +113,21 @@ struct TOOL_MANAGER::TOOL_STATE
|
|||
/// upon the event reception
|
||||
std::vector<TRANSITION> transitions;
|
||||
|
||||
void operator=( const TOOL_STATE& aState )
|
||||
{
|
||||
theTool = aState.theTool;
|
||||
idle = aState.idle;
|
||||
pendingWait = aState.pendingWait;
|
||||
pendingContextMenu = aState.pendingContextMenu;
|
||||
contextMenu = aState.contextMenu;
|
||||
contextMenuTrigger = aState.contextMenuTrigger;
|
||||
cofunc = aState.cofunc;
|
||||
wakeupEvent = aState.wakeupEvent;
|
||||
waitEvents = aState.waitEvents;
|
||||
transitions = aState.transitions;
|
||||
// do not copy stateStack
|
||||
}
|
||||
|
||||
bool operator==( const TOOL_MANAGER::TOOL_STATE& aRhs ) const
|
||||
{
|
||||
return aRhs.theTool == this->theTool;
|
||||
|
@ -92,6 +137,59 @@ struct TOOL_MANAGER::TOOL_STATE
|
|||
{
|
||||
return aRhs.theTool != this->theTool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Push()
|
||||
* Stores the current state of the tool on stack. Stacks are stored internally and are not
|
||||
* shared between different TOOL_STATE objects.
|
||||
*/
|
||||
void Push()
|
||||
{
|
||||
stateStack.push( *this );
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Pop()
|
||||
* Restores state of the tool from stack. Stacks are stored internally and are not
|
||||
* shared between different TOOL_STATE objects.
|
||||
* @return True if state was restored, false if the stack was empty.
|
||||
*/
|
||||
bool Pop()
|
||||
{
|
||||
delete cofunc;
|
||||
|
||||
if( !stateStack.empty() )
|
||||
{
|
||||
*this = stateStack.top();
|
||||
stateStack.pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cofunc = NULL;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
///> Stack preserving previous states of a TOOL.
|
||||
std::stack<TOOL_STATE> stateStack;
|
||||
|
||||
///> Restores the initial state.
|
||||
void clear()
|
||||
{
|
||||
idle = true;
|
||||
pendingWait = false;
|
||||
pendingContextMenu = false;
|
||||
cofunc = NULL;
|
||||
contextMenu = NULL;
|
||||
contextMenuTrigger = CMENU_OFF;
|
||||
transitions.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -99,6 +197,11 @@ TOOL_MANAGER::TOOL_MANAGER() :
|
|||
m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL )
|
||||
{
|
||||
m_actionMgr = new ACTION_MANAGER( this );
|
||||
|
||||
// Register known actions
|
||||
std::list<TOOL_ACTION*>& actionList = GetActionList();
|
||||
BOOST_FOREACH( TOOL_ACTION* action, actionList )
|
||||
RegisterAction( action );
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,7 +216,6 @@ TOOL_MANAGER::~TOOL_MANAGER()
|
|||
delete it->first; // delete the tool itself
|
||||
}
|
||||
|
||||
m_toolState.clear();
|
||||
delete m_actionMgr;
|
||||
}
|
||||
|
||||
|
@ -124,18 +226,15 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
|
|||
wxT( "Adding two tools with the same name may result in unexpected behaviour.") );
|
||||
wxASSERT_MSG( m_toolIdIndex.find( aTool->GetId() ) == m_toolIdIndex.end(),
|
||||
wxT( "Adding two tools with the same ID may result in unexpected behaviour.") );
|
||||
wxASSERT_MSG( m_toolTypes.find( typeid( *aTool ).name() ) == m_toolTypes.end(),
|
||||
wxT( "Adding two tools of the same type may result in unexpected behaviour.") );
|
||||
|
||||
TOOL_STATE* st = new TOOL_STATE;
|
||||
|
||||
st->theTool = aTool;
|
||||
st->pendingWait = false;
|
||||
st->pendingContextMenu = false;
|
||||
st->cofunc = NULL;
|
||||
st->contextMenuTrigger = CMENU_OFF;
|
||||
TOOL_STATE* st = new TOOL_STATE( aTool );
|
||||
|
||||
m_toolState[aTool] = st;
|
||||
m_toolNameIndex[aTool->GetName()] = st;
|
||||
m_toolIdIndex[aTool->GetId()] = st;
|
||||
m_toolTypes[typeid( *aTool ).name()] = st->theTool;
|
||||
|
||||
aTool->m_toolMgr = this;
|
||||
|
||||
|
@ -150,6 +249,7 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
|
|||
m_toolState.erase( aTool );
|
||||
m_toolNameIndex.erase( aTool->GetName() );
|
||||
m_toolIdIndex.erase( aTool->GetId() );
|
||||
m_toolTypes.erase( typeid( *aTool ).name() );
|
||||
|
||||
delete st;
|
||||
delete aTool;
|
||||
|
@ -191,15 +291,40 @@ void TOOL_MANAGER::UnregisterAction( TOOL_ACTION* aAction )
|
|||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::RunAction( const std::string& aActionName )
|
||||
bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow )
|
||||
{
|
||||
return m_actionMgr->RunAction( aActionName );
|
||||
TOOL_ACTION* action = m_actionMgr->FindAction( aActionName );
|
||||
|
||||
if( action )
|
||||
{
|
||||
if( aNow )
|
||||
{
|
||||
TOOL_EVENT event = action->MakeEvent();
|
||||
ProcessEvent( event );
|
||||
}
|
||||
else
|
||||
{
|
||||
PostEvent( action->MakeEvent() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction )
|
||||
void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow )
|
||||
{
|
||||
m_actionMgr->RunAction( &aAction );
|
||||
if( aNow )
|
||||
{
|
||||
TOOL_EVENT event = aAction.MakeEvent();
|
||||
ProcessEvent( event );
|
||||
}
|
||||
else
|
||||
{
|
||||
PostEvent( aAction.MakeEvent() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,7 +332,7 @@ bool TOOL_MANAGER::invokeTool( TOOL_BASE* aTool )
|
|||
{
|
||||
wxASSERT( aTool != NULL );
|
||||
|
||||
TOOL_EVENT evt( TC_COMMAND, TA_ACTION, aTool->GetName() );
|
||||
TOOL_EVENT evt( TC_COMMAND, TA_ACTIVATE, aTool->GetName() );
|
||||
ProcessEvent( evt );
|
||||
|
||||
return true;
|
||||
|
@ -325,6 +450,8 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
|
|||
{
|
||||
TOOL_STATE* st = m_toolState[aTool];
|
||||
|
||||
assert( !st->pendingWait ); // everything collapses on two Yield() in a row
|
||||
|
||||
// indicate to the manager that we are going to sleep and we shall be
|
||||
// woken up when an event matching aConditions arrive
|
||||
st->pendingWait = true;
|
||||
|
@ -349,8 +476,8 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( st->waitEvents.Matches( aEvent ) )
|
||||
{
|
||||
// By default, already processed events are not passed further
|
||||
m_passEvent = false;
|
||||
// By default, only messages are passed further
|
||||
m_passEvent = ( aEvent.m_category == TC_MESSAGE );
|
||||
|
||||
// got matching event? clear wait list and wake up the coroutine
|
||||
st->wakeupEvent = aEvent;
|
||||
|
@ -369,26 +496,23 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
BOOST_FOREACH( TOOL_STATE* st, m_toolState | boost::adaptors::map_values )
|
||||
{
|
||||
// the tool scheduled next state(s) by calling Go()
|
||||
if( !st->pendingWait )
|
||||
{
|
||||
// no state handler in progress - check if there are any transitions (defined by
|
||||
// Go() method that match the event.
|
||||
if( st->transitions.size() )
|
||||
if( !st->pendingWait && !st->transitions.empty() )
|
||||
{
|
||||
BOOST_FOREACH( TRANSITION& tr, st->transitions )
|
||||
{
|
||||
if( tr.first.Matches( aEvent ) )
|
||||
{
|
||||
// if there is already a context, then store it
|
||||
if( st->cofunc )
|
||||
st->Push();
|
||||
|
||||
// as the state changes, the transition table has to be set up again
|
||||
st->transitions.clear();
|
||||
|
||||
// no tool context allocated yet? Create one.
|
||||
if( !st->cofunc )
|
||||
st->cofunc = new COROUTINE<int, TOOL_EVENT&>( tr.second );
|
||||
else
|
||||
st->cofunc->SetEntry( tr.second );
|
||||
|
||||
// got match? Run the handler.
|
||||
st->cofunc->Call( aEvent );
|
||||
|
@ -403,7 +527,6 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
|
||||
|
@ -414,11 +537,6 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
|
|||
if( m_actionMgr->RunHotKey( aEvent.Modifier() | aEvent.KeyCode() ) )
|
||||
return false; // hotkey event was handled so it does not go any further
|
||||
}
|
||||
else if( aEvent.Category() == TC_COMMAND ) // it may be a tool activation event
|
||||
{
|
||||
dispatchActivation( aEvent );
|
||||
// do not return false, as the event has to go on to the destined tool
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -426,12 +544,13 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
|
|||
|
||||
bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Look for the tool that has the same name as parameter in the processed command TOOL_EVENT
|
||||
BOOST_FOREACH( TOOL_STATE* st, m_toolState | boost::adaptors::map_values )
|
||||
if( aEvent.IsActivate() )
|
||||
{
|
||||
if( st->theTool->GetName() == aEvent.m_commandStr )
|
||||
std::map<std::string, TOOL_STATE*>::iterator tool = m_toolNameIndex.find( *aEvent.m_commandStr );
|
||||
|
||||
if( tool != m_toolNameIndex.end() )
|
||||
{
|
||||
runTool( st->theTool );
|
||||
runTool( tool->second->theTool );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -440,36 +559,8 @@ bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
|
||||
void TOOL_MANAGER::dispatchContextMenu( TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::deque<TOOL_ID>::iterator it, itEnd;
|
||||
|
||||
// Find the tool and deactivate it
|
||||
for( it = m_activeTools.begin(), itEnd = m_activeTools.end(); it != itEnd; ++it )
|
||||
{
|
||||
if( aState == m_toolIdIndex[*it] )
|
||||
{
|
||||
m_activeTools.erase( it );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete aState->cofunc;
|
||||
aState->cofunc = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
||||
{
|
||||
// wxLogDebug( "event: %s", aEvent.Format().c_str() );
|
||||
|
||||
// Early dispatch of events destined for the TOOL_MANAGER
|
||||
if( !dispatchStandardEvents( aEvent ) )
|
||||
return false;
|
||||
|
||||
dispatchInternal( aEvent );
|
||||
|
||||
// popup menu handling
|
||||
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
|
||||
{
|
||||
TOOL_STATE* st = m_toolIdIndex[toolId];
|
||||
|
@ -487,6 +578,10 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
|||
if( st->contextMenuTrigger == CMENU_NOW )
|
||||
st->contextMenuTrigger = CMENU_OFF;
|
||||
|
||||
// Temporarily store the cursor position, so the tools could execute actions
|
||||
// using the point where the user has invoked a context menu
|
||||
m_viewControls->ForceCursorPosition( true, m_viewControls->GetCursorPosition() );
|
||||
|
||||
boost::scoped_ptr<CONTEXT_MENU> menu( new CONTEXT_MENU( *st->contextMenu ) );
|
||||
GetEditFrame()->PopupMenu( menu.get() );
|
||||
|
||||
|
@ -497,9 +592,45 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
|||
dispatchInternal( evt );
|
||||
}
|
||||
|
||||
m_viewControls->ForceCursorPosition( false );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
|
||||
{
|
||||
if( !aState->Pop() ) // if there are no other contexts saved on the stack
|
||||
{
|
||||
// find the tool and deactivate it
|
||||
std::deque<TOOL_ID>::iterator tool = std::find( m_activeTools.begin(), m_activeTools.end(),
|
||||
aState->theTool->GetId() );
|
||||
|
||||
if( tool != m_activeTools.end() )
|
||||
m_activeTools.erase( tool );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Early dispatch of events destined for the TOOL_MANAGER
|
||||
if( !dispatchStandardEvents( aEvent ) )
|
||||
return false;
|
||||
|
||||
dispatchInternal( aEvent );
|
||||
dispatchActivation( aEvent );
|
||||
dispatchContextMenu( aEvent );
|
||||
|
||||
// Dispatch queue
|
||||
while( !m_eventQueue.empty() )
|
||||
{
|
||||
TOOL_EVENT event = m_eventQueue.front();
|
||||
m_eventQueue.pop_front();
|
||||
ProcessEvent( event );
|
||||
}
|
||||
|
||||
if( m_view->IsDirty() )
|
||||
{
|
||||
|
@ -521,6 +652,41 @@ void TOOL_MANAGER::ScheduleContextMenu( TOOL_BASE* aTool, CONTEXT_MENU* aMenu,
|
|||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::SaveClipboard( const std::string& aText )
|
||||
{
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
wxTheClipboard->SetData( new wxTextDataObject( wxString( aText.c_str(), wxConvUTF8 ) ) );
|
||||
wxTheClipboard->Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::string TOOL_MANAGER::GetClipboard() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
|
||||
{
|
||||
wxTextDataObject data;
|
||||
wxTheClipboard->GetData( data );
|
||||
|
||||
result = data.GetText().mb_str();
|
||||
}
|
||||
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
TOOL_ID TOOL_MANAGER::MakeToolId( const std::string& aToolName )
|
||||
{
|
||||
static int currentId;
|
||||
|
|
|
@ -252,9 +252,7 @@ void VIEW::SetGAL( GAL* aGal )
|
|||
clearGroupCache();
|
||||
|
||||
// every target has to be refreshed
|
||||
MarkTargetDirty( TARGET_CACHED );
|
||||
MarkTargetDirty( TARGET_NONCACHED );
|
||||
MarkTargetDirty( TARGET_OVERLAY );
|
||||
MarkDirty();
|
||||
|
||||
// force the new GAL to display the current viewport.
|
||||
SetCenter( m_center );
|
||||
|
@ -274,12 +272,15 @@ BOX2D VIEW::GetViewport() const
|
|||
}
|
||||
|
||||
|
||||
void VIEW::SetViewport( const BOX2D& aViewport, bool aKeepAspect )
|
||||
void VIEW::SetViewport( const BOX2D& aViewport )
|
||||
{
|
||||
VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false );
|
||||
|
||||
wxASSERT( ssize.x > 0 && ssize.y > 0 );
|
||||
|
||||
VECTOR2D centre = aViewport.Centre();
|
||||
VECTOR2D vsize = aViewport.GetSize();
|
||||
double zoom = 1.0 / std::min( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) );
|
||||
double zoom = 1.0 / std::max( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) );
|
||||
|
||||
SetCenter( centre );
|
||||
SetScale( GetScale() * zoom );
|
||||
|
@ -305,7 +306,7 @@ void VIEW::SetScale( double aScale, const VECTOR2D& aAnchor )
|
|||
m_scale = aScale;
|
||||
|
||||
// Redraw everything after the viewport has changed
|
||||
MarkTargetDirty( TARGET_CACHED );
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
|
||||
|
@ -317,7 +318,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter )
|
|||
m_gal->ComputeWorldScreenMatrix();
|
||||
|
||||
// Redraw everything after the viewport has changed
|
||||
MarkTargetDirty( TARGET_CACHED );
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
|
||||
|
@ -574,7 +575,7 @@ struct VIEW::drawItem
|
|||
}
|
||||
|
||||
VIEW* view;
|
||||
int layer, layersCount, layers[VIEW_MAX_LAYERS];
|
||||
int layer, layers[VIEW_MAX_LAYERS];
|
||||
};
|
||||
|
||||
|
||||
|
@ -734,9 +735,7 @@ void VIEW::ClearTargets()
|
|||
m_gal->ClearTarget( TARGET_NONCACHED );
|
||||
m_gal->ClearTarget( TARGET_CACHED );
|
||||
|
||||
MarkTargetDirty( TARGET_NONCACHED );
|
||||
MarkTargetDirty( TARGET_CACHED );
|
||||
MarkTargetDirty( TARGET_OVERLAY );
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
if( IsTargetDirty( TARGET_OVERLAY ) )
|
||||
|
@ -855,7 +854,7 @@ void VIEW::sortLayers()
|
|||
|
||||
sort( m_orderedLayers.begin(), m_orderedLayers.end(), compareRenderingOrder );
|
||||
|
||||
MarkTargetDirty( TARGET_CACHED );
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1020,7 +1019,9 @@ void VIEW::UpdateItems()
|
|||
m_needsUpdate.clear();
|
||||
}
|
||||
|
||||
struct VIEW::extentsVisitor {
|
||||
|
||||
struct VIEW::extentsVisitor
|
||||
{
|
||||
BOX2I extents;
|
||||
bool first;
|
||||
|
||||
|
@ -1039,14 +1040,13 @@ struct VIEW::extentsVisitor {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
const BOX2I VIEW::CalculateExtents()
|
||||
{
|
||||
|
||||
extentsVisitor v;
|
||||
BOX2I fullScene;
|
||||
fullScene.SetMaximum();
|
||||
|
||||
|
||||
BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
|
||||
{
|
||||
l->items->Query( fullScene, v );
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#ifndef PANELGAL_WXSTRUCT_H
|
||||
#define PANELGAL_WXSTRUCT_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/window.h>
|
||||
|
||||
#include <wx/timer.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class BOARD;
|
||||
|
@ -68,6 +68,15 @@ public:
|
|||
*/
|
||||
void SwitchBackend( GalType aGalType );
|
||||
|
||||
/**
|
||||
* Function GetBackend
|
||||
* Returns the type of backend currently used by GAL canvas.
|
||||
*/
|
||||
inline GalType GetBackend() const
|
||||
{
|
||||
return m_backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetGAL()
|
||||
* Returns a pointer to the GAL instance used in the panel.
|
||||
|
@ -99,17 +108,16 @@ public:
|
|||
}
|
||||
|
||||
/// @copydoc wxWindow::Refresh()
|
||||
void Refresh( bool eraseBackground = true, const wxRect* rect = NULL );
|
||||
void Refresh( bool aEraseBackground = true, const wxRect* aRect = NULL );
|
||||
|
||||
/**
|
||||
* Function SetEventDispatcher()
|
||||
* Sets a dispatcher that processes events and forwards them to tools.
|
||||
* @param aEventDispatcher is the object that will be used for dispatching events.
|
||||
* DRAW_PANEL_GAL does not take over the ownership. Passing NULL disconnects all event
|
||||
* handlers from the DRAW_PANEL_GAL and parent frame.
|
||||
*/
|
||||
void SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
|
||||
{
|
||||
m_eventDispatcher = aEventDispatcher;
|
||||
}
|
||||
void SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher );
|
||||
|
||||
/**
|
||||
* Function StartDrawing()
|
||||
|
@ -124,16 +132,30 @@ public:
|
|||
*/
|
||||
void StopDrawing();
|
||||
|
||||
/**
|
||||
* Function SetHighContrastLayer
|
||||
* Takes care of display settings for the given layer to be displayed in high contrast mode.
|
||||
*/
|
||||
virtual void SetHighContrastLayer( LAYER_NUM aLayer );
|
||||
|
||||
/**
|
||||
* Function SetTopLayer
|
||||
* Moves the selected layer to the top, so it is displayed above all others.
|
||||
*/
|
||||
virtual void SetTopLayer( LAYER_NUM aLayer );
|
||||
|
||||
protected:
|
||||
void onPaint( wxPaintEvent& WXUNUSED( aEvent ) );
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
void onEvent( wxEvent& aEvent );
|
||||
void onEnter( wxEvent& aEvent );
|
||||
void onRefreshTimer( wxTimerEvent& aEvent );
|
||||
void skipEvent( wxEvent& aEvent );
|
||||
|
||||
static const int MinRefreshPeriod = 17; ///< 60 FPS.
|
||||
|
||||
/// Pointer to the parent window
|
||||
wxWindow* m_parent;
|
||||
|
||||
/// Last timestamp when the panel was refreshed
|
||||
wxLongLong m_lastRefresh;
|
||||
|
||||
|
@ -159,7 +181,7 @@ protected:
|
|||
KIGFX::WX_VIEW_CONTROLS* m_viewControls;
|
||||
|
||||
/// Currently used GAL
|
||||
GalType m_currentGal;
|
||||
GalType m_backend;
|
||||
|
||||
/// Processes and forwards events to tools
|
||||
TOOL_DISPATCHER* m_eventDispatcher;
|
||||
|
|
|
@ -177,4 +177,3 @@ Casted dyn_cast(From aObject)
|
|||
}
|
||||
|
||||
#endif // __KICAD_TYPEINFO_H
|
||||
|
||||
|
|
|
@ -675,7 +675,6 @@ public:
|
|||
* @return True for GAL-based canvas, false for standard canvas.
|
||||
*/
|
||||
bool IsGalCanvasActive() const { return m_galCanvasActive; }
|
||||
void SetGalCanvasActive( bool aState ) { m_galCanvasActive = aState; }
|
||||
|
||||
/**
|
||||
* Function GetGalCanvas
|
||||
|
|
|
@ -229,6 +229,9 @@ public:
|
|||
// Cursor
|
||||
// -------
|
||||
|
||||
/// @copydoc GAL::SetCursorSize()
|
||||
virtual void SetCursorSize( unsigned int aCursorSize );
|
||||
|
||||
/// @copydoc GAL::DrawCursor()
|
||||
virtual void DrawCursor( const VECTOR2D& aCursorPosition );
|
||||
|
||||
|
|
|
@ -631,6 +631,9 @@ public:
|
|||
inline void SetGridOrigin( const VECTOR2D& aGridOrigin )
|
||||
{
|
||||
gridOrigin = aGridOrigin;
|
||||
|
||||
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
|
||||
(long) gridOrigin.y % (long) gridSize.y );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -661,6 +664,9 @@ public:
|
|||
inline void SetGridSize( const VECTOR2D& aGridSize )
|
||||
{
|
||||
gridSize = aGridSize;
|
||||
|
||||
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
|
||||
(long) gridOrigin.y % (long) gridSize.y );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -777,12 +783,22 @@ public:
|
|||
cursorColor = aCursorColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the cursor size.
|
||||
*
|
||||
* @return The current cursor size (in pixels).
|
||||
*/
|
||||
inline unsigned int GetCursorSize() const
|
||||
{
|
||||
return cursorSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the cursor size.
|
||||
*
|
||||
* @param aCursorSize is the size of the cursor expressed in pixels.
|
||||
*/
|
||||
inline void SetCursorSize( unsigned int aCursorSize )
|
||||
virtual inline void SetCursorSize( unsigned int aCursorSize )
|
||||
{
|
||||
cursorSize = aCursorSize;
|
||||
}
|
||||
|
|
|
@ -84,14 +84,13 @@ protected:
|
|||
unsigned int m_current; ///< Currently used buffer handle
|
||||
GLuint m_framebuffer; ///< Main FBO handle
|
||||
GLuint m_depthBuffer; ///< Depth buffer handle
|
||||
unsigned int m_maxBuffers; ///< Maximal amount of buffers
|
||||
typedef std::deque<OPENGL_BUFFER> OPENGL_BUFFERS;
|
||||
|
||||
/// Stores information about initialized buffers
|
||||
OPENGL_BUFFERS m_buffers;
|
||||
|
||||
/// Store the currently used FBO name in case there was more than one compositor used
|
||||
static GLuint m_currentFbo;
|
||||
GLuint m_currentFbo;
|
||||
|
||||
/**
|
||||
* Function clean()
|
||||
|
@ -100,7 +99,7 @@ protected:
|
|||
void clean();
|
||||
|
||||
/// Returns number of used buffers
|
||||
unsigned int usedBuffers()
|
||||
inline unsigned int usedBuffers()
|
||||
{
|
||||
return m_buffers.size();
|
||||
}
|
||||
|
|
|
@ -37,22 +37,12 @@
|
|||
#include <gal/opengl/noncached_container.h>
|
||||
#include <gal/opengl/opengl_compositor.h>
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
#include <boost/smart_ptr/shared_array.hpp>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#ifndef CALLBACK
|
||||
#define CALLBACK
|
||||
#endif
|
||||
|
@ -262,8 +252,8 @@ private:
|
|||
static const int CIRCLE_POINTS = 64; ///< The number of points for circle approximation
|
||||
static const int CURVE_POINTS = 32; ///< The number of points for curve approximation
|
||||
|
||||
wxClientDC* clientDC; ///< Drawing context
|
||||
wxGLContext* glContext; ///< OpenGL context of wxWidgets
|
||||
wxPaintDC* clientDC; ///< Drawing context
|
||||
static wxGLContext* glContext; ///< OpenGL context of wxWidgets
|
||||
wxWindow* parentWindow; ///< Parent window
|
||||
wxEvtHandler* mouseListener;
|
||||
wxEvtHandler* paintListener;
|
||||
|
|
|
@ -163,7 +163,7 @@ protected:
|
|||
* returns size of the reserved memory space.
|
||||
* @return Size of the reserved memory space (expressed as a number of vertices).
|
||||
*/
|
||||
unsigned int reservedSpace()
|
||||
inline unsigned int reservedSpace()
|
||||
{
|
||||
return m_currentSize - m_freeSpace;
|
||||
}
|
||||
|
|
|
@ -75,20 +75,12 @@ public:
|
|||
static int MakeActionId( const std::string& aActionName );
|
||||
|
||||
/**
|
||||
* Function RunAction()
|
||||
* Runs an action with a given name (if there is one available).
|
||||
* @param aActionName is the name of action to be run.
|
||||
* @return True if there was an action associated with the name, false otherwise.
|
||||
* Function FindAction()
|
||||
* Finds an action with a given name (if there is one available).
|
||||
* @param aActionName is the searched action.
|
||||
* @return Pointer to a TOOL_ACTION object or NULL if there is no such action.
|
||||
*/
|
||||
bool RunAction( const std::string& aActionName ) const;
|
||||
|
||||
/**
|
||||
* Function RunAction()
|
||||
* Prepares an appropriate event and sends it to the destination specified in a TOOL_ACTION
|
||||
* object.
|
||||
* @param aAction is the action to be run.
|
||||
*/
|
||||
void RunAction( const TOOL_ACTION* aAction ) const;
|
||||
TOOL_ACTION* FindAction( const std::string& aActionName ) const;
|
||||
|
||||
/**
|
||||
* Function RunHotKey()
|
||||
|
|
|
@ -47,6 +47,10 @@ public:
|
|||
///> Copy constructor
|
||||
CONTEXT_MENU( const CONTEXT_MENU& aMenu );
|
||||
|
||||
CONTEXT_MENU& operator=( const CONTEXT_MENU& aMenu );
|
||||
|
||||
virtual ~CONTEXT_MENU() {}
|
||||
|
||||
/**
|
||||
* Function SetTitle()
|
||||
* Sets title for the context menu. The title is shown as a text label shown on the top of
|
||||
|
@ -72,7 +76,6 @@ public:
|
|||
*/
|
||||
void Add( const TOOL_ACTION& aAction );
|
||||
|
||||
|
||||
/**
|
||||
* Function Clear()
|
||||
* Removes all the entries from the menu (as well as its title). It leaves the menu in the
|
||||
|
|
|
@ -56,11 +56,10 @@ template <class ReturnType, class ArgType>
|
|||
class COROUTINE
|
||||
{
|
||||
public:
|
||||
COROUTINE()
|
||||
COROUTINE() :
|
||||
m_saved( NULL ), m_self( NULL ), m_stack( NULL ), m_stackSize( c_defaultStackSize ),
|
||||
m_running( false )
|
||||
{
|
||||
m_stackSize = c_defaultStackSize;
|
||||
m_stack = NULL;
|
||||
m_saved = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,7 +68,8 @@ public:
|
|||
*/
|
||||
template <class T>
|
||||
COROUTINE( T* object, ReturnType(T::* ptr)( ArgType ) ) :
|
||||
m_func( object, ptr ), m_saved( NULL ), m_stack( NULL ), m_stackSize( c_defaultStackSize )
|
||||
m_func( object, ptr ), m_self( NULL ), m_saved( NULL ), m_stack( NULL ),
|
||||
m_stackSize( c_defaultStackSize ), m_running( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,10 @@ public:
|
|||
* Creates a coroutine from a delegate object
|
||||
*/
|
||||
COROUTINE( DELEGATE<ReturnType, ArgType> aEntry ) :
|
||||
m_func( aEntry ), m_saved( NULL ), m_stack( NULL ), m_stackSize( c_defaultStackSize )
|
||||
{};
|
||||
m_func( aEntry ), m_saved( NULL ), m_self( NULL ), m_stack( NULL ),
|
||||
m_stackSize( c_defaultStackSize ), m_running( false )
|
||||
{
|
||||
}
|
||||
|
||||
~COROUTINE()
|
||||
{
|
||||
|
@ -115,7 +117,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* <F11>* Function SetEntry()
|
||||
* Function SetEntry()
|
||||
*
|
||||
* Defines the entry point for the coroutine, if not set in the constructor.
|
||||
*/
|
||||
|
@ -138,6 +140,12 @@ public:
|
|||
// align to 16 bytes
|
||||
void* sp = (void*) ( ( ( (ptrdiff_t) m_stack ) + m_stackSize - 0xf ) & ( ~0x0f ) );
|
||||
|
||||
// correct the stack size
|
||||
m_stackSize -= ( (size_t) m_stack + m_stackSize - (size_t) sp );
|
||||
|
||||
assert( m_self == NULL );
|
||||
assert( m_saved == NULL );
|
||||
|
||||
m_args = &aArgs;
|
||||
m_self = boost::context::make_fcontext( sp, m_stackSize, callerStub );
|
||||
m_saved = new boost::context::fcontext_t();
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include <tool/tool_base.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
/**
|
||||
|
@ -47,10 +46,10 @@ class TOOL_ACTION
|
|||
public:
|
||||
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
|
||||
int aDefaultHotKey = 0, const std::string& aMenuItem = std::string( "" ),
|
||||
const std::string& aMenuDesc = std::string( "" ) ) :
|
||||
const std::string& aMenuDesc = std::string( "" ), TOOL_ACTION_FLAGS aFlags = AF_NONE ) :
|
||||
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
|
||||
m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ),
|
||||
m_menuDescription( aMenuDesc ), m_id( -1 )
|
||||
m_menuDescription( aMenuDesc ), m_id( -1 ), m_flags( aFlags )
|
||||
{
|
||||
TOOL_MANAGER::GetActionList().push_back( this );
|
||||
}
|
||||
|
@ -132,7 +131,6 @@ public:
|
|||
* Checks if the action has a hot key assigned.
|
||||
*
|
||||
* @return True if there is a hot key assigned, false otherwise.
|
||||
*
|
||||
*/
|
||||
bool HasHotKey() const
|
||||
{
|
||||
|
@ -141,13 +139,18 @@ public:
|
|||
|
||||
/**
|
||||
* Function MakeEvent()
|
||||
* Returns the event associated with the action (ie. the event that will be sent after
|
||||
* Returns the event associated with the action (i.e. the event that will be sent after
|
||||
* activating the action).
|
||||
*
|
||||
* @return The event associated with the action.
|
||||
*/
|
||||
TOOL_EVENT MakeEvent() const
|
||||
{
|
||||
if( IsActivation() )
|
||||
return TOOL_EVENT( TC_COMMAND, TA_ACTIVATE, m_name, m_scope );
|
||||
else if( IsNotification() )
|
||||
return TOOL_EVENT( TC_MESSAGE, TA_ANY, m_name, m_scope );
|
||||
else
|
||||
return TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope );
|
||||
}
|
||||
|
||||
|
@ -181,30 +184,31 @@ public:
|
|||
* stripped of the last part (e.g. for "pcbnew.InteractiveDrawing.drawCircle" it is
|
||||
* "pcbnew.InteractiveDrawing").
|
||||
*/
|
||||
std::string GetToolName() const
|
||||
std::string GetToolName() const;
|
||||
|
||||
/**
|
||||
* Returns true if the action is intended to activate a tool.
|
||||
*/
|
||||
bool IsActivation() const
|
||||
{
|
||||
return m_name.substr( 0, m_name.rfind( '.' ) );
|
||||
return m_flags & AF_ACTIVATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the action is a notification.
|
||||
*/
|
||||
bool IsNotification() const
|
||||
{
|
||||
return m_flags & AF_NOTIFY;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class ACTION_MANAGER;
|
||||
|
||||
/// Assigns an unique identifier. It is given by an instance of ACTION_MANAGER.
|
||||
void setId( int aId )
|
||||
{
|
||||
m_id = aId;
|
||||
}
|
||||
|
||||
/// Assigns ACTION_MANAGER object that handles the TOOL_ACTION.
|
||||
void setActionMgr( ACTION_MANAGER* aManager )
|
||||
{
|
||||
m_actionMgr = aManager;
|
||||
}
|
||||
|
||||
/// Name of the action (convention is: app.[tool.]action.name)
|
||||
std::string m_name;
|
||||
|
||||
/// Scope of the action (ie. the event that is issued after activation).
|
||||
/// Scope of the action (i.e. the event that is issued after activation).
|
||||
TOOL_ACTION_SCOPE m_scope;
|
||||
|
||||
/// Default hot key that activates the action.
|
||||
|
@ -225,8 +229,8 @@ private:
|
|||
/// Unique ID for fast matching. Assigned by ACTION_MANAGER.
|
||||
int m_id;
|
||||
|
||||
/// Action manager that handles this TOOL_ACTION.
|
||||
ACTION_MANAGER* m_actionMgr;
|
||||
/// Action flags
|
||||
TOOL_ACTION_FLAGS m_flags;
|
||||
|
||||
/// Origin of the action
|
||||
// const TOOL_BASE* m_origin;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#define __TOOL_DISPATCHER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <wx/event.h>
|
||||
#include <tool/tool_event.h>
|
||||
|
||||
class TOOL_MANAGER;
|
||||
|
@ -47,7 +47,7 @@ class VIEW;
|
|||
* - issues TOOL_EVENTS to the tool manager
|
||||
*/
|
||||
|
||||
class TOOL_DISPATCHER
|
||||
class TOOL_DISPATCHER : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
* @param aToolMgr: tool manager instance the events will be sent to
|
||||
* @param aEditFrame: the frame wx events come from
|
||||
*/
|
||||
TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame );
|
||||
TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr );
|
||||
virtual ~TOOL_DISPATCHER();
|
||||
|
||||
/**
|
||||
|
@ -128,9 +128,6 @@ private:
|
|||
|
||||
///> Instance of tool manager that cooperates with the dispatcher.
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
|
||||
///> Instance of wxFrame that is the source of UI events.
|
||||
PCB_BASE_FRAME* m_editFrame;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -91,9 +91,12 @@ enum TOOL_ACTIONS
|
|||
// This event is sent *before* undo/redo command is performed.
|
||||
TA_UNDO_REDO = 0x10000,
|
||||
|
||||
// Tool action (allows to control tools)
|
||||
// Tool action (allows to control tools).
|
||||
TA_ACTION = 0x20000,
|
||||
|
||||
// Tool activation event.
|
||||
TA_ACTIVATE = 0x40000,
|
||||
|
||||
TA_ANY = 0xffffffff
|
||||
};
|
||||
|
||||
|
@ -123,6 +126,14 @@ enum TOOL_ACTION_SCOPE
|
|||
AS_GLOBAL ///> Global action (toolbar/main menu event, global shortcut)
|
||||
};
|
||||
|
||||
/// Flags for tool actions
|
||||
enum TOOL_ACTION_FLAGS
|
||||
{
|
||||
AF_NONE = 0,
|
||||
AF_ACTIVATE = 1, ///> Action activates a tool
|
||||
AF_NOTIFY = 2 ///> Action is a notification (it is by default passed to all tools)
|
||||
};
|
||||
|
||||
/// Defines when a context menu is opened.
|
||||
enum CONTEXT_MENU_TRIGGER
|
||||
{
|
||||
|
@ -265,6 +276,11 @@ public:
|
|||
return m_actions == TA_CANCEL_TOOL;
|
||||
}
|
||||
|
||||
bool IsActivate() const
|
||||
{
|
||||
return m_actions == TA_ACTIVATE;
|
||||
}
|
||||
|
||||
///> Returns information about key modifiers state (Ctrl, Alt, etc.)
|
||||
int Modifier( int aMask = MD_MODIFIER_MASK ) const
|
||||
{
|
||||
|
@ -313,14 +329,11 @@ public:
|
|||
|
||||
if( m_category == TC_COMMAND || m_category == TC_MESSAGE )
|
||||
{
|
||||
if( m_commandStr && aEvent.m_commandStr )
|
||||
if( (bool) m_commandStr && (bool) aEvent.m_commandStr )
|
||||
return *m_commandStr == *aEvent.m_commandStr;
|
||||
|
||||
if( m_commandId && aEvent.m_commandId )
|
||||
if( (bool) m_commandId && (bool) aEvent.m_commandId )
|
||||
return *m_commandId == *aEvent.m_commandId;
|
||||
|
||||
// Command-type event has to contain either id or string
|
||||
assert( false );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -334,11 +347,16 @@ public:
|
|||
*/
|
||||
bool IsAction( const TOOL_ACTION* aAction ) const;
|
||||
|
||||
boost::optional<int> GetCommandId()
|
||||
boost::optional<int> GetCommandId() const
|
||||
{
|
||||
return m_commandId;
|
||||
}
|
||||
|
||||
boost::optional<std::string> GetCommandStr() const
|
||||
{
|
||||
return m_commandStr;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class TOOL_MANAGER;
|
||||
|
||||
|
@ -496,7 +514,6 @@ inline const TOOL_EVENT_LIST operator||( const TOOL_EVENT& aEventA, const TOOL_E
|
|||
return l;
|
||||
}
|
||||
|
||||
|
||||
inline const TOOL_EVENT_LIST operator||( const TOOL_EVENT& aEvent,
|
||||
const TOOL_EVENT_LIST& aEventList )
|
||||
{
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
#ifndef __TOOL_MANAGER_H
|
||||
#define __TOOL_MANAGER_H
|
||||
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <typeinfo>
|
||||
#include <map>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
|
||||
|
@ -105,17 +106,21 @@ public:
|
|||
* Runs the specified action. The common format for action names is "application.ToolName.Action".
|
||||
*
|
||||
* @param aActionName is the name of action to be invoked.
|
||||
* @return True if the action finished successfully, false otherwise.
|
||||
* @param aNow decides if the action has to be run immediately or after the current coroutine
|
||||
* is preemptied.
|
||||
* @return False if the action was not found.
|
||||
*/
|
||||
bool RunAction( const std::string& aActionName );
|
||||
bool RunAction( const std::string& aActionName, bool aNow = false );
|
||||
|
||||
/**
|
||||
* Function RunAction()
|
||||
* Runs the specified action.
|
||||
*
|
||||
* @param aAction is the action to be invoked.
|
||||
* @param aNow decides if the action has to be run immediately or after the current coroutine
|
||||
* is preemptied.
|
||||
*/
|
||||
void RunAction( const TOOL_ACTION& aAction );
|
||||
void RunAction( const TOOL_ACTION& aAction, bool aNow = false );
|
||||
|
||||
/**
|
||||
* Function FindTool()
|
||||
|
@ -135,6 +140,21 @@ public:
|
|||
*/
|
||||
TOOL_BASE* FindTool( const std::string& aName ) const;
|
||||
|
||||
/*
|
||||
* Function GetTool()
|
||||
* Returns the tool of given type or NULL if there is no such tool registered.
|
||||
*/
|
||||
template<typename T>
|
||||
T* GetTool()
|
||||
{
|
||||
std::map<const char*, TOOL_BASE*>::iterator tool = m_toolTypes.find( typeid( T ).name() );
|
||||
|
||||
if( tool != m_toolTypes.end() )
|
||||
return static_cast<T*>( tool->second );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function ResetTools()
|
||||
* Resets all tools (i.e. calls their Reset() method).
|
||||
|
@ -142,11 +162,20 @@ public:
|
|||
void ResetTools( TOOL_BASE::RESET_REASON aReason );
|
||||
|
||||
/**
|
||||
* Takes an event from the TOOL_DISPATCHER and propagates it to
|
||||
* tools that requested events of matching type(s)
|
||||
* Propagates an event to tools that requested events of matching type(s).
|
||||
* @param aEvent is the event to be processed.
|
||||
*/
|
||||
bool ProcessEvent( TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Puts an event to the event queue to be processed at the end of event processing cycle.
|
||||
* @param aEvent is the event to be put into the queue.
|
||||
*/
|
||||
inline void PostEvent( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_eventQueue.push_back( aEvent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the work environment (model, view, view controls and the parent window).
|
||||
* These are made available to the tool. Called by the parent frame (PCB_EDIT_FRAME)
|
||||
|
@ -161,17 +190,17 @@ public:
|
|||
return m_view;
|
||||
}
|
||||
|
||||
KIGFX::VIEW_CONTROLS* GetViewControls() const
|
||||
inline KIGFX::VIEW_CONTROLS* GetViewControls() const
|
||||
{
|
||||
return m_viewControls;
|
||||
}
|
||||
|
||||
EDA_ITEM* GetModel() const
|
||||
inline EDA_ITEM* GetModel() const
|
||||
{
|
||||
return m_model;
|
||||
}
|
||||
|
||||
wxWindow* GetEditFrame() const
|
||||
inline wxWindow* GetEditFrame() const
|
||||
{
|
||||
return m_editFrame;
|
||||
}
|
||||
|
@ -181,7 +210,7 @@ public:
|
|||
* (was invoked the most recently).
|
||||
* @return Id of the currently used tool.
|
||||
*/
|
||||
int GetCurrentToolId() const
|
||||
inline int GetCurrentToolId() const
|
||||
{
|
||||
return m_activeTools.front();
|
||||
}
|
||||
|
@ -191,7 +220,7 @@ public:
|
|||
* (was invoked the most recently).
|
||||
* @return Pointer to the currently used tool.
|
||||
*/
|
||||
TOOL_BASE* GetCurrentTool() const
|
||||
inline TOOL_BASE* GetCurrentTool() const
|
||||
{
|
||||
return FindTool( GetCurrentToolId() );
|
||||
}
|
||||
|
@ -241,6 +270,19 @@ public:
|
|||
m_passEvent = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores an information to the system clipboard.
|
||||
* @param aText is the information to be stored.
|
||||
* @return False if error occured.
|
||||
*/
|
||||
bool SaveClipboard( const std::string& aText );
|
||||
|
||||
/**
|
||||
* Returns the information currently stored in the system clipboard. If data stored in the
|
||||
* clipboard is in non-text format, empty string is returned.
|
||||
*/
|
||||
std::string GetClipboard() const;
|
||||
|
||||
/**
|
||||
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
|
||||
* creation.
|
||||
|
@ -258,6 +300,10 @@ private:
|
|||
struct TOOL_STATE;
|
||||
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
||||
|
||||
/**
|
||||
* Function dispatchInternal
|
||||
* Passes an event at first to the active tools, then to all others.
|
||||
*/
|
||||
void dispatchInternal( TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
|
@ -276,6 +322,12 @@ private:
|
|||
*/
|
||||
bool dispatchActivation( TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function dispatchContextMenu()
|
||||
* Handles context menu related events.
|
||||
*/
|
||||
void dispatchContextMenu( TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function invokeTool()
|
||||
* Invokes a tool by sending a proper event (in contrary to runTool, which makes the tool run
|
||||
|
@ -349,6 +401,9 @@ private:
|
|||
/// Index of the registered tools current states, associated by tools' names.
|
||||
std::map<std::string, TOOL_STATE*> m_toolNameIndex;
|
||||
|
||||
/// Index of the registered tools to easily lookup by their type.
|
||||
std::map<const char*, TOOL_BASE*> m_toolTypes;
|
||||
|
||||
/// Index of the registered tools current states, associated by tools' ID numbers.
|
||||
std::map<TOOL_ID, TOOL_STATE*> m_toolIdIndex;
|
||||
|
||||
|
@ -363,11 +418,11 @@ private:
|
|||
KIGFX::VIEW_CONTROLS* m_viewControls;
|
||||
wxWindow* m_editFrame;
|
||||
|
||||
/// Queue that stores events to be processed at the end of the event processing cycle.
|
||||
std::list<TOOL_EVENT> m_eventQueue;
|
||||
|
||||
/// Flag saying if the currently processed event should be passed to other tools.
|
||||
bool m_passEvent;
|
||||
|
||||
/// Pointer to the tool on the top of the active tools stack.
|
||||
TOOL_STATE* m_currentTool;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -159,9 +159,8 @@ public:
|
|||
* Function SetViewport()
|
||||
* Sets the visible area of the VIEW.
|
||||
* @param aViewport: desired visible area, in world space coordinates.
|
||||
* @param aKeepProportions: when true, the X/Y size proportions are kept.
|
||||
*/
|
||||
void SetViewport( const BOX2D& aViewport, bool aKeepProportions = true );
|
||||
void SetViewport( const BOX2D& aViewport );
|
||||
|
||||
/**
|
||||
* Function GetViewport()
|
||||
|
|
|
@ -110,10 +110,6 @@ protected:
|
|||
MODULE* loadFootprint( const FPID& aFootprintId )
|
||||
throw( IO_ERROR, PARSE_ERROR );
|
||||
|
||||
///> Rendering order of layers on GAL-based canvas (lower index in the array
|
||||
///> means that layer is displayed closer to the user, ie. on the top).
|
||||
static const LAYER_NUM GAL_LAYER_ORDER[];
|
||||
|
||||
public:
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
|
@ -617,6 +613,24 @@ public:
|
|||
|
||||
virtual void SwitchLayer( wxDC* DC, LAYER_ID layer );
|
||||
|
||||
/**
|
||||
* Function SetActiveLayer
|
||||
* will change the currently active layer to \a aLayer.
|
||||
*/
|
||||
virtual void SetActiveLayer( LAYER_ID aLayer )
|
||||
{
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetActiveLayer
|
||||
* returns the active layer
|
||||
*/
|
||||
virtual LAYER_ID GetActiveLayer() const
|
||||
{
|
||||
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
|
||||
}
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ); // override virtual
|
||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define WXPCB_STRUCT_H_
|
||||
|
||||
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <pcb_base_edit_frame.h>
|
||||
#include <config_params.h>
|
||||
#include <class_macros_record.h>
|
||||
#include <class_undoredo_container.h>
|
||||
|
@ -73,7 +73,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
|
|||
*
|
||||
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
|
||||
*/
|
||||
class PCB_EDIT_FRAME : public PCB_BASE_FRAME
|
||||
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
|
||||
{
|
||||
friend class PCB::IFACE;
|
||||
friend class PCB_LAYER_WIDGET;
|
||||
|
@ -87,9 +87,6 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
|
|||
/// The auxiliary right vertical tool bar used to access the microwave tools.
|
||||
wxAuiToolBar* m_microWaveToolBar;
|
||||
|
||||
/// User defined rotation angle (in tenths of a degree).
|
||||
int m_rotationAngle;
|
||||
|
||||
/**
|
||||
* Function loadFootprints
|
||||
* loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
|
||||
|
@ -120,9 +117,8 @@ protected:
|
|||
bool m_useCmpFileForFpNames; ///< is true, use the .cmp file from CvPcb, else use the netlist
|
||||
// to know the footprint name of components.
|
||||
|
||||
// The Tool Framework initalization
|
||||
void setupTools();
|
||||
void destroyTools();
|
||||
void onGenericCommand( wxCommandEvent& aEvent );
|
||||
|
||||
// we'll use lower case function names for private member functions.
|
||||
void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
|
||||
|
@ -252,6 +248,7 @@ public:
|
|||
void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
|
||||
void OnLayerColorChange( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function RecordMacros.
|
||||
|
@ -314,9 +311,6 @@ public:
|
|||
*/
|
||||
virtual void SetGridColor(EDA_COLOR_T aColor);
|
||||
|
||||
int GetRotationAngle() const { return m_rotationAngle; }
|
||||
void SetRotationAngle( int aRotationAngle );
|
||||
|
||||
// Configurations:
|
||||
void Process_Config( wxCommandEvent& event );
|
||||
|
||||
|
@ -531,33 +525,12 @@ public:
|
|||
*/
|
||||
virtual void OnModify();
|
||||
|
||||
/**
|
||||
* Function SetHighContrastLayer
|
||||
* takes care of display settings for the given layer to be displayed in high contrast mode.
|
||||
*/
|
||||
void SetHighContrastLayer( LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* Function SetTopLayer
|
||||
* moves the selected layer to the top, so it is displayed above all others.
|
||||
*/
|
||||
void SetTopLayer( LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* Function SetActiveLayer
|
||||
* will change the currently active layer to \a aLayer and also
|
||||
* update the PCB_LAYER_WIDGET.
|
||||
*/
|
||||
void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true );
|
||||
|
||||
/**
|
||||
* Function GetActiveLayer
|
||||
* returns the active layer
|
||||
*/
|
||||
LAYER_ID GetActiveLayer() const
|
||||
{
|
||||
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
|
||||
}
|
||||
virtual void SetActiveLayer( LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* Function IsElementVisible
|
||||
|
@ -679,22 +652,22 @@ public:
|
|||
bool aRebuildRatsnet = true );
|
||||
|
||||
/**
|
||||
* Function GetBoardFromRedoList
|
||||
* Function RestoreCopyFromRedoList
|
||||
* Redo the last edition:
|
||||
* - Save the current board in Undo list
|
||||
* - Get an old version of the board from Redo list
|
||||
* @return none
|
||||
*/
|
||||
void GetBoardFromRedoList( wxCommandEvent& aEvent );
|
||||
void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function GetBoardFromUndoList
|
||||
* Function RestoreCopyFromUndoList
|
||||
* Undo the last edition:
|
||||
* - Save the current board in Redo list
|
||||
* - Get an old version of the board from Undo list
|
||||
* @return none
|
||||
*/
|
||||
void GetBoardFromUndoList( wxCommandEvent& aEvent );
|
||||
void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
|
||||
|
||||
/* Block operations: */
|
||||
|
||||
|
@ -890,12 +863,6 @@ public:
|
|||
/// @copydoc PCB_BASE_FRAME::SetBoard()
|
||||
void SetBoard( BOARD* aBoard );
|
||||
|
||||
/**
|
||||
* Function ViewReloadBoard
|
||||
* adds all items from the current board to the VIEW, so they can be displayed by GAL.
|
||||
*/
|
||||
void ViewReloadBoard( const BOARD* aBoard ) const;
|
||||
|
||||
// Drc control
|
||||
|
||||
/* function GetDrcController
|
||||
|
|
|
@ -59,6 +59,8 @@ set( PCBNEW_DIALOGS
|
|||
dialogs/dialog_edit_module_for_Modedit.cpp
|
||||
dialogs/dialog_edit_module_text.cpp
|
||||
dialogs/dialog_edit_module_text_base.cpp
|
||||
dialogs/dialog_enum_pads.cpp
|
||||
dialogs/dialog_enum_pads_base.cpp
|
||||
dialogs/dialog_exchange_modules_base.cpp
|
||||
dialogs/dialog_export_idf.cpp
|
||||
dialogs/dialog_export_idf_base.cpp
|
||||
|
@ -160,6 +162,7 @@ set( PCBNEW_CLASS_SRCS
|
|||
tool_modview.cpp
|
||||
modview_frame.cpp
|
||||
pcbframe.cpp
|
||||
pcb_base_edit_frame.cpp
|
||||
attribut.cpp
|
||||
board_items_to_polygon_shape_transform.cpp
|
||||
board_undo_redo.cpp
|
||||
|
@ -221,6 +224,7 @@ set( PCBNEW_CLASS_SRCS
|
|||
pad_edition_functions.cpp
|
||||
pcbnew_config.cpp
|
||||
pcbplot.cpp
|
||||
pcb_draw_panel_gal.cpp
|
||||
plot_board_layers.cpp
|
||||
plot_brditems_plotter.cpp
|
||||
print_board_functions.cpp
|
||||
|
@ -254,6 +258,7 @@ set( PCBNEW_CLASS_SRCS
|
|||
|
||||
tools/selection_tool.cpp
|
||||
tools/selection_area.cpp
|
||||
tools/selection_conditions.cpp
|
||||
tools/bright_box.cpp
|
||||
tools/edit_points.cpp
|
||||
tools/edit_constraints.cpp
|
||||
|
@ -261,7 +266,9 @@ set( PCBNEW_CLASS_SRCS
|
|||
tools/drawing_tool.cpp
|
||||
tools/edit_tool.cpp
|
||||
tools/pcbnew_control.cpp
|
||||
tools/pcb_tools.cpp
|
||||
tools/pcb_editor_control.cpp
|
||||
tools/module_tools.cpp
|
||||
tools/placement_tool.cpp
|
||||
tools/common_actions.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
#include <collectors.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <view/view.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <trigo.h>
|
||||
|
@ -75,82 +75,6 @@ static const wxChar DisplayModuleTextEntry[] = wxT( "DiModTx" );
|
|||
static const wxChar FastGrid1Entry[] = wxT( "FastGrid1" );
|
||||
static const wxChar FastGrid2Entry[] = wxT( "FastGrid2" );
|
||||
|
||||
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
|
||||
{
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ),
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE ),
|
||||
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
|
||||
|
||||
// UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
|
||||
|
||||
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
||||
|
||||
ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
|
||||
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
|
||||
NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
|
||||
F_SilkS, F_Paste, F_Adhes,
|
||||
|
||||
#if 0 // was:
|
||||
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
|
||||
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
|
||||
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
|
||||
NETNAMES_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
|
||||
NETNAMES_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
|
||||
NETNAMES_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
|
||||
NETNAMES_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
|
||||
NETNAMES_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
|
||||
NETNAMES_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
|
||||
NETNAMES_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
|
||||
NETNAMES_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
|
||||
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
|
||||
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
|
||||
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
|
||||
#else
|
||||
|
||||
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
|
||||
NETNAMES_GAL_LAYER( In2_Cu ), In2_Cu,
|
||||
NETNAMES_GAL_LAYER( In3_Cu ), In3_Cu,
|
||||
NETNAMES_GAL_LAYER( In4_Cu ), In4_Cu,
|
||||
NETNAMES_GAL_LAYER( In5_Cu ), In5_Cu,
|
||||
NETNAMES_GAL_LAYER( In6_Cu ), In6_Cu,
|
||||
NETNAMES_GAL_LAYER( In7_Cu ), In7_Cu,
|
||||
NETNAMES_GAL_LAYER( In8_Cu ), In8_Cu,
|
||||
NETNAMES_GAL_LAYER( In9_Cu ), In9_Cu,
|
||||
NETNAMES_GAL_LAYER( In10_Cu ), In10_Cu,
|
||||
NETNAMES_GAL_LAYER( In11_Cu ), In11_Cu,
|
||||
NETNAMES_GAL_LAYER( In12_Cu ), In12_Cu,
|
||||
NETNAMES_GAL_LAYER( In13_Cu ), In13_Cu,
|
||||
NETNAMES_GAL_LAYER( In14_Cu ), In14_Cu,
|
||||
NETNAMES_GAL_LAYER( In15_Cu ), In15_Cu,
|
||||
NETNAMES_GAL_LAYER( In16_Cu ), In16_Cu,
|
||||
NETNAMES_GAL_LAYER( In17_Cu ), In17_Cu,
|
||||
NETNAMES_GAL_LAYER( In18_Cu ), In18_Cu,
|
||||
NETNAMES_GAL_LAYER( In19_Cu ), In19_Cu,
|
||||
NETNAMES_GAL_LAYER( In20_Cu ), In20_Cu,
|
||||
NETNAMES_GAL_LAYER( In21_Cu ), In21_Cu,
|
||||
NETNAMES_GAL_LAYER( In22_Cu ), In22_Cu,
|
||||
NETNAMES_GAL_LAYER( In23_Cu ), In23_Cu,
|
||||
NETNAMES_GAL_LAYER( In24_Cu ), In24_Cu,
|
||||
NETNAMES_GAL_LAYER( In25_Cu ), In25_Cu,
|
||||
NETNAMES_GAL_LAYER( In26_Cu ), In26_Cu,
|
||||
NETNAMES_GAL_LAYER( In27_Cu ), In27_Cu,
|
||||
NETNAMES_GAL_LAYER( In28_Cu ), In28_Cu,
|
||||
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
|
||||
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
|
||||
#endif
|
||||
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), B_Mask,
|
||||
NETNAMES_GAL_LAYER( B_Cu ), B_Cu,
|
||||
|
||||
B_Adhes, B_Paste, B_SilkS,
|
||||
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
|
||||
ITEM_GAL_LAYER( WORKSHEET )
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
|
@ -193,16 +117,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
m_FastGrid1 = 0;
|
||||
m_FastGrid2 = 0;
|
||||
|
||||
SetGalCanvas( new EDA_DRAW_PANEL_GAL(
|
||||
this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
|
||||
|
||||
// GAL should not be active yet
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
// Hide by default, it has to be explicitly shown
|
||||
GetGalCanvas()->Hide();
|
||||
|
||||
m_auxiliaryToolBar = NULL;
|
||||
}
|
||||
|
||||
|
@ -211,7 +125,10 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME()
|
|||
{
|
||||
delete m_Collector;
|
||||
|
||||
delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
|
||||
delete m_toolManager;
|
||||
delete m_toolDispatcher;
|
||||
|
||||
delete m_Pcb;
|
||||
delete GetGalCanvas();
|
||||
}
|
||||
|
||||
|
@ -252,10 +169,13 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs()
|
|||
|
||||
|
||||
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
if( m_Pcb != aBoard )
|
||||
{
|
||||
delete m_Pcb;
|
||||
m_Pcb = aBoard;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||
|
@ -847,52 +767,6 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
if( m_DisplayModText < LINE || m_DisplayModText > SKETCH )
|
||||
m_DisplayModText = FILLED;
|
||||
|
||||
// Apply display settings for GAL
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
|
||||
// Set rendering order and properties of layers
|
||||
for( LAYER_NUM i = 0; i < (int) DIM(GAL_LAYER_ORDER); ++i )
|
||||
{
|
||||
LAYER_NUM layer = GAL_LAYER_ORDER[i];
|
||||
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
|
||||
|
||||
view->SetLayerOrder( layer, i );
|
||||
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// Copper layers are required for netname layers
|
||||
view->SetRequired( GetNetnameLayer( layer ), layer );
|
||||
view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
|
||||
}
|
||||
else if( IsNetnameLayer( layer ) )
|
||||
{
|
||||
// Netnames are drawn only when scale is sufficient (level of details)
|
||||
// so there is no point in caching them
|
||||
view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
}
|
||||
|
||||
// Some more required layers settings
|
||||
view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
|
||||
view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
|
||||
|
||||
view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
||||
view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
|
||||
|
||||
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
|
||||
// when reading doubles in config,
|
||||
// but forget to back to current locale. So we call SetLocaleTo_Default
|
||||
|
|
|
@ -630,7 +630,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
|
||||
void PCB_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||
return;
|
||||
|
@ -653,7 +653,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& aEvent )
|
||||
void PCB_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( GetScreen()->GetRedoCommandCount() == 0 )
|
||||
return;
|
||||
|
|
|
@ -106,11 +106,6 @@ BOARD::BOARD() :
|
|||
|
||||
// Initialize ratsnest
|
||||
m_ratsnest = new RN_DATA( this );
|
||||
m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest );
|
||||
|
||||
// Initialize view item for displaying worksheet frame
|
||||
m_worksheetViewItem = new KIGFX::WORKSHEET_VIEWITEM( &m_paper, &m_titles );
|
||||
m_worksheetViewItem->SetFileName( std::string( m_fileName.mb_str() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,8 +117,6 @@ BOARD::~BOARD()
|
|||
Delete( area_to_remove );
|
||||
}
|
||||
|
||||
delete m_worksheetViewItem;
|
||||
delete m_ratsnestViewItem;
|
||||
delete m_ratsnest;
|
||||
|
||||
m_FullRatsnest.clear();
|
||||
|
@ -695,10 +688,12 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
|||
m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
assert( false ); // TODO Orson: I am just checking if it is supposed to be here
|
||||
|
||||
case PCB_DIMENSION_T:
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_MODULE_EDGE_T:
|
||||
case PCB_TARGET_T:
|
||||
if( aControl & ADD_APPEND )
|
||||
m_Drawings.PushBack( aBoardItem );
|
||||
|
|
|
@ -198,8 +198,6 @@ private:
|
|||
EDA_RECT m_BoundingBox;
|
||||
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
|
||||
RN_DATA* m_ratsnest;
|
||||
KIGFX::RATSNEST_VIEWITEM* m_ratsnestViewItem; ///< VIEW_ITEM that draws ratsnest
|
||||
KIGFX::WORKSHEET_VIEWITEM* m_worksheetViewItem; ///< VIEW_ITEM that draws worksheet frame
|
||||
|
||||
BOARD_DESIGN_SETTINGS m_designSettings;
|
||||
ZONE_SETTINGS m_zoneSettings;
|
||||
|
@ -313,24 +311,6 @@ public:
|
|||
return m_ratsnest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetRatsnestViewItem()
|
||||
* returns VIEW_ITEM responsible for drawing the ratsnest for the board.
|
||||
*/
|
||||
KIGFX::RATSNEST_VIEWITEM* GetRatsnestViewItem() const
|
||||
{
|
||||
return m_ratsnestViewItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetWorksheetViewItem()
|
||||
* returns VIEW_ITEM responsible for drawing the worksheet frame.
|
||||
*/
|
||||
KIGFX::WORKSHEET_VIEWITEM* GetWorksheetViewItem() const
|
||||
{
|
||||
return m_worksheetViewItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function DeleteMARKERs
|
||||
* deletes ALL MARKERS from the board.
|
||||
|
|
|
@ -90,6 +90,25 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
|
|||
}
|
||||
|
||||
|
||||
void EDGE_MODULE::SetLocalCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
|
||||
if( module == NULL )
|
||||
{
|
||||
m_Start0 = m_Start;
|
||||
m_End0 = m_End;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Start0 = m_Start - module->GetPosition();
|
||||
m_End0 = m_End - module->GetPosition();
|
||||
double angle = module->GetOrientation();
|
||||
RotatePoint( &m_Start0.x, &m_Start0.y, -angle );
|
||||
RotatePoint( &m_End0.x, &m_End0.y, -angle );
|
||||
}
|
||||
|
||||
|
||||
void EDGE_MODULE::SetDrawCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
|
|
|
@ -61,12 +61,23 @@ public:
|
|||
|
||||
void Copy( EDGE_MODULE* source ); // copy structure
|
||||
|
||||
void Move( const wxPoint& aMoveVector )
|
||||
{
|
||||
m_Start += aMoveVector;
|
||||
m_End += aMoveVector;
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
|
||||
const wxPoint& GetStart0() const { return m_Start0; }
|
||||
|
||||
void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; }
|
||||
const wxPoint& GetEnd0() const { return m_End0; }
|
||||
|
||||
///> Set relative coordinates.
|
||||
void SetLocalCoord();
|
||||
|
||||
///> Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
||||
/* drawing functions */
|
||||
|
|
|
@ -295,6 +295,72 @@ void MODULE::Copy( MODULE* aModule )
|
|||
}
|
||||
|
||||
|
||||
void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend )
|
||||
{
|
||||
switch( aBoardItem->Type() )
|
||||
{
|
||||
case PCB_MODULE_TEXT_T:
|
||||
// Only common texts can be added this way. Reference and value are not hold in the DLIST.
|
||||
assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
|
||||
/* no break */
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
if( doAppend )
|
||||
m_Drawings.PushBack( static_cast<BOARD_ITEM*>( aBoardItem ) );
|
||||
else
|
||||
m_Drawings.PushFront( static_cast<BOARD_ITEM*>( aBoardItem ) );
|
||||
break;
|
||||
|
||||
case PCB_PAD_T:
|
||||
if( doAppend )
|
||||
m_Pads.PushBack( static_cast<D_PAD*>( aBoardItem ) );
|
||||
else
|
||||
m_Pads.PushFront( static_cast<D_PAD*>( aBoardItem ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ),
|
||||
aBoardItem->Type() );
|
||||
wxFAIL_MSG( msg );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aBoardItem->SetParent( this );
|
||||
}
|
||||
|
||||
|
||||
BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem )
|
||||
{
|
||||
switch( aBoardItem->Type() )
|
||||
{
|
||||
case PCB_MODULE_TEXT_T:
|
||||
// Only common texts can be added this way. Reference and value are not hold in the DLIST.
|
||||
assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
|
||||
/* no break */
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
return m_Drawings.Remove( static_cast<BOARD_ITEM*>( aBoardItem ) );
|
||||
|
||||
case PCB_PAD_T:
|
||||
return m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) );
|
||||
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
|
||||
aBoardItem->Type() );
|
||||
wxFAIL_MSG( msg );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void MODULE::CopyNetlistSettings( MODULE* aModule )
|
||||
{
|
||||
// Don't do anything foolish like trying to copy to yourself.
|
||||
|
@ -448,8 +514,12 @@ const EDA_RECT MODULE::GetBoundingBox() const
|
|||
// Add the Clearance shape size: (shape around the pads when the
|
||||
// clearance is shown. Not optimized, but the draw cost is small
|
||||
// (perhaps smaller than optimization).
|
||||
int biggest_clearance = GetBoard()->GetDesignSettings().GetBiggestClearanceValue();
|
||||
BOARD* board = GetBoard();
|
||||
if( board )
|
||||
{
|
||||
int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();
|
||||
area.Inflate( biggest_clearance );
|
||||
}
|
||||
|
||||
return area;
|
||||
}
|
||||
|
@ -632,13 +702,6 @@ void MODULE::Add3DModel( S3D_MASTER* a3DModel )
|
|||
}
|
||||
|
||||
|
||||
void MODULE::AddPad( D_PAD* aPad )
|
||||
{
|
||||
aPad->SetParent( this );
|
||||
m_Pads.PushBack( aPad );
|
||||
}
|
||||
|
||||
|
||||
// see class_module.h
|
||||
SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] )
|
||||
|
@ -734,10 +797,10 @@ EDA_ITEM* MODULE::Clone() const
|
|||
|
||||
void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction )
|
||||
{
|
||||
for( D_PAD* pad = m_Pads.GetFirst(); pad; pad = pad->Next() )
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
aFunction( static_cast<BOARD_ITEM*>( pad ) );
|
||||
|
||||
for( BOARD_ITEM* drawing = m_Drawings.GetFirst(); drawing; drawing = drawing->Next() )
|
||||
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
|
||||
aFunction( drawing );
|
||||
|
||||
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
|
||||
|
@ -767,6 +830,21 @@ void MODULE::ViewUpdate( int aUpdateFlags )
|
|||
}
|
||||
|
||||
|
||||
void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = ITEM_GAL_LAYER( ANCHOR_VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
unsigned int MODULE::ViewGetLOD( int aLayer ) const
|
||||
{
|
||||
// Currently there is only one layer, so there is nothing to check
|
||||
// if( aLayer == ITEM_GAL_LAYER( ANCHOR_VISIBLE ) )
|
||||
return 30;
|
||||
}
|
||||
|
||||
|
||||
/* Test for validity of the name in a library of the footprint
|
||||
* ( no spaces, dir separators ... )
|
||||
* return true if the given name is valid
|
||||
|
|
|
@ -91,9 +91,31 @@ public:
|
|||
* Function Add
|
||||
* adds the given item to this MODULE and takes ownership of its memory.
|
||||
* @param aBoardItem The item to add to this board.
|
||||
* @param doInsert If true, then insert, else append
|
||||
* void Add( BOARD_ITEM* aBoardItem, bool doInsert = true );
|
||||
* @param doAppend If true, then append, else insert.
|
||||
*/
|
||||
void Add( BOARD_ITEM* aBoardItem, bool doAppend = true );
|
||||
|
||||
/**
|
||||
* Function Delete
|
||||
* removes the given single item from this MODULE and deletes its memory.
|
||||
* @param aBoardItem The item to remove from this module and delete
|
||||
*/
|
||||
void Delete( BOARD_ITEM* aBoardItem )
|
||||
{
|
||||
// developers should run DEBUG versions and fix such calls with NULL
|
||||
wxASSERT( aBoardItem );
|
||||
|
||||
if( aBoardItem )
|
||||
delete Remove( aBoardItem );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Remove
|
||||
* removes \a aBoardItem from this MODULE and returns it to caller without deleting it.
|
||||
* @param aBoardItem The item to remove from this module.
|
||||
* @return BOARD_ITEM* \a aBoardItem which was passed in.
|
||||
*/
|
||||
BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem );
|
||||
|
||||
/**
|
||||
* Function CalculateBoundingBox
|
||||
|
@ -436,14 +458,6 @@ public:
|
|||
*/
|
||||
void Add3DModel( S3D_MASTER* a3DModel );
|
||||
|
||||
/**
|
||||
* Function AddPad
|
||||
* adds \a aPad to the end of the pad list.
|
||||
*
|
||||
* @param aPad A pointer to a #D_PAD to add to the list.
|
||||
*/
|
||||
void AddPad( D_PAD* aPad );
|
||||
|
||||
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] );
|
||||
|
||||
|
@ -469,6 +483,12 @@ public:
|
|||
/// @copydoc VIEW_ITEM::ViewUpdate()
|
||||
void ViewUpdate( int aUpdateFlags = KIGFX::VIEW_ITEM::ALL );
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLOD()
|
||||
virtual unsigned int ViewGetLOD( int aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function CopyNetlistSettings
|
||||
* copies the netlist settings to \a aModule.
|
||||
|
|
|
@ -228,6 +228,37 @@ const EDA_RECT D_PAD::GetBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
void D_PAD::SetDrawCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
|
||||
m_Pos = m_Pos0;
|
||||
|
||||
if( module == NULL )
|
||||
return;
|
||||
|
||||
double angle = module->GetOrientation();
|
||||
|
||||
RotatePoint( &m_Pos.x, &m_Pos.y, angle );
|
||||
m_Pos += module->GetPosition();
|
||||
}
|
||||
|
||||
|
||||
void D_PAD::SetLocalCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
|
||||
if( module == NULL )
|
||||
{
|
||||
m_Pos0 = m_Pos;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Pos0 = m_Pos - module->GetPosition();
|
||||
RotatePoint( &m_Pos0.x, &m_Pos0.y, -module->GetOrientation() );
|
||||
}
|
||||
|
||||
|
||||
void D_PAD::SetAttribute( PAD_ATTR_T aAttribute )
|
||||
{
|
||||
m_Attribute = aAttribute;
|
||||
|
@ -797,6 +828,13 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
|
|||
}
|
||||
|
||||
|
||||
void D_PAD::Rotate( const wxPoint& aRotCentre, double aAngle )
|
||||
{
|
||||
RotatePoint( &m_Pos, aRotCentre, aAngle );
|
||||
m_Orient += aAngle;
|
||||
}
|
||||
|
||||
|
||||
wxString D_PAD::ShowPadShape() const
|
||||
{
|
||||
switch( GetShape() )
|
||||
|
@ -924,7 +962,7 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
|
||||
unsigned int D_PAD::ViewGetLOD( int aLayer ) const
|
||||
{
|
||||
// Netnames and soldermasks will be shown only if zoom is appropriate
|
||||
// Netnames will be shown only if zoom is appropriate
|
||||
if( IsNetnameLayer( aLayer ) )
|
||||
{
|
||||
return ( 100000000 / std::max( m_Size.x, m_Size.y ) );
|
||||
|
|
|
@ -381,6 +381,12 @@ public:
|
|||
// Virtual function:
|
||||
const EDA_RECT GetBoundingBox() const;
|
||||
|
||||
///> Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
||||
///> Set relative coordinates.
|
||||
void SetLocalCoord();
|
||||
|
||||
/**
|
||||
* Function Compare
|
||||
* compares two pads and return 0 if they are equal.
|
||||
|
@ -391,8 +397,10 @@ public:
|
|||
void Move( const wxPoint& aMoveVector )
|
||||
{
|
||||
m_Pos += aMoveVector;
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
void Rotate( const wxPoint& aRotCentre, double aAngle );
|
||||
|
||||
wxString GetSelectMenuText() const;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
|
|||
};
|
||||
|
||||
|
||||
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) :
|
||||
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) :
|
||||
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
|
||||
myframe( aParent )
|
||||
{
|
||||
|
@ -356,7 +356,6 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
|
||||
{
|
||||
myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor );
|
||||
myframe->ReCreateLayerBox( false );
|
||||
|
||||
if( myframe->IsGalCanvasActive() )
|
||||
{
|
||||
|
@ -373,7 +372,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
|
|||
{
|
||||
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
|
||||
// false from this function.
|
||||
myframe->SetActiveLayer( ToLAYER_ID( aLayer ), false );
|
||||
myframe->SetActiveLayer( ToLAYER_ID( aLayer ) );
|
||||
|
||||
if( m_alwaysShowActiveCopperLayer )
|
||||
OnLayerSelected();
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#ifndef CLASS_PCB_LAYER_WIDGET_H_
|
||||
#define CLASS_PCB_LAYER_WIDGET_H_
|
||||
|
||||
#include <layer_widget.h>
|
||||
|
||||
/**
|
||||
* Class PCB_LAYER_WIDGET
|
||||
* is here to implement the abtract functions of LAYER_WIDGET so they
|
||||
|
@ -49,7 +51,7 @@ public:
|
|||
* effectively sets the overal size of the widget via the row height and bitmap
|
||||
* button sizes.
|
||||
*/
|
||||
PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
|
||||
PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
|
||||
|
||||
void ReFill();
|
||||
|
||||
|
@ -108,7 +110,7 @@ protected:
|
|||
bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer
|
||||
// even if it is changed
|
||||
|
||||
PCB_EDIT_FRAME* myframe;
|
||||
PCB_BASE_FRAME* myframe;
|
||||
|
||||
// popup menu ids.
|
||||
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
|
||||
|
|
|
@ -129,7 +129,7 @@ int TEXTE_MODULE::GetLength() const
|
|||
return m_Text.Len();
|
||||
}
|
||||
|
||||
// Update draw coordinates
|
||||
|
||||
void TEXTE_MODULE::SetDrawCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
|
@ -146,8 +146,6 @@ void TEXTE_MODULE::SetDrawCoord()
|
|||
}
|
||||
|
||||
|
||||
// Update "local" coordinates (coordinates relatives to the footprint
|
||||
// anchor point)
|
||||
void TEXTE_MODULE::SetLocalCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
|
@ -163,6 +161,7 @@ void TEXTE_MODULE::SetLocalCoord()
|
|||
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
|
||||
}
|
||||
|
||||
|
||||
bool TEXTE_MODULE::HitTest( const wxPoint& aPosition ) const
|
||||
{
|
||||
wxPoint rel_pos;
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
return aItem && PCB_MODULE_TEXT_T == aItem->Type();
|
||||
}
|
||||
|
||||
|
||||
virtual const wxPoint& GetPosition() const
|
||||
{
|
||||
return m_Pos;
|
||||
|
@ -117,9 +116,11 @@ public:
|
|||
// Virtual function
|
||||
const EDA_RECT GetBoundingBox() const;
|
||||
|
||||
void SetDrawCoord(); // Set absolute coordinates.
|
||||
///> Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
||||
void SetLocalCoord(); // Set relative coordinates.
|
||||
///> Set relative coordinates.
|
||||
void SetLocalCoord();
|
||||
|
||||
/* drawing functions */
|
||||
void Draw( EDA_DRAW_PANEL* panel,
|
||||
|
|
|
@ -86,7 +86,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
|
|||
};
|
||||
|
||||
|
||||
const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
|
||||
const KICAD_T GENERAL_COLLECTOR::Modules[] = {
|
||||
PCB_MODULE_T,
|
||||
EOT
|
||||
};
|
||||
|
@ -118,12 +118,21 @@ const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
|
|||
};
|
||||
|
||||
|
||||
const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
|
||||
PCB_MODULE_TEXT_T,
|
||||
PCB_MODULE_EDGE_T,
|
||||
PCB_PAD_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T GENERAL_COLLECTOR::Tracks[] = {
|
||||
PCB_TRACE_T,
|
||||
PCB_VIA_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T GENERAL_COLLECTOR::Zones[] = {
|
||||
PCB_ZONE_AREA_T,
|
||||
EOT
|
||||
|
|
|
@ -262,7 +262,7 @@ public:
|
|||
/**
|
||||
* A scan list for only MODULEs
|
||||
*/
|
||||
static const KICAD_T ModuleItems[];
|
||||
static const KICAD_T Modules[];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -282,6 +282,12 @@ public:
|
|||
static const KICAD_T ModulesAndTheirItems[];
|
||||
|
||||
|
||||
/**
|
||||
* A scan list for primary module items.
|
||||
*/
|
||||
static const KICAD_T ModuleItems[];
|
||||
|
||||
|
||||
/**
|
||||
* A scan list for only TRACKS
|
||||
*/
|
||||
|
|
|
@ -119,7 +119,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
|||
else if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||
{
|
||||
if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) )
|
||||
scanList = GENERAL_COLLECTOR::ModuleItems;
|
||||
scanList = GENERAL_COLLECTOR::Modules;
|
||||
else
|
||||
scanList = (DisplayOpt.DisplayZonesMode == 0) ?
|
||||
GENERAL_COLLECTOR::AllBoardItems :
|
||||
|
@ -138,7 +138,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
|||
break;
|
||||
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
scanList = GENERAL_COLLECTOR::ModuleItems;
|
||||
scanList = GENERAL_COLLECTOR::Modules;
|
||||
break;
|
||||
|
||||
case ID_PCB_ZONES_BUTT:
|
||||
|
|
|
@ -44,34 +44,12 @@
|
|||
#include <class_module.h>
|
||||
#include <class_text_mod.h>
|
||||
|
||||
#include <dialog_edit_module_text_base.h>
|
||||
#include <dialog_edit_module_text.h>
|
||||
|
||||
|
||||
extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod.cpp
|
||||
|
||||
|
||||
/*************** **************/
|
||||
/* class DialogEditModuleText */
|
||||
/*************** **************/
|
||||
class DialogEditModuleText : public DialogEditModuleText_base
|
||||
{
|
||||
private:
|
||||
PCB_BASE_FRAME* m_parent;
|
||||
wxDC* m_dc;
|
||||
MODULE* m_module;
|
||||
TEXTE_MODULE* m_currentText;
|
||||
|
||||
public:
|
||||
DialogEditModuleText( PCB_BASE_FRAME* aParent, TEXTE_MODULE* aTextMod, wxDC* aDC );
|
||||
~DialogEditModuleText() {};
|
||||
|
||||
private:
|
||||
void initDlg( );
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC )
|
||||
{
|
||||
m_canvas->SetIgnoreMouseEvents( true );
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras
|
||||
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_EDIT_MODULE_TEXT_H
|
||||
#define DIALOG_EDIT_MODULE_TEXT_H
|
||||
|
||||
#include <dialog_edit_module_text_base.h>
|
||||
|
||||
/*************** **************/
|
||||
/* class DialogEditModuleText */
|
||||
/*************** **************/
|
||||
class DialogEditModuleText : public DialogEditModuleText_base
|
||||
{
|
||||
private:
|
||||
PCB_BASE_FRAME* m_parent;
|
||||
wxDC* m_dc;
|
||||
MODULE* m_module;
|
||||
TEXTE_MODULE* m_currentText;
|
||||
|
||||
public:
|
||||
DialogEditModuleText( PCB_BASE_FRAME* aParent, TEXTE_MODULE* aTextMod, wxDC* aDC );
|
||||
~DialogEditModuleText() {};
|
||||
|
||||
private:
|
||||
void initDlg( );
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
#endif /* DIALOG_EDIT_MODULE_TEXT_H */
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "dialog_enum_pads.h"
|
||||
|
||||
DIALOG_ENUM_PADS::DIALOG_ENUM_PADS( wxWindow* aParent ) :
|
||||
DIALOG_ENUM_PADS_BASE( aParent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int DIALOG_ENUM_PADS::GetStartNumber() const
|
||||
{
|
||||
return m_padStartNum->GetValue();
|
||||
}
|
||||
|
||||
|
||||
wxString DIALOG_ENUM_PADS::GetPrefix() const
|
||||
{
|
||||
return m_padPrefix->GetValue();
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __dialog_enum_pads__
|
||||
#define __dialog_enum_pads__
|
||||
|
||||
/**
|
||||
@file
|
||||
Subclass of DIALOG_ENUM_PADS_BASE, which is generated by wxFormBuilder.
|
||||
*/
|
||||
|
||||
#include "dialog_enum_pads_base.h"
|
||||
|
||||
/** Implementing DIALOG_ENUM_PADS_BASE */
|
||||
class DIALOG_ENUM_PADS : public DIALOG_ENUM_PADS_BASE
|
||||
{
|
||||
public:
|
||||
/** Constructor */
|
||||
DIALOG_ENUM_PADS( wxWindow* parent );
|
||||
|
||||
///> Returns the starting number that is going to be used for the first enumerated pad.
|
||||
int GetStartNumber() const;
|
||||
|
||||
///> Returns common prefix for all enumerated pads.
|
||||
wxString GetPrefix() const;
|
||||
};
|
||||
|
||||
#endif // __dialog_enum_pads__
|
|
@ -0,0 +1,68 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_enum_pads_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bPrefixSizer;
|
||||
bPrefixSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_lblPadPrefix = new wxStaticText( this, wxID_ANY, _("Pad name prefix:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lblPadPrefix->Wrap( -1 );
|
||||
bPrefixSizer->Add( m_lblPadPrefix, 1, wxALL, 5 );
|
||||
|
||||
m_padPrefix = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_padPrefix->SetMaxLength( 4 );
|
||||
bPrefixSizer->Add( m_padPrefix, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bPrefixSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bPadNumSizer;
|
||||
bPadNumSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_lblPadStartNum = new wxStaticText( this, wxID_ANY, _("First pad number:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lblPadStartNum->Wrap( -1 );
|
||||
bPadNumSizer->Add( m_lblPadStartNum, 1, wxALL, 5 );
|
||||
|
||||
m_padStartNum = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 999, 1 );
|
||||
bPadNumSizer->Add( m_padStartNum, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bPadNumSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_lblInfo = new wxStaticText( this, wxID_ANY, _("Pad names are restricted to 4 characters (including number)."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lblInfo->Wrap( 320 );
|
||||
bMainSizer->Add( m_lblInfo, 0, wxALL, 5 );
|
||||
|
||||
m_stdButtons = new wxStdDialogButtonSizer();
|
||||
m_stdButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_stdButtons->AddButton( m_stdButtonsOK );
|
||||
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_stdButtons->AddButton( m_stdButtonsCancel );
|
||||
m_stdButtons->Realize();
|
||||
|
||||
bMainSizer->Add( m_stdButtons, 2, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
DIALOG_ENUM_PADS_BASE::~DIALOG_ENUM_PADS_BASE()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,572 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="11" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_enum_pads_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">DIALOG_ENUM_PADS_BASE</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_ENUM_PADS_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">340,240</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title">Pad enumeration settings</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bPrefixSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Pad name prefix:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_lblPadPrefix</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">4</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_padPrefix</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bPadNumSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">First pad number:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_lblPadStartNum</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxSpinCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="initial">1</property>
|
||||
<property name="max">999</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_padStartNum</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxSP_ARROW_KEYS</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnSpinCtrl"></event>
|
||||
<event name="OnSpinCtrlText"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Pad names are restricted to 4 characters (including number).</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_lblInfo</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">320</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">2</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_stdButtons</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnApplyButtonClick"></event>
|
||||
<event name="OnCancelButtonClick"></event>
|
||||
<event name="OnContextHelpButtonClick"></event>
|
||||
<event name="OnHelpButtonClick"></event>
|
||||
<event name="OnNoButtonClick"></event>
|
||||
<event name="OnOKButtonClick"></event>
|
||||
<event name="OnSaveButtonClick"></event>
|
||||
<event name="OnYesButtonClick"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,53 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_ENUM_PADS_BASE_H__
|
||||
#define __DIALOG_ENUM_PADS_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_ENUM_PADS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_ENUM_PADS_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_lblPadPrefix;
|
||||
wxTextCtrl* m_padPrefix;
|
||||
wxStaticText* m_lblPadStartNum;
|
||||
wxSpinCtrl* m_padStartNum;
|
||||
wxStaticText* m_lblInfo;
|
||||
wxStdDialogButtonSizer* m_stdButtons;
|
||||
wxButton* m_stdButtonsOK;
|
||||
wxButton* m_stdButtonsCancel;
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pad enumeration settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,240 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~DIALOG_ENUM_PADS_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_ENUM_PADS_BASE_H__
|
|
@ -154,11 +154,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
{
|
||||
int id = event.GetId();
|
||||
bool state = event.IsChecked();
|
||||
KIGFX::PCB_PAINTER* painter =
|
||||
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS* settings =
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
|
||||
KICAD_T updateType = EOT;
|
||||
|
||||
switch( id )
|
||||
{
|
||||
|
@ -193,44 +188,33 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
|
||||
case ID_TB_OPTIONS_SHOW_ZONES:
|
||||
DisplayOpt.DisplayZonesMode = 0;
|
||||
updateType = PCB_ZONE_AREA_T;
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
|
||||
DisplayOpt.DisplayZonesMode = 1;
|
||||
updateType = PCB_ZONE_AREA_T;
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
|
||||
DisplayOpt.DisplayZonesMode = 2;
|
||||
updateType = PCB_ZONE_AREA_T;
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
||||
m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
|
||||
updateType = PCB_VIA_T;
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
|
||||
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = !state;
|
||||
updateType = PCB_TRACE_T;
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
|
||||
{
|
||||
DisplayOpt.ContrastModeDisplay = state;
|
||||
|
||||
// Apply new display options to the GAL canvas (this is faster than recaching)
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
|
||||
SetHighContrastLayer( GetActiveLayer() );
|
||||
m_canvas->Refresh();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -260,21 +244,4 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
if( updateType != EOT )
|
||||
{
|
||||
// Apply new display options to the GAL canvas
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
|
||||
// Find items that require update
|
||||
KICAD_T scanList[] = { updateType, EOT };
|
||||
TYPE_COLLECTOR collector;
|
||||
collector.Collect( GetBoard(), scanList );
|
||||
|
||||
for( int i = 0; i < collector.GetCount(); ++i )
|
||||
collector[i]->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
|
|
|
@ -254,6 +254,9 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
|
|||
if( gen_rastnest )
|
||||
m_Parent->Compile_Ratsnest( NULL, true );
|
||||
|
||||
if( m_Parent->IsGalCanvasActive() )
|
||||
pcb->GetRatsnest()->Recalculate();
|
||||
|
||||
}
|
||||
|
||||
m_Parent->GetCanvas()->Refresh();
|
||||
|
|
|
@ -117,6 +117,8 @@ private:
|
|||
|
||||
bool padValuesOK(); ///< test if all values are acceptable for the pad
|
||||
|
||||
void redraw();
|
||||
|
||||
/**
|
||||
* Function setPadLayersList
|
||||
* updates the CheckBox states in pad layers list,
|
||||
|
@ -174,6 +176,21 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
|
|||
else // We are editing a "master" pad, i.e. a pad used to create new pads
|
||||
m_dummyPad->Copy( m_padMaster );
|
||||
|
||||
if( m_parent->IsGalCanvasActive() )
|
||||
{
|
||||
m_panelShowPadGal->UseColorScheme( m_board->GetColorsSettings() );
|
||||
m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() );
|
||||
m_panelShowPad->Hide();
|
||||
m_panelShowPadGal->Show();
|
||||
m_panelShowPadGal->GetView()->Add( m_dummyPad );
|
||||
m_panelShowPadGal->StartDrawing();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_panelShowPad->Show();
|
||||
m_panelShowPadGal->Hide();
|
||||
}
|
||||
|
||||
initValues();
|
||||
|
||||
m_sdbSizer1OK->SetDefault();
|
||||
|
@ -537,7 +554,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
transferDataToPad( m_dummyPad );
|
||||
m_panelShowPad->Refresh();
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -566,7 +583,7 @@ void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
transferDataToPad( m_dummyPad );
|
||||
m_panelShowPad->Refresh();
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -599,7 +616,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
|
|||
m_PadOrientCtrl->SetValue( msg );
|
||||
|
||||
transferDataToPad( m_dummyPad );
|
||||
m_panelShowPad->Refresh();
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -667,7 +684,7 @@ void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask )
|
|||
void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
|
||||
{
|
||||
transferDataToPad( m_dummyPad );
|
||||
m_panelShowPad->Refresh();
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -758,6 +775,29 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_PAD_PROPERTIES::redraw()
|
||||
{
|
||||
if( m_parent->IsGalCanvasActive() )
|
||||
{
|
||||
m_dummyPad->ViewUpdate();
|
||||
|
||||
BOX2I bbox = m_dummyPad->ViewBBox();
|
||||
|
||||
// Autozoom
|
||||
m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
|
||||
|
||||
// Add a margin
|
||||
m_panelShowPadGal->GetView()->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
|
||||
|
||||
m_panelShowPadGal->Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_panelShowPad->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
||||
{
|
||||
if( !padValuesOK() )
|
||||
|
@ -1132,7 +1172,7 @@ void DIALOG_PAD_PROPERTIES::OnValuesChanged( wxCommandEvent& event )
|
|||
if( m_canUpdate )
|
||||
{
|
||||
transferDataToPad( m_dummyPad );
|
||||
m_panelShowPad->Refresh();
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -536,6 +536,9 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
|||
|
||||
bSizerDisplayPad->Add( m_panelShowPad, 4, wxRIGHT|wxTOP|wxEXPAND, 5 );
|
||||
|
||||
m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
bSizerDisplayPad->Add( m_panelShowPadGal, 4, wxEXPAND|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
|
||||
bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
|
|
@ -8310,6 +8310,91 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxTOP</property>
|
||||
<property name="proportion">4</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">PCB_DRAW_PANEL_GAL</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction">m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration">PCB_DRAW_PANEL_GAL* m_panelShowPadGal;</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <pcb_draw_panel_gal.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panelShowPadGal</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -30,6 +30,7 @@ class DIALOG_SHIM;
|
|||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
|
@ -143,6 +144,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_ThermalGapUnits;
|
||||
wxStaticText* m_staticTextWarning;
|
||||
wxPanel* m_panelShowPad;
|
||||
PCB_DRAW_PANEL_GAL* m_panelShowPadGal;
|
||||
wxStaticText* m_staticTextWarningPadFlipped;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <router/pns_routing_settings.h>
|
||||
#include <base_units.h>
|
||||
#include <confirm.h>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) :
|
||||
DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
|
||||
|
|
|
@ -1213,14 +1213,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_GEN_IMPORT_DXF_FILE:
|
||||
InvokeDXFDialogImport( this );
|
||||
InvokeDXFDialogBoardImport( this );
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ),
|
||||
id );
|
||||
msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
}
|
||||
|
@ -1385,31 +1384,6 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
|||
if( GetToolId() == id )
|
||||
return;
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
std::string actionName = COMMON_ACTIONS::TranslateLegacyId( id );
|
||||
|
||||
if( !actionName.empty() || id == ID_NO_TOOL_SELECTED )
|
||||
{
|
||||
const int MAX_TRIALS = 10;
|
||||
int trials = 0;
|
||||
|
||||
// Cancel the current tool
|
||||
// TODO while sending a lot of cancel events works for sure, it is not the most
|
||||
// elegant way to cancel a tool, this should be probably done another way
|
||||
while( m_toolManager->GetCurrentTool()->GetName() != "pcbnew.InteractiveSelection" &&
|
||||
trials++ < MAX_TRIALS )
|
||||
{
|
||||
TOOL_EVENT cancel( TC_ANY, TA_CANCEL_TOOL );
|
||||
m_toolManager->ProcessEvent( cancel );
|
||||
}
|
||||
|
||||
if( !actionName.empty() )
|
||||
m_toolManager->RunAction( actionName );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
||||
|
||||
// Stop the current command and deselect the current tool.
|
||||
|
@ -1506,4 +1480,3 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR,
|
|||
pad->SetShape( PAD_OVAL );
|
||||
}
|
||||
|
||||
module->AddPad( pad );
|
||||
module->Add( pad );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR,
|
|||
if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y )
|
||||
pad->SetShape( PAD_OVAL );
|
||||
|
||||
module->AddPad( pad );
|
||||
module->Add( pad );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,42 +27,24 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <dialog_dxf_import.h>
|
||||
//#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <dxf2brd_items.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <convert_from_iu.h>
|
||||
#include <dialog_dxf_import_base.h>
|
||||
#include <class_pcb_layer_box_selector.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_edge_mod.h>
|
||||
#include <class_text_mod.h>
|
||||
#include <class_pcb_text.h>
|
||||
|
||||
// Keys to store setup in config
|
||||
#define DXF_IMPORT_LAYER_OPTION_KEY wxT("DxfImportBrdLayer")
|
||||
#define DXF_IMPORT_COORD_ORIGIN_KEY wxT("DxfImportCoordOrigin")
|
||||
#define DXF_IMPORT_LAST_FILE_KEY wxT("DxfImportLastFile")
|
||||
|
||||
class DIALOG_DXF_IMPORT : public DIALOG_DXF_IMPORT_BASE
|
||||
{
|
||||
private:
|
||||
PCB_EDIT_FRAME * m_parent;
|
||||
wxConfigBase* m_config; // Current config
|
||||
|
||||
static wxString m_dxfFilename;
|
||||
static int m_offsetSelection;
|
||||
static LAYER_NUM m_layer;
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_DXF_IMPORT( PCB_EDIT_FRAME* aParent );
|
||||
~DIALOG_DXF_IMPORT();
|
||||
|
||||
private:
|
||||
// Virtual event handlers
|
||||
void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
void OnOKClick( wxCommandEvent& event );
|
||||
void OnBrowseDxfFiles( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
// Static members of DIALOG_DXF_IMPORT, to remember
|
||||
// the user's choices during the session
|
||||
wxString DIALOG_DXF_IMPORT::m_dxfFilename;
|
||||
|
@ -70,8 +52,8 @@ int DIALOG_DXF_IMPORT::m_offsetSelection = 4;
|
|||
LAYER_NUM DIALOG_DXF_IMPORT::m_layer = Dwgs_User;
|
||||
|
||||
|
||||
DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_EDIT_FRAME* aParent ) :
|
||||
DIALOG_DXF_IMPORT_BASE( aParent )
|
||||
DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent )
|
||||
: DIALOG_DXF_IMPORT_BASE( aParent )
|
||||
{
|
||||
m_parent = aParent;
|
||||
m_config = Kiface().KifaceSettings();
|
||||
|
@ -121,16 +103,18 @@ DIALOG_DXF_IMPORT::~DIALOG_DXF_IMPORT()
|
|||
void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event )
|
||||
{
|
||||
wxString path;
|
||||
wxString filename;
|
||||
|
||||
if( !m_dxfFilename.IsEmpty() )
|
||||
{
|
||||
wxFileName fn( m_dxfFilename );
|
||||
path = fn.GetPath();
|
||||
filename = fn.GetFullName();
|
||||
}
|
||||
wxFileDialog dlg( m_parent,
|
||||
wxT( "Open File" ),
|
||||
path, m_dxfFilename,
|
||||
wxT( "dxf Files (*.dxf)|*.dxf|*.DXF" ),
|
||||
path, filename,
|
||||
wxT( "dxf Files (*.dxf)|*.dxf" ),
|
||||
wxFD_OPEN|wxFD_FILE_MUST_EXIST );
|
||||
dlg.ShowModal();
|
||||
|
||||
|
@ -143,6 +127,7 @@ void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event )
|
|||
m_textCtrlFileName->SetValue( fileName );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DXF_IMPORT::OnOKClick( wxCommandEvent& event )
|
||||
{
|
||||
m_dxfFilename = m_textCtrlFileName->GetValue();
|
||||
|
@ -173,41 +158,105 @@ void DIALOG_DXF_IMPORT::OnOKClick( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
BOARD * brd = m_parent->GetBoard();
|
||||
DXF2BRD_CONVERTER dxf_importer;
|
||||
|
||||
// Set coordinates offset for import (offset is given in mm)
|
||||
dxf_importer.SetOffset( offsetX, offsetY );
|
||||
m_dxfImporter.SetOffset( offsetX, offsetY );
|
||||
m_layer = m_SelLayerBox->GetLayerSelection();
|
||||
dxf_importer.SetBrdLayer( m_layer );
|
||||
m_dxfImporter.SetBrdLayer( m_layer );
|
||||
|
||||
// Read dxf file:
|
||||
dxf_importer.ImportDxfFile( m_dxfFilename, brd );
|
||||
|
||||
// Prepare the undo list
|
||||
std::vector<BOARD_ITEM*>& list = dxf_importer.GetItemsList();
|
||||
PICKED_ITEMS_LIST picklist;
|
||||
|
||||
// Build the undo list
|
||||
for( unsigned ii = 0; ii < list.size(); ii++ )
|
||||
{
|
||||
ITEM_PICKER itemWrapper( list[ii], UR_NEW );
|
||||
picklist.PushItem( itemWrapper );
|
||||
}
|
||||
|
||||
m_parent->SaveCopyInUndoList( picklist, UR_NEW, wxPoint(0,0) );
|
||||
m_dxfImporter.ImportDxfFile( m_dxfFilename );
|
||||
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
|
||||
bool InvokeDXFDialogImport( PCB_EDIT_FRAME* aCaller )
|
||||
bool InvokeDXFDialogBoardImport( PCB_BASE_FRAME* aCaller )
|
||||
{
|
||||
DIALOG_DXF_IMPORT dlg( aCaller );
|
||||
bool success = dlg.ShowModal() == wxID_OK;
|
||||
bool success = ( dlg.ShowModal() == wxID_OK );
|
||||
|
||||
if( success )
|
||||
{
|
||||
const std::list<BOARD_ITEM*>& list = dlg.GetImportedItems();
|
||||
PICKED_ITEMS_LIST picklist;
|
||||
|
||||
BOARD* board = aCaller->GetBoard();
|
||||
KIGFX::VIEW* view = aCaller->GetGalCanvas()->GetView();
|
||||
|
||||
std::list<BOARD_ITEM*>::const_iterator it, itEnd;
|
||||
for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
|
||||
{
|
||||
BOARD_ITEM* item = *it;
|
||||
board->Add( item );
|
||||
|
||||
ITEM_PICKER itemWrapper( item, UR_NEW );
|
||||
picklist.PushItem( itemWrapper );
|
||||
|
||||
if( aCaller->IsGalCanvasActive() )
|
||||
view->Add( item );
|
||||
}
|
||||
|
||||
aCaller->SaveCopyInUndoList( picklist, UR_NEW, wxPoint( 0, 0 ) );
|
||||
aCaller->OnModify();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool InvokeDXFDialogModuleImport( PCB_BASE_FRAME* aCaller, MODULE* aModule )
|
||||
{
|
||||
DIALOG_DXF_IMPORT dlg( aCaller );
|
||||
bool success = ( dlg.ShowModal() == wxID_OK );
|
||||
|
||||
if( success )
|
||||
{
|
||||
const std::list<BOARD_ITEM*>& list = dlg.GetImportedItems();
|
||||
MODULE* module = aCaller->GetBoard()->m_Modules;
|
||||
KIGFX::VIEW* view = aCaller->GetGalCanvas()->GetView();
|
||||
|
||||
aCaller->SaveCopyInUndoList( module, UR_MODEDIT );
|
||||
aCaller->OnModify();
|
||||
|
||||
std::list<BOARD_ITEM*>::const_iterator it, itEnd;
|
||||
for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
|
||||
{
|
||||
BOARD_ITEM* item = *it;
|
||||
BOARD_ITEM* converted = NULL;
|
||||
|
||||
// Modules use different types for the same things,
|
||||
// so we need to convert imported items to appropriate classes.
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
{
|
||||
converted = new EDGE_MODULE( module );
|
||||
*static_cast<DRAWSEGMENT*>( converted ) = *static_cast<DRAWSEGMENT*>( item );
|
||||
module->Add( converted );
|
||||
static_cast<EDGE_MODULE*>( converted )->SetLocalCoord();
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
converted = new TEXTE_MODULE( module );
|
||||
*static_cast<TEXTE_PCB*>( converted ) = *static_cast<TEXTE_PCB*>( item );
|
||||
module->Add( module );
|
||||
static_cast<TEXTE_MODULE*>( converted )->SetLocalCoord();
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assert( false ); // there is a type that is currently not handled here
|
||||
break;
|
||||
}
|
||||
|
||||
if( aCaller->IsGalCanvasActive() )
|
||||
view->Add( converted );
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <dialog_dxf_import_base.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <dxf2brd_items.h>
|
||||
|
||||
class DIALOG_DXF_IMPORT : public DIALOG_DXF_IMPORT_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent );
|
||||
~DIALOG_DXF_IMPORT();
|
||||
|
||||
/**
|
||||
* Function GetImportedItems()
|
||||
*
|
||||
* Returns a list of items imported from a DXF file.
|
||||
*/
|
||||
const std::list<BOARD_ITEM*>& GetImportedItems() const
|
||||
{
|
||||
return m_dxfImporter.GetItemsList();
|
||||
}
|
||||
|
||||
private:
|
||||
PCB_BASE_FRAME* m_parent;
|
||||
wxConfigBase* m_config; // Current config
|
||||
DXF2BRD_CONVERTER m_dxfImporter;
|
||||
|
||||
static wxString m_dxfFilename;
|
||||
static int m_offsetSelection;
|
||||
static LAYER_NUM m_layer;
|
||||
|
||||
// Virtual event handlers
|
||||
void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
void OnOKClick( wxCommandEvent& event );
|
||||
void OnBrowseDxfFiles( wxCommandEvent& event );
|
||||
};
|
|
@ -52,7 +52,6 @@ DXF2BRD_CONVERTER::DXF2BRD_CONVERTER() : DRW_Interface()
|
|||
m_xOffset = 0.0; // X coord offset for conversion (in mm)
|
||||
m_yOffset = 0.0; // Y coord offset for conversion (in mm)
|
||||
m_Dfx2mm = 1.0; // The scale factor to convert DXF units to mm
|
||||
m_brd = NULL;
|
||||
m_version = 0;
|
||||
m_defaultThickness = 0.1;
|
||||
m_brdLayer = Dwgs_User;
|
||||
|
@ -83,10 +82,8 @@ int DXF2BRD_CONVERTER::mapDim( double aDxfValue )
|
|||
}
|
||||
|
||||
|
||||
bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile, BOARD* aBoard )
|
||||
bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile )
|
||||
{
|
||||
m_brd = aBoard;
|
||||
|
||||
dxfRW* dxf = new dxfRW( aFile.ToUTF8() );
|
||||
bool success = dxf->read( this, true );
|
||||
|
||||
|
@ -95,23 +92,15 @@ bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile, BOARD* aBoard )
|
|||
return success;
|
||||
}
|
||||
|
||||
// Add aItem the the board
|
||||
// this item is also added to the list of new items
|
||||
// (for undo command for instance)
|
||||
void DXF2BRD_CONVERTER::appendToBoard( BOARD_ITEM * aItem )
|
||||
{
|
||||
m_brd->Add( aItem );
|
||||
m_newItemsList.push_back( aItem );
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of the method which handles layers.
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& data )
|
||||
void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& aData )
|
||||
{
|
||||
// Not yet useful in Pcbnew.
|
||||
#if 0
|
||||
wxString name = wxString::FromUTF8( data.name.c_str() );
|
||||
wxString name = wxString::FromUTF8( aData.name.c_str() );
|
||||
wxLogMessage( name );
|
||||
#endif
|
||||
}
|
||||
|
@ -120,25 +109,20 @@ void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& data )
|
|||
/*
|
||||
* Import line entities.
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addLine( const DRW_Line& data )
|
||||
void DXF2BRD_CONVERTER::addLine( const DRW_Line& aData )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
|
||||
wxPoint start( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
|
||||
|
||||
wxPoint start( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
segm->SetStart( start );
|
||||
|
||||
wxPoint end( mapX( data.secPoint.x ), mapY( data.secPoint.y ) );
|
||||
|
||||
wxPoint end( mapX( aData.secPoint.x ), mapY( aData.secPoint.y ) );
|
||||
segm->SetEnd( end );
|
||||
|
||||
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness : data.thickness ) );
|
||||
appendToBoard( segm );
|
||||
segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
m_newItemsList.push_back( segm );
|
||||
}
|
||||
|
||||
void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data )
|
||||
void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& aData )
|
||||
{
|
||||
// Currently, Pcbnew does not know polylines, for boards.
|
||||
// So we have to convert a polyline to a set of segments.
|
||||
|
@ -146,9 +130,9 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data )
|
|||
|
||||
wxPoint startpoint;
|
||||
|
||||
for( unsigned ii = 0; ii < data.vertlist.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aData.vertlist.size(); ii++ )
|
||||
{
|
||||
DRW_Vertex* vertex = data.vertlist[ii];
|
||||
DRW_Vertex* vertex = aData.vertlist[ii];
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
|
@ -157,20 +141,20 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data )
|
|||
continue;
|
||||
}
|
||||
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( NULL );
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetStart( startpoint );
|
||||
wxPoint endpoint( mapX( vertex->basePoint.x ), mapY( vertex->basePoint.y ) );
|
||||
segm->SetEnd( endpoint );
|
||||
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness
|
||||
: data.thickness ) );
|
||||
appendToBoard( segm );
|
||||
segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness
|
||||
: aData.thickness ) );
|
||||
m_newItemsList.push_back( segm );
|
||||
startpoint = endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
|
||||
void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& aData )
|
||||
{
|
||||
// Currently, Pcbnew does not know polylines, for boards.
|
||||
// So we have to convert a polyline to a set of segments.
|
||||
|
@ -179,9 +163,9 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
|
|||
// the variable width of each vertex (when exists) is not used.
|
||||
wxPoint startpoint;
|
||||
|
||||
for( unsigned ii = 0; ii < data.vertlist.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aData.vertlist.size(); ii++ )
|
||||
{
|
||||
DRW_Vertex2D* vertex = data.vertlist[ii];
|
||||
DRW_Vertex2D* vertex = aData.vertlist[ii];
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
|
@ -190,15 +174,15 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
|
|||
continue;
|
||||
}
|
||||
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( NULL );
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetStart( startpoint );
|
||||
wxPoint endpoint( mapX( vertex->x ), mapY( vertex->y ) );
|
||||
segm->SetEnd( endpoint );
|
||||
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness
|
||||
: data.thickness ) );
|
||||
appendToBoard( segm );
|
||||
segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness
|
||||
: aData.thickness ) );
|
||||
m_newItemsList.push_back( segm );
|
||||
startpoint = endpoint;
|
||||
}
|
||||
}
|
||||
|
@ -206,20 +190,18 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
|
|||
/*
|
||||
* Import Circle entities.
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data )
|
||||
void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& aData )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetShape( S_CIRCLE );
|
||||
wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
|
||||
wxPoint center( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
segm->SetCenter( center );
|
||||
wxPoint circle_start( mapX( data.basePoint.x + data.radious ),
|
||||
mapY( data.basePoint.y ) );
|
||||
wxPoint circle_start( mapX( aData.basePoint.x + aData.radious ), mapY( aData.basePoint.y ) );
|
||||
segm->SetArcStart( circle_start );
|
||||
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness
|
||||
: data.thickness ) );
|
||||
appendToBoard( segm );
|
||||
segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
m_newItemsList.push_back( segm );
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,7 +210,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data )
|
|||
*/
|
||||
void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetShape( S_ARC );
|
||||
|
@ -256,25 +238,24 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
|
|||
|
||||
segm->SetAngle( angle );
|
||||
|
||||
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness
|
||||
: data.thickness ) );
|
||||
appendToBoard( segm );
|
||||
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness : data.thickness ) );
|
||||
m_newItemsList.push_back( segm );
|
||||
}
|
||||
|
||||
/**
|
||||
* Import texts (TEXT).
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
|
||||
void DXF2BRD_CONVERTER::addText( const DRW_Text& aData )
|
||||
{
|
||||
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd );
|
||||
TEXTE_PCB* pcb_text = new TEXTE_PCB( NULL );
|
||||
pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
|
||||
wxPoint refPoint( mapX(data.basePoint.x), mapY(data.basePoint.y) );
|
||||
wxPoint secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) );
|
||||
wxPoint refPoint( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
wxPoint secPoint( mapX( aData.secPoint.x ), mapY( aData.secPoint.y ) );
|
||||
|
||||
if (data.alignV !=0 || data.alignH !=0 ||data.alignH ==DRW_Text::HMiddle)
|
||||
if( aData.alignV != 0 || aData.alignH != 0 || aData.alignH == DRW_Text::HMiddle )
|
||||
{
|
||||
if (data.alignH !=DRW_Text::HAligned && data.alignH !=DRW_Text::HFit)
|
||||
if( aData.alignH != DRW_Text::HAligned && aData.alignH != DRW_Text::HFit )
|
||||
{
|
||||
wxPoint tmp = secPoint;
|
||||
secPoint = refPoint;
|
||||
|
@ -282,7 +263,7 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
|
|||
}
|
||||
}
|
||||
|
||||
switch( data.alignV )
|
||||
switch( aData.alignV )
|
||||
{
|
||||
case DRW_Text::VBaseLine:
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
|
@ -301,7 +282,7 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
|
|||
break;
|
||||
}
|
||||
|
||||
switch( data.alignH )
|
||||
switch( aData.alignH )
|
||||
{
|
||||
case DRW_Text::HLeft:
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
|
@ -332,13 +313,13 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
|
|||
}
|
||||
|
||||
#if 0
|
||||
wxString sty = wxString::FromUTF8(data.style.c_str());
|
||||
wxString sty = wxString::FromUTF8(aData.style.c_str());
|
||||
sty=sty.ToLower();
|
||||
|
||||
if (data.textgen==2)
|
||||
if (aData.textgen==2)
|
||||
{
|
||||
// Text dir = left to right;
|
||||
} else if (data.textgen==4)
|
||||
} else if (aData.textgen==4)
|
||||
{
|
||||
/ Text dir = top to bottom;
|
||||
} else
|
||||
|
@ -346,27 +327,26 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
|
|||
}
|
||||
#endif
|
||||
|
||||
wxString text = toNativeString( wxString::FromUTF8( data.text.c_str() ) );
|
||||
wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
|
||||
|
||||
pcb_text->SetTextPosition( refPoint );
|
||||
pcb_text->SetOrientation( data.angle * 10 );
|
||||
pcb_text->SetOrientation( aData.angle * 10 );
|
||||
// The 0.8 factor gives a better height/width ratio with our font
|
||||
pcb_text->SetWidth( mapDim( data.height * 0.8 ) );
|
||||
pcb_text->SetHeight( mapDim( data.height ) );
|
||||
pcb_text->SetThickness( mapDim( data.thickness == 0 ? m_defaultThickness
|
||||
: data.thickness ) );
|
||||
pcb_text->SetWidth( mapDim( aData.height * 0.8 ) );
|
||||
pcb_text->SetHeight( mapDim( aData.height ) );
|
||||
pcb_text->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
pcb_text->SetText( text );
|
||||
|
||||
appendToBoard( pcb_text );
|
||||
m_newItemsList.push_back( pcb_text );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import multi line texts (MTEXT).
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
|
||||
void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
|
||||
{
|
||||
wxString text = toNativeString( wxString::FromUTF8( data.text.c_str() ) );
|
||||
wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
|
||||
wxString attrib, tmp;
|
||||
|
||||
/* Some texts start by '\' and have formating chars (font name, font option...)
|
||||
|
@ -394,25 +374,23 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
|
|||
text = tmp;
|
||||
}
|
||||
|
||||
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd );
|
||||
TEXTE_PCB* pcb_text = new TEXTE_PCB( NULL );
|
||||
pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
|
||||
wxPoint textpos( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
|
||||
wxPoint textpos( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
pcb_text->SetTextPosition( textpos );
|
||||
pcb_text->SetOrientation( data.angle * 10 );
|
||||
pcb_text->SetOrientation( aData.angle * 10 );
|
||||
// The 0.8 factor gives a better height/width ratio with our font
|
||||
pcb_text->SetWidth( mapDim( data.height * 0.8 ) );
|
||||
pcb_text->SetHeight( mapDim( data.height ) );
|
||||
pcb_text->SetThickness( mapDim( data.thickness == 0 ? m_defaultThickness
|
||||
: data.thickness ) );
|
||||
pcb_text->SetWidth( mapDim( aData.height * 0.8 ) );
|
||||
pcb_text->SetHeight( mapDim( aData.height ) );
|
||||
pcb_text->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
pcb_text->SetText( text );
|
||||
|
||||
// Initialize text justifications:
|
||||
if( data.textgen <= 3 )
|
||||
if( aData.textgen <= 3 )
|
||||
{
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
}
|
||||
else if( data.textgen <= 6 )
|
||||
else if( aData.textgen <= 6 )
|
||||
{
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
}
|
||||
|
@ -421,11 +399,11 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
|
|||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
}
|
||||
|
||||
if( data.textgen % 3 == 1 )
|
||||
if( aData.textgen % 3 == 1 )
|
||||
{
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
}
|
||||
else if( data.textgen % 3 == 2 )
|
||||
else if( aData.textgen % 3 == 2 )
|
||||
{
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
}
|
||||
|
@ -448,7 +426,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
|
|||
// use ByStyle;
|
||||
}
|
||||
|
||||
if( data.alignV==1 )
|
||||
if( aData.alignV==1 )
|
||||
{
|
||||
// use AtLeast;
|
||||
}
|
||||
|
@ -458,7 +436,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
|
|||
}
|
||||
#endif
|
||||
|
||||
appendToBoard( pcb_text );
|
||||
m_newItemsList.push_back( pcb_text );
|
||||
}
|
||||
|
||||
|
||||
|
@ -490,18 +468,18 @@ void DXF2BRD_CONVERTER::addHeader( const DRW_Header* data )
|
|||
* - %%%d for a degree sign
|
||||
* - %%%p for a plus/minus sign
|
||||
*/
|
||||
wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str )
|
||||
wxString DXF2BRD_CONVERTER::toDxfString( const wxString& aStr )
|
||||
{
|
||||
wxString res;
|
||||
int j = 0;
|
||||
|
||||
for( unsigned i = 0; i<str.length(); ++i )
|
||||
for( unsigned i = 0; i<aStr.length(); ++i )
|
||||
{
|
||||
int c = str[i];
|
||||
int c = aStr[i];
|
||||
|
||||
if( c > 175 || c < 11 )
|
||||
{
|
||||
res.append( str.Mid( j, i - j ) );
|
||||
res.append( aStr.Mid( j, i - j ) );
|
||||
j = i;
|
||||
|
||||
switch( c )
|
||||
|
@ -539,7 +517,7 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str )
|
|||
}
|
||||
}
|
||||
|
||||
res.append( str.Mid( j ) );
|
||||
res.append( aStr.Mid( j ) );
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -547,26 +525,26 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str )
|
|||
/**
|
||||
* Converts a DXF encoded string into a native Unicode string.
|
||||
*/
|
||||
wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
|
||||
wxString DXF2BRD_CONVERTER::toNativeString( const wxString& aData )
|
||||
{
|
||||
wxString res;
|
||||
|
||||
// Ignore font tags:
|
||||
int j = 0;
|
||||
|
||||
for( unsigned i = 0; i<data.length(); ++i )
|
||||
for( unsigned i = 0; i < aData.length(); ++i )
|
||||
{
|
||||
if( data[ i ] == 0x7B ) // is '{' ?
|
||||
if( aData[ i ] == 0x7B ) // is '{' ?
|
||||
{
|
||||
if( data[ i + 1 ] == 0x5c && data[ i + 2 ] == 0x66 ) // is "\f" ?
|
||||
if( aData[ i + 1 ] == 0x5c && aData[ i + 2 ] == 0x66 ) // is "\f" ?
|
||||
{
|
||||
// found font tag, append parsed part
|
||||
res.append( data.Mid( j, i - j ) );
|
||||
res.append( aData.Mid( j, i - j ) );
|
||||
|
||||
// skip to ';'
|
||||
for( unsigned k = i + 3; k < data.length(); ++k )
|
||||
for( unsigned k = i + 3; k < aData.length(); ++k )
|
||||
{
|
||||
if( data[ k ] == 0x3B )
|
||||
if( aData[ k ] == 0x3B )
|
||||
{
|
||||
i = j = ++k;
|
||||
break;
|
||||
|
@ -574,11 +552,11 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
|
|||
}
|
||||
|
||||
// add to '}'
|
||||
for( unsigned k = i; k<data.length(); ++k )
|
||||
for( unsigned k = i; k < aData.length(); ++k )
|
||||
{
|
||||
if( data[ k ] == 0x7D )
|
||||
if( aData[ k ] == 0x7D )
|
||||
{
|
||||
res.append( data.Mid( i, k - i ) );
|
||||
res.append( aData.Mid( i, k - i ) );
|
||||
i = j = ++k;
|
||||
break;
|
||||
}
|
||||
|
@ -587,7 +565,7 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
|
|||
}
|
||||
}
|
||||
|
||||
res.append( data.Mid( j ) );
|
||||
res.append( aData.Mid( j ) );
|
||||
|
||||
#if 1
|
||||
wxRegEx regexp;
|
||||
|
@ -621,7 +599,7 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
|
|||
}
|
||||
|
||||
|
||||
void DXF2BRD_CONVERTER::addTextStyle( const DRW_Textstyle& data )
|
||||
void DXF2BRD_CONVERTER::addTextStyle( const DRW_Textstyle& aData )
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "drw_interface.h"
|
||||
#include "wx/wx.h"
|
||||
#include <list>
|
||||
|
||||
class BOARD;
|
||||
class BOARD_ITEM;
|
||||
|
@ -41,9 +42,7 @@ class BOARD_ITEM;
|
|||
class DXF2BRD_CONVERTER : public DRW_Interface
|
||||
{
|
||||
private:
|
||||
std::vector<BOARD_ITEM*> m_newItemsList; // The list of new items added
|
||||
// to the board
|
||||
BOARD * m_brd;
|
||||
std::list<BOARD_ITEM*> m_newItemsList; // The list of new items added to the board
|
||||
double m_xOffset; // X coord offset for conversion (in mm)
|
||||
double m_yOffset; // Y coord offset for conversion (in mm)
|
||||
double m_defaultThickness; // default line thickness for conversion (in mm)
|
||||
|
@ -83,14 +82,13 @@ public:
|
|||
* with this filter.
|
||||
*
|
||||
* @param aFile = the full filename.
|
||||
* @param aBoard = where to store the graphical items and text
|
||||
*/
|
||||
bool ImportDxfFile( const wxString& aFile, BOARD * aBoard );
|
||||
bool ImportDxfFile( const wxString& aFile );
|
||||
|
||||
/**
|
||||
* @return the list of new BOARD_ITEM
|
||||
*/
|
||||
std::vector<BOARD_ITEM*>& GetItemsList()
|
||||
const std::list<BOARD_ITEM*>& GetItemsList() const
|
||||
{
|
||||
return m_newItemsList;
|
||||
}
|
||||
|
@ -101,68 +99,63 @@ private:
|
|||
int mapY( double aDxfCoordY );
|
||||
int mapDim( double aDxfValue );
|
||||
|
||||
// Add aItem the the board
|
||||
// this item is also added to the list of new items
|
||||
// (for undo command for instance)
|
||||
void appendToBoard( BOARD_ITEM * aItem );
|
||||
|
||||
// Methods from DRW_CreationInterface:
|
||||
// They are "call back" fonctions, called when the corresponding object
|
||||
// is read in dxf file
|
||||
// Depending of the application, they can do something or not
|
||||
virtual void addHeader( const DRW_Header* data );
|
||||
virtual void addLType( const DRW_LType& data ){}
|
||||
virtual void addLayer( const DRW_Layer& data );
|
||||
virtual void addDimStyle( const DRW_Dimstyle& data ){}
|
||||
virtual void addBlock(const DRW_Block& data ){}
|
||||
virtual void addHeader( const DRW_Header* aData );
|
||||
virtual void addLType( const DRW_LType& aData ) {}
|
||||
virtual void addLayer( const DRW_Layer& aData );
|
||||
virtual void addDimStyle( const DRW_Dimstyle& aData ) {}
|
||||
virtual void addBlock( const DRW_Block& aData ) {}
|
||||
virtual void endBlock() {}
|
||||
virtual void addPoint(const DRW_Point& data ){}
|
||||
virtual void addLine(const DRW_Line& data);
|
||||
virtual void addRay(const DRW_Ray& data ){}
|
||||
virtual void addXline(const DRW_Xline& data ){}
|
||||
virtual void addCircle(const DRW_Circle& data );
|
||||
virtual void addArc(const DRW_Arc& data );
|
||||
virtual void addEllipse(const DRW_Ellipse& data ){}
|
||||
virtual void addLWPolyline(const DRW_LWPolyline& data );
|
||||
virtual void addText(const DRW_Text& data );
|
||||
virtual void addPolyline(const DRW_Polyline& data );
|
||||
virtual void addSpline(const DRW_Spline* data ){}
|
||||
virtual void addPoint( const DRW_Point& aData ) {}
|
||||
virtual void addLine( const DRW_Line& aData);
|
||||
virtual void addRay( const DRW_Ray& aData ) {}
|
||||
virtual void addXline( const DRW_Xline& aData ) {}
|
||||
virtual void addCircle( const DRW_Circle& aData );
|
||||
virtual void addArc( const DRW_Arc& aData );
|
||||
virtual void addEllipse( const DRW_Ellipse& aData ) {}
|
||||
virtual void addLWPolyline( const DRW_LWPolyline& aData );
|
||||
virtual void addText( const DRW_Text& aData );
|
||||
virtual void addPolyline( const DRW_Polyline& aData );
|
||||
virtual void addSpline( const DRW_Spline* aData ) {}
|
||||
virtual void addKnot( const DRW_Entity&) {}
|
||||
virtual void addInsert(const DRW_Insert& data ){}
|
||||
virtual void addTrace(const DRW_Trace& data ){}
|
||||
virtual void addSolid(const DRW_Solid& data ){}
|
||||
virtual void addMText(const DRW_MText& data);
|
||||
virtual void addDimAlign(const DRW_DimAligned *data ){}
|
||||
virtual void addDimLinear(const DRW_DimLinear *data ){}
|
||||
virtual void addDimRadial(const DRW_DimRadial *data ){}
|
||||
virtual void addDimDiametric(const DRW_DimDiametric *data ){}
|
||||
virtual void addDimAngular(const DRW_DimAngular *data ){}
|
||||
virtual void addDimAngular3P(const DRW_DimAngular3p *data ){}
|
||||
virtual void addDimOrdinate(const DRW_DimOrdinate *data ){}
|
||||
virtual void addLeader(const DRW_Leader *data ){}
|
||||
virtual void addHatch(const DRW_Hatch* data ){}
|
||||
virtual void addImage(const DRW_Image* data ){}
|
||||
virtual void linkImage(const DRW_ImageDef* data ){}
|
||||
virtual void addInsert( const DRW_Insert& aData ){}
|
||||
virtual void addTrace( const DRW_Trace& aData ){}
|
||||
virtual void addSolid( const DRW_Solid& aData ){}
|
||||
virtual void addMText( const DRW_MText& aData);
|
||||
virtual void addDimAlign( const DRW_DimAligned* aData ) {}
|
||||
virtual void addDimLinear( const DRW_DimLinear* aData ) {}
|
||||
virtual void addDimRadial( const DRW_DimRadial* aData ) {}
|
||||
virtual void addDimDiametric( const DRW_DimDiametric* aData ) {}
|
||||
virtual void addDimAngular( const DRW_DimAngular* aData ) {}
|
||||
virtual void addDimAngular3P( const DRW_DimAngular3p* aData ) {}
|
||||
virtual void addDimOrdinate( const DRW_DimOrdinate* aData ) {}
|
||||
virtual void addLeader( const DRW_Leader* aData ) {}
|
||||
virtual void addHatch( const DRW_Hatch* aData ) {}
|
||||
virtual void addImage( const DRW_Image* aData ) {}
|
||||
virtual void linkImage( const DRW_ImageDef* aData ) {}
|
||||
|
||||
virtual void add3dFace(const DRW_3Dface& data ){}
|
||||
virtual void add3dFace( const DRW_3Dface& aData ) {}
|
||||
virtual void addComment( const char*) {}
|
||||
|
||||
virtual void addVport(const DRW_Vport& data) {}
|
||||
virtual void addVport( const DRW_Vport& aData ) {}
|
||||
|
||||
virtual void addTextStyle(const DRW_Textstyle& data);
|
||||
virtual void addTextStyle( const DRW_Textstyle& aData );
|
||||
|
||||
virtual void addViewport(const DRW_Viewport& data) {}
|
||||
virtual void addViewport( const DRW_Viewport& aData ) {}
|
||||
|
||||
virtual void setBlock(const int handle) {}
|
||||
virtual void setBlock( const int aHandle ) {}
|
||||
|
||||
static wxString toDxfString(const wxString& str);
|
||||
static wxString toNativeString(const wxString& data);
|
||||
static wxString toDxfString( const wxString& aStr );
|
||||
static wxString toNativeString( const wxString& aData );
|
||||
|
||||
// These functions are not used in Kicad.
|
||||
// But because they are virtual pure in DRW_Interface, they should be defined
|
||||
virtual void writeTextstyles() {}
|
||||
virtual void writeVports() {}
|
||||
virtual void writeHeader(DRW_Header& data) {}
|
||||
virtual void writeHeader( DRW_Header& aData ) {}
|
||||
virtual void writeEntities() {}
|
||||
virtual void writeLTypes() {}
|
||||
virtual void writeLayers() {}
|
||||
|
@ -172,7 +165,6 @@ private:
|
|||
|
||||
void writeLine();
|
||||
void writeMtext();
|
||||
|
||||
};
|
||||
|
||||
#endif // FILTERDXFRW_H
|
||||
|
|
|
@ -61,9 +61,6 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
|||
// Update display
|
||||
GetBoard()->SetVisibleLayers( LSET().set() );
|
||||
|
||||
// Set currently selected layer to be shown in high contrast mode, when enabled`
|
||||
SetHighContrastLayer( GetScreen()->m_Active_Layer );
|
||||
|
||||
ReFillLayerWidget();
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
|
|
@ -49,10 +49,12 @@ class wxSize;
|
|||
//class wxRealPoint;
|
||||
class wxString;
|
||||
|
||||
class BOARD;
|
||||
class MODULE;
|
||||
|
||||
// Often this is not used in the prototypes, since wxFrame is good enough and would
|
||||
// represent maximum information hiding.
|
||||
class PCB_EDIT_FRAME;
|
||||
class PCB_BASE_FRAME;
|
||||
class FP_LIB_TABLE;
|
||||
class BOARD;
|
||||
class PCB_PLOT_PARAMS;
|
||||
|
@ -81,13 +83,22 @@ void InvokePluginOptionsEditor( wxTopLevelWindow* aCaller, const wxString& aNick
|
|||
const wxString& aPluginType, const wxString& aOptions, wxString* aResult );
|
||||
|
||||
/**
|
||||
* Function InvokePcbLibTableEditor
|
||||
* shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables.
|
||||
* Function InvokeDXFDialogBoardImport
|
||||
* shows the modal DIALOG_DXF_IMPORT for importing a DXF file to a board.
|
||||
|
||||
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
|
||||
* @return true if the import was made.
|
||||
*/
|
||||
bool InvokeDXFDialogBoardImport( PCB_BASE_FRAME* aCaller );
|
||||
|
||||
/**
|
||||
* Function InvokeDXFDialogModuleImport
|
||||
* shows the modal DIALOG_DXF_IMPORT for importing a DXF file.to a module.
|
||||
*
|
||||
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
|
||||
* @return true if the ilport was made.
|
||||
* @return true if the import was made.
|
||||
*/
|
||||
bool InvokeDXFDialogImport( PCB_EDIT_FRAME* aCaller );
|
||||
bool InvokeDXFDialogModuleImport( PCB_BASE_FRAME* aCaller, MODULE* aModule );
|
||||
|
||||
/**
|
||||
* Function InvokeLayerSetup
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#define BUTT_SIZE_Y 18
|
||||
#define BUTT_VOID 4
|
||||
|
||||
const wxEventType LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE = wxNewEventType();
|
||||
|
||||
/* XPM
|
||||
* This bitmap is used for not selected layers
|
||||
*/
|
||||
|
@ -294,6 +296,10 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event )
|
|||
|
||||
// tell the client code.
|
||||
OnLayerColorChange( layer, newColor );
|
||||
|
||||
// notify others
|
||||
wxCommandEvent event( EVT_LAYER_COLOR_CHANGE );
|
||||
wxPostEvent( this, event );
|
||||
}
|
||||
|
||||
passOnFocus();
|
||||
|
@ -581,6 +587,15 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint
|
|||
}
|
||||
|
||||
|
||||
LAYER_WIDGET::~LAYER_WIDGET()
|
||||
{
|
||||
delete m_BlankBitmap;
|
||||
delete m_BlankAlternateBitmap;
|
||||
delete m_RightArrowBitmap;
|
||||
delete m_RightArrowAlternateBitmap;
|
||||
}
|
||||
|
||||
|
||||
wxSize LAYER_WIDGET::GetBestSize() const
|
||||
{
|
||||
// size of m_LayerScrolledWindow --------------
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static const wxEventType EVT_LAYER_COLOR_CHANGE;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -226,6 +227,8 @@ public:
|
|||
wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL );
|
||||
|
||||
virtual ~LAYER_WIDGET();
|
||||
|
||||
/**
|
||||
* Function GetBestSize
|
||||
* returns the preferred minimum size, taking into consideration the
|
||||
|
|
|
@ -274,6 +274,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
|
|||
PlaceModule( module, NULL );
|
||||
GetBoard()->m_Status_Pcb = 0;
|
||||
GetBoard()->BuildListOfNets();
|
||||
updateView();
|
||||
|
||||
return module;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <confirm.h>
|
||||
#include <eda_doc.h>
|
||||
#include <kicad_string.h>
|
||||
|
@ -55,6 +56,7 @@
|
|||
#include <dialog_get_component.h>
|
||||
#include <modview_frame.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <class_pcb_layer_widget.h>
|
||||
|
||||
|
||||
static void DisplayCmpDoc( wxString& Name );
|
||||
|
@ -105,6 +107,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
|||
|
||||
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||
PlaceModule( newModule, NULL );
|
||||
newModule->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
|
||||
|
||||
// Put it on FRONT layer,
|
||||
// because this is the default in ModEdit, and in libs
|
||||
|
@ -117,6 +120,9 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
|||
GetScreen()->ClrModify();
|
||||
Zoom_Automatique( false );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
updateView();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "&Export Module" ),
|
||||
_( "Save current loaded module into file" ),
|
||||
KiBitmap( export_module_xpm ) );
|
||||
|
||||
// Import DXF File
|
||||
AddMenuItem( fileMenu, ID_GEN_IMPORT_DXF_FILE,
|
||||
_( "&Import DXF File" ),
|
||||
_( "Import a 2D Drawing DXF file to Pcbnew on the Drawings layer" ),
|
||||
KiBitmap( import_xpm ) );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
|
||||
// Print
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <pgm_base.h>
|
||||
|
@ -38,17 +39,20 @@
|
|||
#include <kicad_device_context.h>
|
||||
#include <macros.h>
|
||||
#include <pcbcommon.h>
|
||||
#include <invoke_pcb_dialog.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_edge_mod.h>
|
||||
|
||||
#include <ratsnest_data.h>
|
||||
#include <pcbnew.h>
|
||||
#include <protos.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <module_editor_frame.h>
|
||||
#include <modview_frame.h>
|
||||
#include <collectors.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <dialog_edit_module_for_Modedit.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -56,6 +60,8 @@
|
|||
#include <footprint_wizard_frame.h>
|
||||
#include <pcbnew_config.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
// Functions defined in block_module_editor, but used here
|
||||
// These 2 functions are used in modedit to rotate or mirror the whole footprint
|
||||
|
@ -311,6 +317,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
Zoom_Automatique( false );
|
||||
}
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
updateView();
|
||||
|
||||
GetScreen()->ClrModify();
|
||||
}
|
||||
break;
|
||||
|
@ -449,15 +458,31 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||
pcbframe->PlaceModule( newmodule, NULL );
|
||||
newmodule->SetPosition( wxPoint( 0, 0 ) );
|
||||
pcbframe->SetCrossHairPosition( cursor_pos );
|
||||
newmodule->SetTimeStamp( GetNewTimeStamp() );
|
||||
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
KIGFX::VIEW* view = pcbframe->GetGalCanvas()->GetView();
|
||||
|
||||
newmodule->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
|
||||
view->Add( newmodule );
|
||||
}
|
||||
}
|
||||
|
||||
newmodule->ClearFlags();
|
||||
GetScreen()->ClrModify();
|
||||
pcbframe->SetCurItem( NULL );
|
||||
mainpcb->m_Status_Pcb = 0;
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
RN_DATA* ratsnest = pcbframe->GetBoard()->GetRatsnest();
|
||||
ratsnest->Update( newmodule );
|
||||
ratsnest->Recalculate();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -539,6 +564,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
m_Draw3DFrame->NewDisplay();
|
||||
|
||||
GetScreen()->ClrModify();
|
||||
updateView();
|
||||
|
||||
break;
|
||||
|
||||
|
@ -774,6 +800,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_GEN_IMPORT_DXF_FILE:
|
||||
InvokeDXFDialogModuleImport( this, GetBoard()->m_Modules );
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) );
|
||||
|
@ -914,3 +945,26 @@ EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const
|
|||
return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
|
||||
{
|
||||
PCB_BASE_FRAME::SetActiveLayer( aLayer );
|
||||
|
||||
GetGalCanvas()->SetHighContrastLayer( aLayer );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
SetBoard( m_Pcb );
|
||||
updateView();
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -418,41 +418,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
// Item found
|
||||
SetCurItem( item );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_PAD_T:
|
||||
InstallPadOptionsFrame( (D_PAD*) item );
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
break;
|
||||
|
||||
case PCB_MODULE_T:
|
||||
{
|
||||
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
|
||||
int ret = dialog.ShowModal();
|
||||
GetScreen()->GetCurItem()->ClearFlags();
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
|
||||
if( ret > 0 )
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T :
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) item );
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
OnEditItemRequest( DC, item );
|
||||
break; // end case 0
|
||||
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
|
@ -471,3 +437,41 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
|
||||
{
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case PCB_PAD_T:
|
||||
InstallPadOptionsFrame( (D_PAD*) aItem );
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
break;
|
||||
|
||||
case PCB_MODULE_T:
|
||||
{
|
||||
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) aItem );
|
||||
int ret = dialog.ShowModal();
|
||||
GetScreen()->GetCurItem()->ClearFlags();
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
|
||||
if( ret > 0 )
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, aDC );
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T :
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) aItem );
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
/* library editor: undo and redo functions */
|
||||
/********************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <wxPcbStruct.h>
|
||||
|
||||
#include <class_board.h>
|
||||
|
@ -50,23 +53,39 @@ void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLi
|
|||
UNDO_REDO_T aTypeCommand,
|
||||
const wxPoint& aTransformPoint )
|
||||
{
|
||||
// Currently unused in modedit, because the module itself is saved for each change
|
||||
wxMessageBox( wxT( "SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList..) not yet in use" ) );
|
||||
assert( aItemsList.GetPickedItem( 0 )->GetParent()->Type() == PCB_MODULE_T );
|
||||
MODULE* owner = static_cast<MODULE*>( aItemsList.GetPickedItem( 0 )->GetParent() );
|
||||
|
||||
#ifndef NDEBUG
|
||||
// All items should have the same parent (MODULE) to make undo/redo entry valid
|
||||
for( unsigned int i = 0; i < aItemsList.GetCount(); ++i )
|
||||
assert( aItemsList.GetPickedItem( i )->GetParent() == owner );
|
||||
#endif /* not NDEBUG */
|
||||
|
||||
SaveCopyInUndoList( owner, aTypeCommand, aTransformPoint );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
|
||||
void FOOTPRINT_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( GetScreen()->GetRedoCommandCount() <= 0 )
|
||||
return;
|
||||
|
||||
// Inform tools that undo command was issued
|
||||
TOOL_EVENT event( TC_MESSAGE, TA_UNDO_REDO, AS_GLOBAL );
|
||||
m_toolManager->ProcessEvent( event );
|
||||
|
||||
// Save current module state in undo list
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
MODULE* module = GetBoard()->m_Modules.PopFront();
|
||||
ITEM_PICKER wrapper( module, UR_MODEDIT );
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
lastcmd->PushItem( wrapper );
|
||||
GetScreen()->PushCommandToUndoList( lastcmd );
|
||||
|
||||
view->Remove( module );
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove, view, _1 ) );
|
||||
|
||||
// Retrieve last module state from undo list
|
||||
lastcmd = GetScreen()->PopCommandFromRedoList();
|
||||
wrapper = lastcmd->PopItem();
|
||||
|
@ -74,7 +93,12 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
|
|||
delete lastcmd;
|
||||
|
||||
if( module )
|
||||
{
|
||||
GetBoard()->Add( module );
|
||||
GetGalCanvas()->GetView()->Add( module );
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
|
||||
module->ViewUpdate();
|
||||
}
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
|
@ -83,18 +107,26 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
|
||||
void FOOTPRINT_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||
return;
|
||||
|
||||
// Inform tools that undo command was issued
|
||||
TOOL_EVENT event( TC_MESSAGE, TA_UNDO_REDO, AS_GLOBAL );
|
||||
m_toolManager->ProcessEvent( event );
|
||||
|
||||
// Save current module state in redo list
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
MODULE* module = GetBoard()->m_Modules.PopFront();
|
||||
ITEM_PICKER wrapper( module, UR_MODEDIT );
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
lastcmd->PushItem( wrapper );
|
||||
GetScreen()->PushCommandToRedoList( lastcmd );
|
||||
|
||||
view->Remove( module );
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove, view, _1 ) );
|
||||
|
||||
// Retrieve last module state from undo list
|
||||
lastcmd = GetScreen()->PopCommandFromUndoList();
|
||||
wrapper = lastcmd->PopItem();
|
||||
|
@ -102,8 +134,12 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
|
|||
delete lastcmd;
|
||||
|
||||
if( module )
|
||||
{
|
||||
GetBoard()->Add( module, ADD_APPEND );
|
||||
|
||||
view->Add( module );
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
|
||||
module->ViewUpdate();
|
||||
}
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define MODULE_EDITOR_FRAME_H_
|
||||
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <pcb_base_edit_frame.h>
|
||||
#include <io_mgr.h>
|
||||
|
||||
|
||||
|
@ -38,7 +39,7 @@ class FP_LIB_TABLE;
|
|||
namespace PCB { struct IFACE; } // A KIFACE_I coded in pcbnew.c
|
||||
|
||||
|
||||
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME
|
||||
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
|
||||
{
|
||||
friend struct PCB::IFACE;
|
||||
|
||||
|
@ -148,6 +149,9 @@ public:
|
|||
void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent );
|
||||
|
||||
///> @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
|
||||
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
|
||||
|
||||
/**
|
||||
* Function LoadModuleFromBoard
|
||||
* called from the main toolbar to load a footprint from board mainly to edit it.
|
||||
|
@ -217,7 +221,6 @@ public:
|
|||
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
|
||||
|
||||
/* Undo and redo functions */
|
||||
public:
|
||||
|
||||
/**
|
||||
* Function SaveCopyInUndoList.
|
||||
|
@ -245,6 +248,22 @@ public:
|
|||
UNDO_REDO_T aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
||||
|
||||
/**
|
||||
* Function RestoreCopyFromUndoList
|
||||
* performs an undo operation on the last edition:
|
||||
* - Place the current edited library component in Redo list
|
||||
* - Get old version of the current edited library component
|
||||
*/
|
||||
void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function RestoreCopyFromRedoList
|
||||
* performs a redo operation on the the last edition:
|
||||
* - Place the current edited library component in undo list
|
||||
* - Get old version of the current edited library component
|
||||
*/
|
||||
void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
|
||||
|
||||
/// Return the current library nickname.
|
||||
const wxString GetCurrentLib() const;
|
||||
|
||||
|
@ -399,6 +418,12 @@ public:
|
|||
|
||||
virtual EDA_COLOR_T GetGridColor() const;
|
||||
|
||||
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
|
||||
void SetActiveLayer( LAYER_ID aLayer );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
|
@ -406,22 +431,7 @@ protected:
|
|||
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
|
||||
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
|
||||
/**
|
||||
* Function GetComponentFromUndoList
|
||||
* performs an undo operation on the last edition:
|
||||
* - Place the current edited library component in Redo list
|
||||
* - Get old version of the current edited library component
|
||||
*/
|
||||
void GetComponentFromUndoList( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function GetComponentFromRedoList
|
||||
* performs a redo operation on the the last edition:
|
||||
* - Place the current edited library component in undo list
|
||||
* - Get old version of the current edited library component
|
||||
*/
|
||||
void GetComponentFromRedoList( wxCommandEvent& event );
|
||||
PCB_LAYER_WIDGET* m_Layers;
|
||||
|
||||
/**
|
||||
* Function UpdateTitle
|
||||
|
@ -429,6 +439,9 @@ protected:
|
|||
*/
|
||||
void updateTitle();
|
||||
|
||||
/// Reloads displayed items and sets view.
|
||||
void updateView();
|
||||
|
||||
/// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
|
||||
const wxString getLibPath();
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <project.h>
|
||||
#include <kicad_plugin.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <confirm.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
@ -51,6 +52,18 @@
|
|||
#include <hotkeys.h>
|
||||
#include <module_editor_frame.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <class_pcb_layer_widget.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include "tools/selection_tool.h"
|
||||
#include "tools/edit_tool.h"
|
||||
#include "tools/drawing_tool.h"
|
||||
#include "tools/point_editor.h"
|
||||
#include "tools/pcbnew_control.h"
|
||||
#include "tools/module_tools.h"
|
||||
#include "tools/placement_tool.h"
|
||||
#include "tools/common_actions.h"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
|
@ -80,6 +93,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
|
||||
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SHEET_SET, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_GEN_IMPORT_DXF_FILE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_PRINT, FOOTPRINT_EDIT_FRAME::ToPrinter )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_CHECK, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
|
@ -88,8 +102,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_UNDO, FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList )
|
||||
EVT_TOOL( wxID_REDO, FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList )
|
||||
EVT_TOOL( wxID_UNDO, FOOTPRINT_EDIT_FRAME::RestoreCopyFromUndoList )
|
||||
EVT_TOOL( wxID_REDO, FOOTPRINT_EDIT_FRAME::RestoreCopyFromRedoList )
|
||||
|
||||
// Vertical tool bar button click event handler.
|
||||
EVT_TOOL( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
|
||||
|
@ -149,7 +163,7 @@ END_EVENT_TABLE()
|
|||
#define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
|
||||
|
||||
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
|
||||
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
|
||||
{
|
||||
|
@ -167,6 +181,12 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// Show a title (frame title + footprint name):
|
||||
updateTitle();
|
||||
|
||||
// Create GAL canvas
|
||||
PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
parentFrame->GetGalCanvas()->GetBackend() );
|
||||
SetGalCanvas( drawPanel );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// restore the last footprint from the project, if any
|
||||
|
@ -175,6 +195,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// Ensure all layers and items are visible:
|
||||
GetBoard()->SetVisibleAlls();
|
||||
|
||||
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize() );
|
||||
|
||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
|
@ -208,6 +231,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
EDA_PANEINFO mesg_pane;
|
||||
mesg_pane.MessageToolbarPane();
|
||||
|
||||
// Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
|
||||
// LAYER_WIDGET is floatable, but initially docked at far right
|
||||
EDA_PANEINFO lyrs;
|
||||
lyrs.LayersToolbarPane();
|
||||
lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
|
||||
lyrs.BestSize( m_Layers->GetBestSize() );
|
||||
lyrs.Caption( _( "Visibles" ) );
|
||||
|
||||
m_auimgr.AddPane( m_mainToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) );
|
||||
|
||||
|
@ -218,16 +249,54 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_auimgr.AddPane( m_drawToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer(1) );
|
||||
|
||||
// Add the layer manager ( most right side of pcbframe )
|
||||
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) );
|
||||
// Layers manager is visible and served only in GAL canvas mode.
|
||||
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( parentFrame->IsGalCanvasActive() );
|
||||
|
||||
// The left vertical toolbar (fast acces to display options)
|
||||
m_auimgr.AddPane( m_optionsToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ). Left().Layer(1) );
|
||||
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
|
||||
|
||||
m_auimgr.AddPane( m_messagePanel,
|
||||
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
|
||||
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
|
||||
drawPanel->GetViewControls(), this );
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
||||
|
||||
if( parentFrame->IsGalCanvasActive() )
|
||||
{
|
||||
drawPanel->SetEventDispatcher( m_toolDispatcher );
|
||||
|
||||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||
m_toolManager->RegisterTool( new EDIT_TOOL );
|
||||
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
||||
m_toolManager->RegisterTool( new POINT_EDITOR );
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->RegisterTool( new MODULE_TOOLS );
|
||||
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
||||
|
||||
m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<EDIT_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true );
|
||||
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
|
||||
UseGalCanvas( true );
|
||||
}
|
||||
|
||||
m_Layers->ReFill();
|
||||
m_Layers->ReFillRender();
|
||||
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
||||
|
@ -236,6 +305,8 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
|
|||
{
|
||||
// save the footprint in the PROJECT
|
||||
retainLastFootprint();
|
||||
|
||||
delete m_Layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -620,3 +691,11 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
|
|||
|
||||
SetTitle( title );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::updateView()
|
||||
{
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
|
||||
m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <kiway.h>
|
||||
#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <3d_viewer.h>
|
||||
#include <pcbcommon.h>
|
||||
|
@ -54,6 +55,13 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <pcbnew_config.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include "tools/pcbnew_control.h"
|
||||
#include "tools/common_actions.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
#define NEXT_PART 1
|
||||
#define NEW_PART 0
|
||||
|
@ -160,6 +168,23 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
ReCreateLibraryList();
|
||||
UpdateTitle();
|
||||
|
||||
PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
|
||||
|
||||
// Create GAL canvas
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
parentFrame->GetGalCanvas()->GetBackend() );
|
||||
SetGalCanvas( drawPanel );
|
||||
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
|
||||
drawPanel->GetViewControls(), this );
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
||||
drawPanel->SetEventDispatcher( m_toolDispatcher );
|
||||
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
|
||||
// If a footprint was previously loaded, reload it
|
||||
if( getCurNickname().size() && getCurFootprintName().size() )
|
||||
{
|
||||
|
@ -170,6 +195,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
GetBoard()->Add( loadFootprint( id ) );
|
||||
}
|
||||
|
||||
drawPanel->DisplayBoard( m_Pcb );
|
||||
updateView();
|
||||
|
||||
if( m_canvas )
|
||||
m_canvas->SetAcceleratorTable( table );
|
||||
|
||||
|
@ -207,6 +235,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
// Manage the draw panel, right pane.
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
|
||||
|
||||
// Manage the message panel, bottom pane.
|
||||
m_auimgr.AddPane( m_messagePanel,
|
||||
|
@ -244,6 +274,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
#endif
|
||||
|
||||
Show( true );
|
||||
|
||||
UseGalCanvas( parentFrame->IsGalCanvasActive() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,6 +295,10 @@ const wxChar* FOOTPRINT_VIEWER_FRAME::GetFootprintViewerFrameName()
|
|||
void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
DBG(printf( "%s:\n", __func__ );)
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
if( IsModal() )
|
||||
{
|
||||
// Only dismiss a modal frame once, so that the return values set by
|
||||
|
@ -324,6 +360,15 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
if( aEnable )
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
|
||||
{
|
||||
m_footprintList->Clear();
|
||||
|
@ -421,6 +466,10 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
updateView();
|
||||
|
||||
Zoom_Automatique( false );
|
||||
m_canvas->Refresh();
|
||||
Update3D_Frame();
|
||||
|
@ -802,8 +851,12 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
|
|||
GetBoard()->Add( footprint, ADD_APPEND );
|
||||
|
||||
Update3D_Frame();
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
updateView();
|
||||
}
|
||||
|
||||
|
||||
UpdateTitle();
|
||||
Zoom_Automatique( false );
|
||||
m_canvas->Refresh();
|
||||
|
@ -827,3 +880,28 @@ void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
if( module )
|
||||
SetMsgPanel( module );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::updateView()
|
||||
{
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
|
||||
|
||||
m_Pcb->ComputeBoundingBox( false );
|
||||
EDA_RECT boardBbox = m_Pcb->GetBoundingBox();
|
||||
BOX2D bbox;
|
||||
|
||||
// Autozoom
|
||||
if( boardBbox.GetSize().x > 0 && boardBbox.GetSize().y > 0 )
|
||||
{
|
||||
bbox.SetOrigin( VECTOR2D( boardBbox.GetOrigin() ) );
|
||||
bbox.SetSize( VECTOR2D( boardBbox.GetSize() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default empty view
|
||||
bbox.SetOrigin( VECTOR2D( -1000, -1000 ) );
|
||||
bbox.SetSize( VECTOR2D( 2000, 2000 ) );
|
||||
}
|
||||
|
||||
GetGalCanvas()->GetView()->SetViewport( bbox );
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
*/
|
||||
void ReCreateLibraryList();
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -170,6 +172,8 @@ private:
|
|||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) {}
|
||||
|
||||
void updateView();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pcb_base_edit_frame.h>
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||
{
|
||||
wxCHECK2_MSG( aRotationAngle > 0 && aRotationAngle <= 900, aRotationAngle = 900,
|
||||
wxT( "Invalid rotation angle, defaulting to 90." ) );
|
||||
|
||||
m_rotationAngle = aRotationAngle;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef BASE_EDIT_FRAME_H
|
||||
#define BASE_EDIT_FRAME_H
|
||||
|
||||
#include <wxBasePcbFrame.h>
|
||||
|
||||
/**
|
||||
* Common, abstract interface for edit frames.
|
||||
*/
|
||||
class PCB_BASE_EDIT_FRAME : public PCB_BASE_FRAME
|
||||
{
|
||||
public:
|
||||
PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
m_rotationAngle( 900 )
|
||||
{}
|
||||
|
||||
virtual ~PCB_BASE_EDIT_FRAME() {};
|
||||
|
||||
/**
|
||||
* Function OnEditItemRequest
|
||||
* Install the corresponding dialog editor for the given item
|
||||
* @param aDC = the current device context
|
||||
* @param aItem = a pointer to the BOARD_ITEM to edit
|
||||
*/
|
||||
virtual void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) = 0;
|
||||
|
||||
/**
|
||||
* Function RestoreCopyFromRedoList
|
||||
* Redo the last edition:
|
||||
* - Save the current data in Undo list
|
||||
* - Get an old version of the data from Redo list
|
||||
*/
|
||||
virtual void RestoreCopyFromRedoList( wxCommandEvent& aEvent ) = 0;
|
||||
|
||||
/**
|
||||
* Function RestoreCopyFromUndoList
|
||||
* Undo the last edition:
|
||||
* - Save the current board in Redo list
|
||||
* - Get an old version of the data from Undo list
|
||||
*/
|
||||
virtual void RestoreCopyFromUndoList( wxCommandEvent& aEvent ) = 0;
|
||||
|
||||
int GetRotationAngle() const { return m_rotationAngle; }
|
||||
void SetRotationAngle( int aRotationAngle );
|
||||
|
||||
protected:
|
||||
/// User defined rotation angle (in tenths of a degree).
|
||||
int m_rotationAngle;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,347 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "pcb_draw_panel_gal.h"
|
||||
#include <view/view.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
|
||||
#include <class_colors_design_settings.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <pcbcommon.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
const LAYER_NUM GAL_LAYER_ORDER[] =
|
||||
{
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ),
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE ),
|
||||
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
|
||||
|
||||
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
||||
|
||||
ITEM_GAL_LAYER( RATSNEST_VISIBLE ), ITEM_GAL_LAYER( ANCHOR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
|
||||
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
|
||||
NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
|
||||
F_SilkS, F_Paste, F_Adhes,
|
||||
|
||||
#if 0 // was:
|
||||
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
|
||||
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
|
||||
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
|
||||
NETNAMES_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
|
||||
NETNAMES_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
|
||||
NETNAMES_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
|
||||
NETNAMES_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
|
||||
NETNAMES_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
|
||||
NETNAMES_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
|
||||
NETNAMES_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
|
||||
NETNAMES_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
|
||||
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
|
||||
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
|
||||
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
|
||||
#else
|
||||
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
|
||||
NETNAMES_GAL_LAYER( In2_Cu ), In2_Cu,
|
||||
NETNAMES_GAL_LAYER( In3_Cu ), In3_Cu,
|
||||
NETNAMES_GAL_LAYER( In4_Cu ), In4_Cu,
|
||||
NETNAMES_GAL_LAYER( In5_Cu ), In5_Cu,
|
||||
NETNAMES_GAL_LAYER( In6_Cu ), In6_Cu,
|
||||
NETNAMES_GAL_LAYER( In7_Cu ), In7_Cu,
|
||||
NETNAMES_GAL_LAYER( In8_Cu ), In8_Cu,
|
||||
NETNAMES_GAL_LAYER( In9_Cu ), In9_Cu,
|
||||
NETNAMES_GAL_LAYER( In10_Cu ), In10_Cu,
|
||||
NETNAMES_GAL_LAYER( In11_Cu ), In11_Cu,
|
||||
NETNAMES_GAL_LAYER( In12_Cu ), In12_Cu,
|
||||
NETNAMES_GAL_LAYER( In13_Cu ), In13_Cu,
|
||||
NETNAMES_GAL_LAYER( In14_Cu ), In14_Cu,
|
||||
NETNAMES_GAL_LAYER( In15_Cu ), In15_Cu,
|
||||
NETNAMES_GAL_LAYER( In16_Cu ), In16_Cu,
|
||||
NETNAMES_GAL_LAYER( In17_Cu ), In17_Cu,
|
||||
NETNAMES_GAL_LAYER( In18_Cu ), In18_Cu,
|
||||
NETNAMES_GAL_LAYER( In19_Cu ), In19_Cu,
|
||||
NETNAMES_GAL_LAYER( In20_Cu ), In20_Cu,
|
||||
NETNAMES_GAL_LAYER( In21_Cu ), In21_Cu,
|
||||
NETNAMES_GAL_LAYER( In22_Cu ), In22_Cu,
|
||||
NETNAMES_GAL_LAYER( In23_Cu ), In23_Cu,
|
||||
NETNAMES_GAL_LAYER( In24_Cu ), In24_Cu,
|
||||
NETNAMES_GAL_LAYER( In25_Cu ), In25_Cu,
|
||||
NETNAMES_GAL_LAYER( In26_Cu ), In26_Cu,
|
||||
NETNAMES_GAL_LAYER( In27_Cu ), In27_Cu,
|
||||
NETNAMES_GAL_LAYER( In28_Cu ), In28_Cu,
|
||||
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
|
||||
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
|
||||
#endif
|
||||
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), B_Mask,
|
||||
NETNAMES_GAL_LAYER( B_Cu ), B_Cu,
|
||||
|
||||
B_Adhes, B_Paste, B_SilkS,
|
||||
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
|
||||
ITEM_GAL_LAYER( WORKSHEET )
|
||||
};
|
||||
|
||||
|
||||
PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId,
|
||||
const wxPoint& aPosition, const wxSize& aSize,
|
||||
GalType aGalType ) :
|
||||
EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
|
||||
{
|
||||
m_worksheet = NULL;
|
||||
m_ratsnest = NULL;
|
||||
|
||||
// Set rendering order and properties of layers
|
||||
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
|
||||
{
|
||||
LAYER_NUM layer = GAL_LAYER_ORDER[i];
|
||||
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
|
||||
|
||||
m_view->SetLayerOrder( layer, i );
|
||||
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// Copper layers are required for netname layers
|
||||
m_view->SetRequired( GetNetnameLayer( layer ), layer );
|
||||
m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
|
||||
}
|
||||
else if( IsNetnameLayer( layer ) )
|
||||
{
|
||||
// Netnames are drawn only when scale is sufficient (level of details)
|
||||
// so there is no point in caching them
|
||||
m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
}
|
||||
|
||||
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
|
||||
|
||||
// Some more required layers settings
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
m_view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
|
||||
m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
|
||||
m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
|
||||
|
||||
m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
||||
m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
|
||||
|
||||
// Load display options (such as filled/outline display of items)
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( DisplayOpt );
|
||||
}
|
||||
|
||||
|
||||
PCB_DRAW_PANEL_GAL::~PCB_DRAW_PANEL_GAL()
|
||||
{
|
||||
delete m_worksheet;
|
||||
delete m_ratsnest;
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
|
||||
{
|
||||
m_view->Clear();
|
||||
|
||||
// Load zones
|
||||
for( int i = 0; i < aBoard->GetAreaCount(); ++i )
|
||||
m_view->Add( (KIGFX::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
|
||||
|
||||
// Load drawings
|
||||
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
|
||||
m_view->Add( drawing );
|
||||
|
||||
// Load tracks
|
||||
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
|
||||
m_view->Add( track );
|
||||
|
||||
// Load modules and its additional elements
|
||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, m_view, _1 ) );
|
||||
m_view->Add( module );
|
||||
}
|
||||
|
||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
||||
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
|
||||
m_view->Add( zone );
|
||||
|
||||
// Ratsnest
|
||||
if( m_ratsnest )
|
||||
{
|
||||
m_view->Remove( m_ratsnest );
|
||||
delete m_ratsnest;
|
||||
}
|
||||
|
||||
m_ratsnest = new KIGFX::RATSNEST_VIEWITEM( aBoard->GetRatsnest() );
|
||||
m_view->Add( m_ratsnest );
|
||||
|
||||
UseColorScheme( aBoard->GetColorsSettings() );
|
||||
|
||||
m_view->RecacheAllItems( true );
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet )
|
||||
{
|
||||
if( m_worksheet )
|
||||
{
|
||||
m_view->Remove( m_worksheet );
|
||||
delete m_worksheet;
|
||||
}
|
||||
|
||||
m_worksheet = aWorksheet;
|
||||
m_view->Add( m_worksheet );
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings )
|
||||
{
|
||||
KIGFX::PCB_RENDER_SETTINGS* rs;
|
||||
rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
|
||||
rs->ImportLegacyColors( aSettings );
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::RENDER_SETTINGS* rSettings = m_view->GetPainter()->GetSettings();
|
||||
|
||||
SetTopLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
|
||||
rSettings->SetActiveLayer( layers[i] );
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_view->UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
|
||||
{
|
||||
m_view->ClearTopLayers();
|
||||
m_view->SetTopLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), Dwgs_User,
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
|
||||
{
|
||||
m_view->SetTopLayer( layers[i] );
|
||||
}
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
m_view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
m_view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_view->UpdateAllLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
|
||||
{
|
||||
// Load layer & elements visibility settings
|
||||
for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i )
|
||||
{
|
||||
m_view->SetLayerVisible( i, aBoard->IsLayerVisible( LAYER_ID( i ) ) );
|
||||
|
||||
// Synchronize netname layers as well
|
||||
if( IsCopperLayer( i ) )
|
||||
m_view->SetLayerVisible( GetNetnameLayer( i ), aBoard->IsLayerVisible( LAYER_ID( i ) ) );
|
||||
}
|
||||
|
||||
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
|
||||
{
|
||||
m_view->SetLayerVisible( ITEM_GAL_LAYER( i ), aBoard->IsElementVisible( i ) );
|
||||
}
|
||||
|
||||
// Enable some layers that are GAL specific
|
||||
m_view->SetLayerVisible( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), true );
|
||||
m_view->SetLayerVisible( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), true );
|
||||
m_view->SetLayerVisible( ITEM_GAL_LAYER( WORKSHEET ), true );
|
||||
m_view->SetLayerVisible( ITEM_GAL_LAYER( GP_OVERLAY ), true );
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef PCB_DRAW_PANEL_GAL_H_
|
||||
#define PCB_DRAW_PANEL_GAL_H_
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
class WORKSHEET_VIEWITEM;
|
||||
class RATSNEST_VIEWITEM;
|
||||
}
|
||||
class COLORS_DESIGN_SETTINGS;
|
||||
|
||||
class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
|
||||
{
|
||||
public:
|
||||
PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
|
||||
const wxSize& aSize, GalType aGalType = GAL_TYPE_OPENGL );
|
||||
|
||||
virtual ~PCB_DRAW_PANEL_GAL();
|
||||
|
||||
/**
|
||||
* Function DisplayBoard
|
||||
* adds all items from the current board to the VIEW, so they can be displayed by GAL.
|
||||
* @param aBoard is the PCB to be loaded.
|
||||
*/
|
||||
void DisplayBoard( const BOARD* aBoard );
|
||||
|
||||
/**
|
||||
* Function SetWorksheet
|
||||
* Sets (or updates) worksheet used by the draw panel.
|
||||
* @param aWorksheet is the worksheet to be used.
|
||||
* The object is then owned by PCB_DRAW_PANEL_GAL.
|
||||
*/
|
||||
void SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet );
|
||||
|
||||
/**
|
||||
* Function UseColorScheme
|
||||
* Applies layer color settings.
|
||||
* @param aSettings are the new settings.
|
||||
*/
|
||||
void UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings );
|
||||
|
||||
///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer()
|
||||
virtual void SetHighContrastLayer( LAYER_ID aLayer );
|
||||
|
||||
///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
|
||||
virtual void SetTopLayer( LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* Function SyncLayersVisibility
|
||||
* Updates "visibility" property of each layer of a given BOARD.
|
||||
* @param aBoard contains layers visibility settings to be applied.
|
||||
*/
|
||||
void SyncLayersVisibility( const BOARD* aBoard );
|
||||
|
||||
protected:
|
||||
///> Currently used worksheet
|
||||
KIGFX::WORKSHEET_VIEWITEM* m_worksheet;
|
||||
|
||||
///> Ratsnest view item
|
||||
KIGFX::RATSNEST_VIEWITEM* m_ratsnest;
|
||||
};
|
||||
|
||||
#endif /* PCB_DRAW_PANEL_GAL_H_ */
|
|
@ -50,7 +50,7 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
|
|||
m_displayZoneMode = DZ_SHOW_FILLED;
|
||||
|
||||
// By default everything should be displayed as filled
|
||||
for( unsigned int i = 0; i < END_PCB_VISIBLE_LIST; ++i )
|
||||
for( unsigned int i = 0; i < TOTAL_LAYER_COUNT; ++i )
|
||||
{
|
||||
m_sketchMode[i] = false;
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet
|
|||
m_layerColors[NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||
m_layerColors[NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||
m_layerColors[NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||
m_layerColors[ITEM_GAL_LAYER( ANCHOR_VISIBLE )] = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
|
||||
m_layerColors[ITEM_GAL_LAYER( RATSNEST_VISIBLE )] = COLOR4D( 0.4, 0.4, 0.4, 0.8 );
|
||||
m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
|
||||
m_layerColors[ITEM_GAL_LAYER( DRC_VISIBLE )] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
|
||||
|
@ -101,9 +102,9 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS& aOptions )
|
|||
m_padNumbers = aOptions.DisplayPadNum;
|
||||
|
||||
// Whether to draw tracks, vias & pads filled or as outlines
|
||||
m_sketchMode[PADS_VISIBLE] = !aOptions.DisplayPadFill;
|
||||
m_sketchMode[VIA_THROUGH_VISIBLE] = !aOptions.DisplayViaFill;
|
||||
m_sketchMode[TRACKS_VISIBLE] = !aOptions.DisplayPcbTrackFill;
|
||||
m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] = !aOptions.DisplayPadFill;
|
||||
m_sketchMode[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] = !aOptions.DisplayViaFill;
|
||||
m_sketchMode[ITEM_GAL_LAYER( TRACKS_VISIBLE )] = !aOptions.DisplayPcbTrackFill;
|
||||
|
||||
switch( aOptions.DisplayNetNamesMode )
|
||||
{
|
||||
|
@ -222,7 +223,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
|
||||
case PCB_LINE_T:
|
||||
case PCB_MODULE_EDGE_T:
|
||||
draw( (DRAWSEGMENT*) item );
|
||||
draw( (DRAWSEGMENT*) item, aLayer );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
|
@ -233,6 +234,10 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
draw( (TEXTE_MODULE*) item, aLayer );
|
||||
break;
|
||||
|
||||
case PCB_MODULE_T:
|
||||
draw( (MODULE*) item );
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
draw( (ZONE_CONTAINER*) item );
|
||||
break;
|
||||
|
@ -284,7 +289,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
|
|||
|
||||
// Set a proper color for the label
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aTrack, aTrack->GetLayer() );
|
||||
COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
|
||||
const COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
|
||||
|
||||
if( color.GetBrightness() > 0.5 )
|
||||
m_gal->SetStrokeColor( labelColor.Inverted() );
|
||||
|
@ -308,7 +313,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
|
|||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetIsStroke( true );
|
||||
|
||||
if( m_pcbSettings.m_sketchMode[TRACKS_VISIBLE] )
|
||||
if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( TRACKS_VISIBLE )] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
|
@ -320,6 +325,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
|
|||
m_gal->SetFillColor( color );
|
||||
m_gal->SetIsFill( true );
|
||||
}
|
||||
|
||||
m_gal->DrawSegment( start, end, width );
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +350,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
|
|||
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aVia, aLayer );
|
||||
|
||||
if( m_pcbSettings.m_sketchMode[VIA_THROUGH_VISIBLE] )
|
||||
if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->SetIsFill( false );
|
||||
|
@ -421,7 +427,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
|
||||
// Set a proper color for the label
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aPad, aPad->GetLayer() );
|
||||
COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
|
||||
const COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
|
||||
|
||||
if( color.GetBrightness() > 0.5 )
|
||||
m_gal->SetStrokeColor( labelColor.Inverted() );
|
||||
|
@ -475,7 +481,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
|
||||
// Pad drawing
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aPad, aLayer );
|
||||
if( m_pcbSettings.m_sketchMode[PADS_VISIBLE] )
|
||||
if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->SetIsFill( false );
|
||||
|
@ -538,7 +544,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
m = ( size.y - size.x );
|
||||
n = size.x;
|
||||
|
||||
if( m_pcbSettings.m_sketchMode[PADS_VISIBLE] )
|
||||
if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->DrawArc( VECTOR2D( 0, -m ), n, -M_PI, 0 );
|
||||
|
@ -559,7 +565,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
m = ( size.x - size.y );
|
||||
n = size.y;
|
||||
|
||||
if( m_pcbSettings.m_sketchMode[PADS_VISIBLE] )
|
||||
if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->DrawArc( VECTOR2D( -m, 0 ), n, M_PI / 2, 3 * M_PI / 2 );
|
||||
|
@ -617,14 +623,24 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
}
|
||||
|
||||
|
||||
void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment )
|
||||
void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
|
||||
{
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aSegment, aSegment->GetLayer() );
|
||||
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
||||
if( m_pcbSettings.m_sketchMode[aLayer] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filled mode
|
||||
m_gal->SetLineWidth( aSegment->GetWidth() );
|
||||
}
|
||||
|
||||
switch( aSegment->GetShape() )
|
||||
{
|
||||
|
@ -699,12 +715,24 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
|
|||
if( aText->GetText().Length() == 0 )
|
||||
return;
|
||||
|
||||
const COLOR4D& strokeColor = m_pcbSettings.GetColor( aText, aText->GetLayer() );
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aText, aText->GetLayer() );
|
||||
VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y );
|
||||
double orientation = aText->GetOrientation() * M_PI / 1800.0;
|
||||
|
||||
m_gal->SetStrokeColor( strokeColor );
|
||||
if( m_pcbSettings.m_sketchMode[aLayer] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filled mode
|
||||
m_gal->SetLineWidth( aText->GetThickness() );
|
||||
}
|
||||
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetTextAttributes( aText );
|
||||
m_gal->StrokeText( aText->GetText(), position, orientation );
|
||||
}
|
||||
|
@ -715,17 +743,46 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
|
|||
if( aText->GetLength() == 0 )
|
||||
return;
|
||||
|
||||
const COLOR4D& strokeColor = m_pcbSettings.GetColor( aText, aLayer );
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer );
|
||||
VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y );
|
||||
double orientation = aText->GetDrawRotation() * M_PI / 1800.0;
|
||||
|
||||
m_gal->SetStrokeColor( strokeColor );
|
||||
if( m_pcbSettings.m_sketchMode[aLayer] )
|
||||
{
|
||||
// Outline mode
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filled mode
|
||||
m_gal->SetLineWidth( aText->GetThickness() );
|
||||
}
|
||||
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetTextAttributes( aText );
|
||||
m_gal->StrokeText( aText->GetText(), position, orientation );
|
||||
}
|
||||
|
||||
|
||||
void PCB_PAINTER::draw( const MODULE* aModule )
|
||||
{
|
||||
const COLOR4D color = m_pcbSettings.GetColor( aModule, ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
|
||||
|
||||
// Draw anchor
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetLineWidth( 1.0 );
|
||||
|
||||
// Keep the size constant, not related to the scale
|
||||
double anchorSize = 5.0 / m_gal->GetWorldScale();
|
||||
|
||||
VECTOR2D center = aModule->GetPosition();
|
||||
m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
|
||||
m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
|
||||
}
|
||||
|
||||
|
||||
void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
|
||||
{
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aZone, aZone->GetLayer() );
|
||||
|
|
|
@ -124,9 +124,6 @@ public:
|
|||
*/
|
||||
inline void SetSketchMode( int aItemLayer, bool aEnabled )
|
||||
{
|
||||
// It is supposed to work only with item layers
|
||||
assert( aItemLayer >= ITEM_GAL_LAYER( 0 ) );
|
||||
|
||||
m_sketchMode[aItemLayer] = aEnabled;
|
||||
}
|
||||
|
||||
|
@ -137,9 +134,6 @@ public:
|
|||
*/
|
||||
inline bool GetSketchMode( int aItemLayer ) const
|
||||
{
|
||||
// It is supposed to work only with item layers
|
||||
assert( aItemLayer >= ITEM_GAL_LAYER( 0 ) );
|
||||
|
||||
return m_sketchMode[aItemLayer];
|
||||
}
|
||||
|
||||
|
@ -210,9 +204,10 @@ protected:
|
|||
void draw( const TRACK* aTrack, int aLayer );
|
||||
void draw( const VIA* aVia, int aLayer );
|
||||
void draw( const D_PAD* aPad, int aLayer );
|
||||
void draw( const DRAWSEGMENT* aSegment );
|
||||
void draw( const DRAWSEGMENT* aSegment, int aLayer );
|
||||
void draw( const TEXTE_PCB* aText, int aLayer );
|
||||
void draw( const TEXTE_MODULE* aText, int aLayer );
|
||||
void draw( const MODULE* aModule );
|
||||
void draw( const ZONE_CONTAINER* aZone );
|
||||
void draw( const DIMENSION* aDimension, int aLayer );
|
||||
void draw( const PCB_TARGET* aTarget );
|
||||
|
|
|
@ -1856,7 +1856,7 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR
|
|||
|
||||
RotatePoint( &pt, module->GetOrientation() );
|
||||
pad->SetPosition( pt + module->GetPosition() );
|
||||
module->AddPad( pad );
|
||||
module->Add( pad );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -70,13 +70,24 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
|
||||
#include <tools/selection_tool.h>
|
||||
#include <router/router_tool.h>
|
||||
#include <tools/edit_tool.h>
|
||||
#include <tools/drawing_tool.h>
|
||||
#include <tools/point_editor.h>
|
||||
#include <tools/pcbnew_control.h>
|
||||
#include <tools/pcb_editor_control.h>
|
||||
#include <tools/placement_tool.h>
|
||||
#include <tools/common_actions.h>
|
||||
|
||||
|
||||
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
|
||||
#include <python_scripting.h>
|
||||
// The name of the pane info handling the python console:
|
||||
#define PYTHONCONSOLE_STRID wxT( "PythonPanel" )
|
||||
#endif
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
// Keys used in read/write config
|
||||
|
@ -187,8 +198,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_TOOL( wxID_CUT, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_COPY, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_PASTE, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_UNDO, PCB_EDIT_FRAME::GetBoardFromUndoList )
|
||||
EVT_TOOL( wxID_REDO, PCB_EDIT_FRAME::GetBoardFromRedoList )
|
||||
EVT_TOOL( wxID_UNDO, PCB_EDIT_FRAME::RestoreCopyFromUndoList )
|
||||
EVT_TOOL( wxID_REDO, PCB_EDIT_FRAME::RestoreCopyFromRedoList )
|
||||
EVT_TOOL( wxID_PRINT, PCB_EDIT_FRAME::ToPrinter )
|
||||
EVT_TOOL( ID_GEN_PLOT_SVG, PCB_EDIT_FRAME::SVG_Print )
|
||||
EVT_TOOL( ID_GEN_PLOT, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
@ -294,6 +305,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle )
|
||||
EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
||||
PCB_EDIT_FRAME::OnUpdateMuWaveToolbar )
|
||||
|
||||
EVT_COMMAND( wxID_ANY, LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE, PCB_EDIT_FRAME::OnLayerColorChange )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -302,7 +315,7 @@ END_EVENT_TABLE()
|
|||
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
|
||||
|
||||
PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition,
|
||||
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition,
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PCB_EDIT_FRAME_NAME )
|
||||
{
|
||||
m_FrameName = PCB_EDIT_FRAME_NAME;
|
||||
|
@ -330,6 +343,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
for ( int i = 0; i < 10; i++ )
|
||||
m_Macros[i].m_Record.clear();
|
||||
|
||||
// Create GAL canvas
|
||||
SetGalCanvas( new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
PCB_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// Create the PCB_LAYER_WIDGET *after* SetBoard():
|
||||
|
@ -404,7 +421,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
lyrs.BestSize( m_Layers->GetBestSize() );
|
||||
lyrs.Caption( _( "Visibles" ) );
|
||||
|
||||
|
||||
if( m_mainToolBar ) // The main horizontal toolbar
|
||||
{
|
||||
m_auimgr.AddPane( m_mainToolBar,
|
||||
|
@ -464,7 +480,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
||||
{
|
||||
destroyTools();
|
||||
m_RecordingMacros = -1;
|
||||
|
||||
for( int i = 0; i < 10; i++ )
|
||||
|
@ -480,48 +495,15 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
ViewReloadBoard( aBoard );
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
drawPanel->DisplayBoard( aBoard );
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
||||
{
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
view->Clear();
|
||||
|
||||
// All of PCB drawing elements should be added to the VIEW
|
||||
// in order to be displayed
|
||||
|
||||
// Load zones
|
||||
for( int i = 0; i < aBoard->GetAreaCount(); ++i )
|
||||
view->Add( (KIGFX::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
|
||||
|
||||
// Load drawings
|
||||
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
|
||||
view->Add( drawing );
|
||||
|
||||
// Load tracks
|
||||
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
|
||||
view->Add( track );
|
||||
|
||||
// Load modules and its additional elements
|
||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
|
||||
view->Add( module );
|
||||
}
|
||||
|
||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
||||
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
|
||||
view->Add( zone );
|
||||
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet = aBoard->GetWorksheetViewItem();
|
||||
// Prepare worksheet template
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet;
|
||||
worksheet = new KIGFX::WORKSHEET_VIEWITEM( &aBoard->GetPageSettings(),
|
||||
&aBoard->GetTitleBlock() );
|
||||
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
|
||||
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
@ -532,28 +514,17 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
|||
worksheet->SetSheetCount( screen->m_NumberOfScreens );
|
||||
}
|
||||
|
||||
view->Add( worksheet );
|
||||
view->Add( aBoard->GetRatsnestViewItem() );
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
// PCB_DRAW_PANEL_GAL takes ownership of the worksheet
|
||||
drawPanel->SetWorksheet( worksheet );
|
||||
|
||||
// Apply layer coloring scheme & display options
|
||||
if( view->GetPainter() )
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
{
|
||||
KIGFX::PCB_RENDER_SETTINGS* settings =
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
|
||||
|
||||
// Load layers' colors from PCB data
|
||||
settings->ImportLegacyColors( m_Pcb->GetColorsSettings() );
|
||||
|
||||
// Load display options (such as filled/outline display of items)
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
|
||||
drawPanel->GetViewControls(), this );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
|
||||
// Limit panning to the size of worksheet frame
|
||||
view->RecacheAllItems( true );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -563,6 +534,30 @@ bool PCB_EDIT_FRAME::isAutoSaveRequired() const
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::setupTools()
|
||||
{
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( NULL, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
||||
|
||||
// Register tools
|
||||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||
m_toolManager->RegisterTool( new ROUTER_TOOL );
|
||||
m_toolManager->RegisterTool( new EDIT_TOOL );
|
||||
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
||||
m_toolManager->RegisterTool( new POINT_EDITOR );
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL );
|
||||
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
|
||||
// Run the selection tool, it is supposed to be always active
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ReFillLayerWidget()
|
||||
{
|
||||
m_Layers->ReFill();
|
||||
|
@ -675,15 +670,16 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
|||
|
||||
if( aEnable )
|
||||
{
|
||||
ViewReloadBoard( m_Pcb );
|
||||
GetGalCanvas()->GetView()->RecacheAllItems();
|
||||
|
||||
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
|
||||
SetBoard( m_Pcb );
|
||||
GetGalCanvas()->GetView()->RecacheAllItems( true );
|
||||
GetGalCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Redirect all events to the legacy canvas
|
||||
GetGalCanvas()->SetEventDispatcher( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -823,104 +819,21 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetHighContrastLayer( LAYER_ID aLayer )
|
||||
void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
KIGFX::RENDER_SETTINGS* rSettings = view->GetPainter()->GetSettings();
|
||||
PCB_BASE_FRAME::SetActiveLayer( aLayer );
|
||||
|
||||
SetTopLayer( aLayer );
|
||||
GetGalCanvas()->SetHighContrastLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < DIM( layers ); ++i )
|
||||
rSettings->SetActiveLayer( layers[i] );
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
view->UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetTopLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
|
||||
view->ClearTopLayers();
|
||||
view->SetTopLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), Dwgs_User,
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < DIM( layers ); ++i )
|
||||
{
|
||||
view->SetTopLayer( layers[i] );
|
||||
}
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
view->UpdateAllLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate )
|
||||
{
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
|
||||
SetHighContrastLayer( aLayer );
|
||||
|
||||
if( doLayerWidgetUpdate )
|
||||
syncLayerWidgetLayer();
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
m_toolManager->RunAction( COMMON_ACTIONS::layerChanged ); // notify other tools
|
||||
GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
|
||||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::syncLayerWidgetLayer()
|
||||
|
@ -939,29 +852,7 @@ void PCB_EDIT_FRAME::syncRenderStates()
|
|||
void PCB_EDIT_FRAME::syncLayerVisibilities()
|
||||
{
|
||||
m_Layers->SyncLayerVisibilities();
|
||||
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
|
||||
// Load layer & elements visibility settings
|
||||
for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i )
|
||||
{
|
||||
view->SetLayerVisible( i, m_Pcb->IsLayerVisible( LAYER_ID( i ) ) );
|
||||
|
||||
// Synchronize netname layers as well
|
||||
if( IsCopperLayer( i ) )
|
||||
view->SetLayerVisible( GetNetnameLayer( i ), m_Pcb->IsLayerVisible( LAYER_ID( i ) ) );
|
||||
}
|
||||
|
||||
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
|
||||
{
|
||||
view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) );
|
||||
}
|
||||
|
||||
// Enable some layers that are GAL specific
|
||||
view->SetLayerVisible( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), true );
|
||||
view->SetLayerVisible( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), true );
|
||||
view->SetLayerVisible( ITEM_GAL_LAYER( WORKSHEET ), true );
|
||||
view->SetLayerVisible( ITEM_GAL_LAYER( GP_OVERLAY ), true );
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1156,19 +1047,15 @@ void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::OnLayerColorChange( wxCommandEvent& aEvent )
|
||||
{
|
||||
ReCreateLayerBox();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_PLOT dlg( this );
|
||||
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||
{
|
||||
wxCHECK2_MSG( aRotationAngle > 0 && aRotationAngle <= 900, aRotationAngle = 900,
|
||||
wxT( "Invalid rotation angle, defaulting to 90." ) );
|
||||
|
||||
m_rotationAngle = aRotationAngle;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
|||
if( !GetBoard()->GetEnabledLayers()[ cur_layer ] )
|
||||
cur_layer = F_Cu;
|
||||
|
||||
SetActiveLayer( cur_layer, true );
|
||||
SetActiveLayer( cur_layer );
|
||||
|
||||
OnModify();
|
||||
ReCreateLayerBox();
|
||||
|
|
|
@ -305,7 +305,7 @@ void RN_NET::clearNode( const RN_NODE_PTR& aNode )
|
|||
|
||||
// Remove all ratsnest edges for associated with the node
|
||||
newEnd = std::remove_if( m_rnEdges->begin(), m_rnEdges->end(),
|
||||
boost::bind( isEdgeConnectingNode, _1, aNode ) );
|
||||
boost::bind( isEdgeConnectingNode, _1, boost::ref( aNode ) ) );
|
||||
|
||||
m_rnEdges->resize( std::distance( m_rnEdges->begin(), newEnd ) );
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode, int aN
|
|||
closest.push_back( node );
|
||||
|
||||
// Sort by the distance from aNode
|
||||
closest.sort( boost::bind( sortDistance, aNode, _1, _2 ) );
|
||||
closest.sort( boost::bind( sortDistance, boost::ref( aNode ), _1, _2 ) );
|
||||
|
||||
// Remove the first node (==aNode), as it is surely located within the smallest distance
|
||||
closest.pop_front();
|
||||
|
@ -653,7 +653,7 @@ std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode,
|
|||
closest.push_back( node );
|
||||
|
||||
// Sort by the distance from aNode
|
||||
closest.sort( boost::bind( sortDistance, aNode, _1, _2 ) );
|
||||
closest.sort( boost::bind( sortDistance, boost::ref( aNode ), _1, _2 ) );
|
||||
|
||||
// Remove the first node (==aNode), as it is surely located within the smallest distance
|
||||
closest.pop_front();
|
||||
|
@ -1009,6 +1009,8 @@ void RN_DATA::ProcessBoard()
|
|||
if( netCode > 0 )
|
||||
m_nets[netCode].AddItem( zone );
|
||||
}
|
||||
|
||||
Recalculate();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -761,6 +761,9 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
|
|||
void PNS_LINE_PLACER::SetLayer( int aLayer )
|
||||
{
|
||||
m_currentLayer = aLayer;
|
||||
|
||||
m_head.SetLayer( aLayer );
|
||||
m_tail.SetLayer( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
@ -901,7 +904,16 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
|||
VECTOR2I p_start = m_placingVia ? p_last : p_pre_last;
|
||||
|
||||
if( m_placingVia )
|
||||
m_currentLayer = Router()->NextCopperLayer( true );
|
||||
{
|
||||
int layerTop = Router()->Settings().GetLayerTop();
|
||||
int layerBottom = Router()->Settings().GetLayerBottom();
|
||||
|
||||
// Change the current layer to the other side of the board
|
||||
if( m_currentLayer == layerTop )
|
||||
m_currentLayer = layerBottom;
|
||||
else
|
||||
m_currentLayer = layerTop;
|
||||
}
|
||||
|
||||
setWorld( Router()->GetWorld()->Branch() );
|
||||
startPlacement( p_start, m_head.Net(), m_head.Width(), m_currentLayer );
|
||||
|
|
|
@ -323,6 +323,7 @@ PNS_ROUTER::PNS_ROUTER()
|
|||
|
||||
m_currentLayer = 1;
|
||||
m_placingVia = false;
|
||||
m_startsOnVia = false;
|
||||
m_currentNet = -1;
|
||||
m_state = IDLE;
|
||||
m_world = NULL;
|
||||
|
@ -758,6 +759,8 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
|
|||
via_board->SetWidth( via->Diameter() );
|
||||
via_board->SetDrill( via->Drill() );
|
||||
via_board->SetNetCode( via->Net() );
|
||||
via_board->SetLayerPair( ToLAYER_ID( m_settings.GetLayerTop() ),
|
||||
ToLAYER_ID( m_settings.GetLayerBottom() ) );
|
||||
newBI = via_board;
|
||||
break;
|
||||
}
|
||||
|
@ -809,6 +812,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
|||
{
|
||||
case ROUTE_TRACK:
|
||||
rv = m_placer->FixRoute( aP, aEndItem );
|
||||
m_startsOnVia = m_placingVia;
|
||||
m_placingVia = false;
|
||||
break;
|
||||
|
||||
|
@ -874,8 +878,7 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
|
|||
if( m_startsOnVia )
|
||||
{
|
||||
m_currentLayer = aLayer;
|
||||
//m_placer->StartPlacement( m_currentStart, m_currentNet, m_currentWidth,
|
||||
// m_currentLayer );
|
||||
m_placer->SetLayer( aLayer );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "pns_routing_settings.h"
|
||||
#include "direction.h"
|
||||
|
||||
PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
|
||||
{
|
||||
|
@ -39,6 +40,15 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
|
|||
}
|
||||
|
||||
|
||||
const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
|
||||
{
|
||||
if( m_startDiagonal )
|
||||
return DIRECTION_45( DIRECTION_45::NE );
|
||||
else
|
||||
return DIRECTION_45( DIRECTION_45::N );
|
||||
}
|
||||
|
||||
|
||||
TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const
|
||||
{
|
||||
return TIME_LIMIT ( m_shoveTimeLimit );
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue