Upstream merge.
This commit is contained in:
commit
23392ce8c9
|
@ -45,16 +45,11 @@
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
#include <trackball.h>
|
#include <trackball.h>
|
||||||
|
|
||||||
// Exported function:
|
|
||||||
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
|
||||||
|
|
||||||
|
void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
|
||||||
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
|
|
||||||
{
|
{
|
||||||
unsigned ii;
|
|
||||||
|
|
||||||
/* adjust object scale, rotation and offset position */
|
/* adjust object scale, rotation and offset position */
|
||||||
for( ii = 0; ii < aVertices.size(); ii++ )
|
for( unsigned ii = 0; ii < aVertices.size(); ii++ )
|
||||||
{
|
{
|
||||||
aVertices[ii].x *= m_MatScale.x;
|
aVertices[ii].x *= m_MatScale.x;
|
||||||
aVertices[ii].y *= m_MatScale.y;
|
aVertices[ii].y *= m_MatScale.y;
|
||||||
|
@ -79,7 +74,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
|
void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
|
||||||
{
|
{
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
|
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
|
||||||
|
@ -138,44 +133,6 @@ void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLuint EDA_3D_CANVAS::DisplayCubeforTest()
|
|
||||||
{
|
|
||||||
GLuint gllist = glGenLists( 1 );
|
|
||||||
|
|
||||||
glNewList( gllist, GL_COMPILE_AND_EXECUTE );
|
|
||||||
/* draw six faces of a cube */
|
|
||||||
glBegin( GL_QUADS );
|
|
||||||
glNormal3f( 0.0F, 0.0F, 1.0F );
|
|
||||||
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F );
|
|
||||||
glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F );
|
|
||||||
|
|
||||||
glNormal3f( 0.0F, 0.0F, -1.0F );
|
|
||||||
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F );
|
|
||||||
glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F );
|
|
||||||
|
|
||||||
glNormal3f( 0.0F, 1.0F, 0.0F );
|
|
||||||
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F );
|
|
||||||
glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F );
|
|
||||||
|
|
||||||
glNormal3f( 0.0F, -1.0F, 0.0F );
|
|
||||||
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F );
|
|
||||||
glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F );
|
|
||||||
|
|
||||||
glNormal3f( 1.0F, 0.0F, 0.0F );
|
|
||||||
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F );
|
|
||||||
glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F );
|
|
||||||
|
|
||||||
glNormal3f( -1.0F, 0.0F, 0.0F );
|
|
||||||
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F );
|
|
||||||
glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F );
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
return gllist;
|
|
||||||
}
|
|
||||||
|
|
||||||
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
|
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
|
@ -78,7 +78,11 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
|
||||||
wxFULL_REPAINT_ON_RESIZE )
|
wxFULL_REPAINT_ON_RESIZE )
|
||||||
{
|
{
|
||||||
m_init = false;
|
m_init = false;
|
||||||
m_gllist = 0;
|
|
||||||
|
// Clear all gl list identifiers:
|
||||||
|
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
|
||||||
|
m_glLists[ii] = 0;
|
||||||
|
|
||||||
// Explicitly create a new rendering context instance for this canvas.
|
// Explicitly create a new rendering context instance for this canvas.
|
||||||
m_glRC = new wxGLContext( this );
|
m_glRC = new wxGLContext( this );
|
||||||
|
|
||||||
|
@ -94,12 +98,25 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_CANVAS::ClearLists()
|
void EDA_3D_CANVAS::ClearLists( GLuint aGlList )
|
||||||
{
|
{
|
||||||
if( m_gllist > 0 )
|
if( aGlList )
|
||||||
glDeleteLists( m_gllist, 1 );
|
{
|
||||||
|
if( m_glLists[aGlList] > 0 )
|
||||||
|
glDeleteLists( m_glLists[aGlList], 1 );
|
||||||
|
|
||||||
m_gllist = 0;
|
m_glLists[aGlList] = 0;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
|
||||||
|
{
|
||||||
|
if( m_glLists[ii] > 0 )
|
||||||
|
glDeleteLists( m_glLists[ii], 1 );
|
||||||
|
|
||||||
|
m_glLists[ii] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,14 +50,29 @@ class S3D_VERTEX;
|
||||||
class SEGVIA;
|
class SEGVIA;
|
||||||
class D_PAD;
|
class D_PAD;
|
||||||
|
|
||||||
|
// We are using GL lists to store layers and other items
|
||||||
|
// to draw or not
|
||||||
|
// GL_LIST_ID are the GL lists indexes in m_glLists
|
||||||
|
enum GL_LIST_ID
|
||||||
|
{
|
||||||
|
GL_ID_BEGIN = 0,
|
||||||
|
GL_ID_AXIS = GL_ID_BEGIN, // list id for 3D axis
|
||||||
|
GL_ID_GRID, // list id for 3D grid
|
||||||
|
GL_ID_BOARD, // List id for copper layers
|
||||||
|
GL_ID_TECH_LAYERS, // List id for non copper layers (masks...)
|
||||||
|
GL_ID_AUX_LAYERS, // List id for user layers (draw, eco, comment)
|
||||||
|
GL_ID_3DSHAPES_SOLID, // List id for 3D shapes, non transparent entities
|
||||||
|
GL_ID_3DSHAPES_TRANSP, // List id for 3D shapes, transparent entities
|
||||||
|
GL_ID_END
|
||||||
|
};
|
||||||
|
|
||||||
class EDA_3D_CANVAS : public wxGLCanvas
|
class EDA_3D_CANVAS : public wxGLCanvas
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool m_init;
|
bool m_init;
|
||||||
GLuint m_gllist;
|
GLuint m_glLists[GL_ID_END]; // GL lists
|
||||||
wxGLContext* m_glRC;
|
wxGLContext* m_glRC;
|
||||||
wxRealPoint m_draw3dOffset; // offset to draw the 3 mesh.
|
wxRealPoint m_draw3dOffset; // offset to draw the 3D mesh.
|
||||||
double m_ZBottom; // position of the back layer
|
double m_ZBottom; // position of the back layer
|
||||||
double m_ZTop; // position of the front layer
|
double m_ZTop; // position of the front layer
|
||||||
|
|
||||||
|
@ -67,7 +82,15 @@ public:
|
||||||
|
|
||||||
EDA_3D_FRAME* Parent() { return (EDA_3D_FRAME*)GetParent(); }
|
EDA_3D_FRAME* Parent() { return (EDA_3D_FRAME*)GetParent(); }
|
||||||
|
|
||||||
void ClearLists();
|
BOARD* GetBoard() { return Parent()->GetBoard(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ClearLists
|
||||||
|
* Clear the display list.
|
||||||
|
* @param aGlList = the list to clear.
|
||||||
|
* if 0 (default) all lists are cleared
|
||||||
|
*/
|
||||||
|
void ClearLists( GLuint aGlList = 0 );
|
||||||
|
|
||||||
// Event functions:
|
// Event functions:
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
@ -81,7 +104,6 @@ public:
|
||||||
void OnEnterWindow( wxMouseEvent& event );
|
void OnEnterWindow( wxMouseEvent& event );
|
||||||
|
|
||||||
// Display functions
|
// Display functions
|
||||||
GLuint DisplayCubeforTest(); // Just a test function
|
|
||||||
void SetView3D( int keycode );
|
void SetView3D( int keycode );
|
||||||
void DisplayStatus();
|
void DisplayStatus();
|
||||||
void Redraw();
|
void Redraw();
|
||||||
|
@ -92,7 +114,7 @@ public:
|
||||||
* Prepares the parameters of the OpenGL draw list
|
* Prepares the parameters of the OpenGL draw list
|
||||||
* creates the OpenGL draw list items (board, grid ...
|
* creates the OpenGL draw list items (board, grid ...
|
||||||
*/
|
*/
|
||||||
GLuint CreateDrawGL_List();
|
void CreateDrawGL_List();
|
||||||
void InitGL();
|
void InitGL();
|
||||||
void SetLights();
|
void SetLights();
|
||||||
void SetOffset(double aPosX, double aPosY)
|
void SetOffset(double aPosX, double aPosY)
|
||||||
|
@ -104,11 +126,40 @@ public:
|
||||||
/**
|
/**
|
||||||
* Function BuildBoard3DView
|
* Function BuildBoard3DView
|
||||||
* Called by CreateDrawGL_List()
|
* Called by CreateDrawGL_List()
|
||||||
* Fills the OpenGL draw list with board items draw list.
|
* Populates the OpenGL GL_ID_BOARD draw list with board items only on copper layers.
|
||||||
|
* 3D footprint shapes, tech layers and aux layers are not on this list
|
||||||
*/
|
*/
|
||||||
void BuildBoard3DView();
|
void BuildBoard3DView();
|
||||||
|
|
||||||
void DrawGrid( double aGriSizeMM );
|
/**
|
||||||
|
* Function BuildTechLayers3DView
|
||||||
|
* Called by CreateDrawGL_List()
|
||||||
|
* Populates the OpenGL GL_ID_BOARD draw list with items on tech layers
|
||||||
|
*/
|
||||||
|
void BuildTechLayers3DView();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function BuildFootprintShape3DList
|
||||||
|
* Called by CreateDrawGL_List()
|
||||||
|
* Fills the OpenGL GL_ID_3DSHAPES_SOLID and GL_ID_3DSHAPES_TRANSP
|
||||||
|
* draw lists with 3D footprint shapes
|
||||||
|
* @param aOpaqueList is the gl list for non transparent items
|
||||||
|
* @param aTransparentList is the gl list for non transparent items,
|
||||||
|
* which need to be drawn after all other items
|
||||||
|
*/
|
||||||
|
void BuildFootprintShape3DList( GLuint aOpaqueList,
|
||||||
|
GLuint aTransparentList);
|
||||||
|
/**
|
||||||
|
* Function BuildBoard3DAuxLayers
|
||||||
|
* Called by CreateDrawGL_List()
|
||||||
|
* Fills the OpenGL GL_ID_AUX_LAYERS draw list
|
||||||
|
* with items on aux layers only
|
||||||
|
*/
|
||||||
|
void BuildBoard3DAuxLayers();
|
||||||
|
|
||||||
|
void Draw3DGrid( double aGriSizeMM );
|
||||||
|
void Draw3DAxis();
|
||||||
|
|
||||||
void Draw3DViaHole( SEGVIA * aVia );
|
void Draw3DViaHole( SEGVIA * aVia );
|
||||||
void Draw3DPadHole( D_PAD * aPad );
|
void Draw3DPadHole( D_PAD * aPad );
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,14 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
||||||
m_Name = name;
|
m_Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void S3D_MATERIAL::SetMaterial()
|
void S3D_MATERIAL::SetMaterial()
|
||||||
{
|
{
|
||||||
|
S3D_MASTER * s3dParent = (S3D_MASTER *) GetParent();
|
||||||
|
s3dParent->SetLastTransparency( m_Transparency );
|
||||||
|
|
||||||
|
if( ! s3dParent->IsOpenGlAllowed() )
|
||||||
|
return;
|
||||||
|
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
|
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
|
||||||
m_DiffuseColor.y * m_AmbientIntensity,
|
m_DiffuseColor.y * m_AmbientIntensity,
|
||||||
|
@ -56,6 +61,20 @@ void S3D_MATERIAL::SetMaterial()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool S3D_MASTER::IsOpenGlAllowed()
|
||||||
|
{
|
||||||
|
if( m_loadNonTransparentObjects ) // return true for non transparent objects only
|
||||||
|
{
|
||||||
|
if( m_lastTransparency == 0.0 )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( m_loadTransparentObjects ) // return true for transparent objects only
|
||||||
|
if( m_lastTransparency != 0.0 )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
|
void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
|
||||||
{
|
{
|
||||||
|
@ -79,6 +98,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
|
||||||
EDA_ITEM( aParent, NOT_USED )
|
EDA_ITEM( aParent, NOT_USED )
|
||||||
{
|
{
|
||||||
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
||||||
|
m_lastTransparency = 0.0;
|
||||||
m_3D_Drawings = NULL;
|
m_3D_Drawings = NULL;
|
||||||
m_Materials = NULL;
|
m_Materials = NULL;
|
||||||
m_ShapeType = FILE3D_NONE;
|
m_ShapeType = FILE3D_NONE;
|
||||||
|
|
|
@ -52,7 +52,8 @@
|
||||||
// Imported function:
|
// Imported function:
|
||||||
extern void CheckGLError();
|
extern void CheckGLError();
|
||||||
|
|
||||||
/* returns true if aLayer should be displayed, false otherwise
|
/* Helper function
|
||||||
|
* returns true if aLayer should be displayed, false otherwise
|
||||||
*/
|
*/
|
||||||
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
|
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
|
||||||
{
|
{
|
||||||
if( aPad->GetShape() == PAD_CIRCLE ) // Draw a ring
|
if( aPad->GetShape() == PAD_CIRCLE ) // Draw a ring
|
||||||
{
|
{
|
||||||
TransformRingToPolygon( aCornerBuffer, aPad->ReturnShapePos(),
|
TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(),
|
||||||
aPad->GetSize().x / 2, aCircleToSegmentsCount, aWidth );
|
aPad->GetSize().x / 2, aCircleToSegmentsCount, aWidth );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -133,11 +134,48 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
glRotatef( g_Parm_3D_Visu.m_Rot[1], 0.0, 1.0, 0.0 );
|
glRotatef( g_Parm_3D_Visu.m_Rot[1], 0.0, 1.0, 0.0 );
|
||||||
glRotatef( g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0 );
|
glRotatef( g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0 );
|
||||||
|
|
||||||
if( m_gllist )
|
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
||||||
glCallList( m_gllist );
|
|
||||||
else
|
|
||||||
CreateDrawGL_List();
|
CreateDrawGL_List();
|
||||||
|
|
||||||
|
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) && m_glLists[GL_ID_AXIS] )
|
||||||
|
glCallList( m_glLists[GL_ID_AXIS] );
|
||||||
|
|
||||||
|
// move the board in order to draw it with its center at 0,0 3D coordinates
|
||||||
|
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
||||||
|
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
||||||
|
0.0F );
|
||||||
|
|
||||||
|
// draw all objects in lists
|
||||||
|
// transparent objects should be drawn after opaque objects
|
||||||
|
glCallList( m_glLists[GL_ID_BOARD] );
|
||||||
|
glCallList( m_glLists[GL_ID_TECH_LAYERS] );
|
||||||
|
|
||||||
|
if( g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) || g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) )
|
||||||
|
{
|
||||||
|
if( ! m_glLists[GL_ID_AUX_LAYERS] )
|
||||||
|
CreateDrawGL_List();
|
||||||
|
|
||||||
|
glCallList( m_glLists[GL_ID_AUX_LAYERS] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
||||||
|
{
|
||||||
|
if( ! m_glLists[GL_ID_3DSHAPES_SOLID] )
|
||||||
|
CreateDrawGL_List();
|
||||||
|
|
||||||
|
glCallList( m_glLists[GL_ID_3DSHAPES_SOLID] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grid uses transparency: draw it after all objects
|
||||||
|
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) && m_glLists[GL_ID_GRID] )
|
||||||
|
glCallList( m_glLists[GL_ID_GRID] );
|
||||||
|
|
||||||
|
// This list must be drawn last, because it contains the
|
||||||
|
// transparent gl objects, which should be drawn after all
|
||||||
|
// non transparent objects
|
||||||
|
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && m_glLists[GL_ID_3DSHAPES_TRANSP] )
|
||||||
|
glCallList( m_glLists[GL_ID_3DSHAPES_TRANSP] );
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +236,7 @@ static inline void SetGLTechLayersColor( LAYER_NUM aLayer )
|
||||||
|
|
||||||
void EDA_3D_CANVAS::BuildBoard3DView()
|
void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
{
|
{
|
||||||
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
|
BOARD* pcb = GetBoard();
|
||||||
BOARD* pcb = pcbframe->GetBoard();
|
|
||||||
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
||||||
|
|
||||||
// Number of segments to draw a circle using segments
|
// Number of segments to draw a circle using segments
|
||||||
|
@ -323,7 +360,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw graphic items
|
// draw graphic items on copper layers (texts)
|
||||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( layer ) )
|
if( !item->IsOnLayer( layer ) )
|
||||||
|
@ -331,11 +368,9 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_LINE_T:
|
case PCB_LINE_T: // should not exist on copper layers
|
||||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||||
bufferPolys, 0,
|
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||||
segcountforcircle,
|
|
||||||
correctionFactor );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
|
@ -456,14 +491,78 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2,
|
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2,
|
||||||
board_thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
board_thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_3D_CANVAS::BuildTechLayers3DView()
|
||||||
|
{
|
||||||
|
BOARD* pcb = GetBoard();
|
||||||
|
|
||||||
|
// Number of segments to draw a circle using segments
|
||||||
|
const int segcountforcircle = 16;
|
||||||
|
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
||||||
|
const int segcountLowQuality = 12; // segments to draw a circle with low quality
|
||||||
|
// to reduce time calculations
|
||||||
|
// for holes and items which do not need
|
||||||
|
// a fine representation
|
||||||
|
|
||||||
|
CPOLYGONS_LIST bufferPolys;
|
||||||
|
bufferPolys.reserve( 100000 ); // Reserve for large board
|
||||||
|
CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once
|
||||||
|
allLayerHoles.reserve( 20000 );
|
||||||
|
|
||||||
|
CPOLYGONS_LIST bufferPcbOutlines; // stores the board main outlines
|
||||||
|
// Build a polygon from edge cut items
|
||||||
|
wxString msg;
|
||||||
|
if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,
|
||||||
|
allLayerHoles, &msg ) )
|
||||||
|
{
|
||||||
|
msg << wxT("\n\n") <<
|
||||||
|
_("Unable to calculate the board outlines.\n"
|
||||||
|
"Therefore use the board boundary box.");
|
||||||
|
wxMessageBox( msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||||
|
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||||
|
{
|
||||||
|
// Add via hole
|
||||||
|
if( track->Type() == PCB_VIA_T )
|
||||||
|
{
|
||||||
|
int shape = track->GetShape();
|
||||||
|
int holediameter = track->GetDrillValue();
|
||||||
|
int hole_outer_radius = (holediameter + thickness) / 2;
|
||||||
|
|
||||||
|
if( shape == VIA_THROUGH )
|
||||||
|
TransformCircleToPolygon( allLayerHoles,
|
||||||
|
track->GetStart(), hole_outer_radius,
|
||||||
|
segcountLowQuality );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw pads holes
|
||||||
|
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||||
|
{
|
||||||
|
// Add pad hole, if any
|
||||||
|
D_PAD* pad = module->Pads();
|
||||||
|
|
||||||
|
for( ; pad != NULL; pad = pad->Next() )
|
||||||
|
pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
|
||||||
|
segcountLowQuality );
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw graphic items, on technical layers
|
||||||
|
|
||||||
// draw graphic items, not on copper layers
|
|
||||||
KI_POLYGON_SET brdpolysetHoles;
|
KI_POLYGON_SET brdpolysetHoles;
|
||||||
allLayerHoles.ExportTo( brdpolysetHoles );
|
allLayerHoles.ExportTo( brdpolysetHoles );
|
||||||
|
|
||||||
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
|
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
|
||||||
layer++ )
|
layer++ )
|
||||||
{
|
{
|
||||||
|
// Skip user layers, which are not drawn here
|
||||||
|
if( IsUserLayer( layer) )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( !Is3DLayerEnabled( layer ) )
|
if( !Is3DLayerEnabled( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -481,9 +580,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
{
|
{
|
||||||
case PCB_LINE_T:
|
case PCB_LINE_T:
|
||||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||||
bufferPolys, 0,
|
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||||
segcountforcircle,
|
|
||||||
correctionFactor );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
|
@ -556,10 +653,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
currLayerPolyset += polyset;
|
currLayerPolyset += polyset;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGLTechLayersColor( layer );
|
|
||||||
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
|
||||||
|
|
||||||
if( layer == EDGE_N )
|
if( layer == EDGE_N )
|
||||||
{
|
{
|
||||||
|
@ -582,38 +677,222 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
bufferPolys.ImportFrom( currLayerPolyset );
|
bufferPolys.ImportFrom( currLayerPolyset );
|
||||||
|
|
||||||
|
SetGLTechLayersColor( layer );
|
||||||
|
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||||
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// draw modules 3D shapes
|
/**
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
* Function BuildBoard3DAuxLayers
|
||||||
|
* Called by CreateDrawGL_List()
|
||||||
|
* Fills the OpenGL GL_ID_BOARD draw list with items
|
||||||
|
* on aux layers only
|
||||||
|
*/
|
||||||
|
void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
|
||||||
|
{
|
||||||
|
const int segcountforcircle = 16;
|
||||||
|
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
||||||
|
BOARD* pcb = GetBoard();
|
||||||
|
CPOLYGONS_LIST bufferPolys;
|
||||||
|
bufferPolys.reserve( 5000 ); // Reserve for items not on board
|
||||||
|
|
||||||
|
for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
|
||||||
|
layer++ )
|
||||||
{
|
{
|
||||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
if( !Is3DLayerEnabled( layer ) )
|
||||||
module->ReadAndInsert3DComponentShape( this );
|
continue;
|
||||||
|
|
||||||
|
bufferPolys.RemoveAllContours();
|
||||||
|
|
||||||
|
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||||
|
{
|
||||||
|
if( !item->IsOnLayer( layer ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch( item->Type() )
|
||||||
|
{
|
||||||
|
case PCB_LINE_T:
|
||||||
|
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||||
|
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PCB_TEXT_T:
|
||||||
|
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
|
||||||
|
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||||
|
{
|
||||||
|
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||||
|
bufferPolys,
|
||||||
|
0,
|
||||||
|
segcountforcircle,
|
||||||
|
correctionFactor );
|
||||||
|
|
||||||
|
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||||
|
bufferPolys,
|
||||||
|
0,
|
||||||
|
segcountforcircle,
|
||||||
|
correctionFactor );
|
||||||
|
}
|
||||||
|
|
||||||
|
// bufferPolys contains polygons to merge. Many overlaps .
|
||||||
|
// Calculate merged polygons and remove pads and vias holes
|
||||||
|
if( bufferPolys.GetCornersCount() == 0 )
|
||||||
|
continue;
|
||||||
|
KI_POLYGON_SET currLayerPolyset;
|
||||||
|
KI_POLYGON_SET polyset;
|
||||||
|
bufferPolys.ExportTo( polyset );
|
||||||
|
currLayerPolyset += polyset;
|
||||||
|
|
||||||
|
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||||
|
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||||
|
// for Draw3D_SolidHorizontalPolyPolygons,
|
||||||
|
// zpos it the middle between bottom and top sides.
|
||||||
|
// However for top layers, zpos should be the bottom layer pos,
|
||||||
|
// and for bottom layers, zpos should be the top layer pos.
|
||||||
|
if( Get3DLayer_Z_Orientation( layer ) > 0 )
|
||||||
|
zpos += thickness/2;
|
||||||
|
else
|
||||||
|
zpos -= thickness/2 ;
|
||||||
|
|
||||||
|
bufferPolys.RemoveAllContours();
|
||||||
|
bufferPolys.ImportFrom( currLayerPolyset );
|
||||||
|
|
||||||
|
SetGLTechLayersColor( layer );
|
||||||
|
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||||
|
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||||
|
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EDA_3D_CANVAS::CreateDrawGL_List()
|
||||||
GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|
||||||
{
|
{
|
||||||
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
|
BOARD* pcb = GetBoard();
|
||||||
BOARD* pcb = pcbframe->GetBoard();
|
|
||||||
|
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
m_gllist = glGenLists( 1 );
|
|
||||||
|
|
||||||
// Build 3D board parameters:
|
// Build 3D board parameters:
|
||||||
g_Parm_3D_Visu.InitSettings( pcb );
|
g_Parm_3D_Visu.InitSettings( pcb );
|
||||||
|
|
||||||
glNewList( m_gllist, GL_COMPILE_AND_EXECUTE );
|
|
||||||
|
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
|
|
||||||
// draw axis
|
// Create axis gl list (if it is not shown, the list will be not called
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) )
|
Draw3DAxis();
|
||||||
|
|
||||||
|
// Create grid gl list
|
||||||
|
if( ! m_glLists[GL_ID_GRID] )
|
||||||
{
|
{
|
||||||
|
m_glLists[GL_ID_GRID] = glGenLists( 1 );
|
||||||
|
glNewList( m_glLists[GL_ID_GRID], GL_COMPILE );
|
||||||
|
|
||||||
|
Draw3DGrid( g_Parm_3D_Visu.m_3D_Grid );
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Board full gl lists:
|
||||||
|
|
||||||
|
// For testing purpose only, display calculation time to generate 3D data
|
||||||
|
// #define PRINT_CALCULATION_TIME
|
||||||
|
|
||||||
|
#ifdef PRINT_CALCULATION_TIME
|
||||||
|
unsigned strtime = GetRunningMicroSecs();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( ! m_glLists[GL_ID_BOARD] )
|
||||||
|
{
|
||||||
|
m_glLists[GL_ID_BOARD] = glGenLists( 1 );
|
||||||
|
glNewList( m_glLists[GL_ID_BOARD], GL_COMPILE );
|
||||||
|
BuildBoard3DView();
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! m_glLists[GL_ID_TECH_LAYERS] )
|
||||||
|
{
|
||||||
|
m_glLists[GL_ID_TECH_LAYERS] = glGenLists( 1 );
|
||||||
|
glNewList( m_glLists[GL_ID_TECH_LAYERS], GL_COMPILE );
|
||||||
|
BuildTechLayers3DView();
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! m_glLists[GL_ID_AUX_LAYERS] )
|
||||||
|
{
|
||||||
|
m_glLists[GL_ID_AUX_LAYERS] = glGenLists( 1 );
|
||||||
|
glNewList( m_glLists[GL_ID_AUX_LAYERS], GL_COMPILE );
|
||||||
|
BuildBoard3DAuxLayers();
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// draw modules 3D shapes
|
||||||
|
if( ! m_glLists[GL_ID_3DSHAPES_SOLID] && g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
||||||
|
{
|
||||||
|
m_glLists[GL_ID_3DSHAPES_SOLID] = glGenLists( 1 );
|
||||||
|
|
||||||
|
// GL_ID_3DSHAPES_TRANSP is an auxiliary list for 3D shapes;
|
||||||
|
// Ensure it is cleared before rebuilding it
|
||||||
|
if( m_glLists[GL_ID_3DSHAPES_TRANSP] )
|
||||||
|
glDeleteLists( m_glLists[GL_ID_3DSHAPES_TRANSP], 1 );
|
||||||
|
|
||||||
|
m_glLists[GL_ID_3DSHAPES_TRANSP] = glGenLists( 1 );
|
||||||
|
BuildFootprintShape3DList( m_glLists[GL_ID_3DSHAPES_SOLID],
|
||||||
|
m_glLists[GL_ID_3DSHAPES_TRANSP] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test for errors
|
||||||
|
CheckGLError();
|
||||||
|
|
||||||
|
#ifdef PRINT_CALCULATION_TIME
|
||||||
|
unsigned endtime = GetRunningMicroSecs();
|
||||||
|
wxString msg;
|
||||||
|
msg.Printf( "Built data %.1f ms", (double) (endtime - strtime) / 1000 );
|
||||||
|
Parent()->SetStatusText( msg, 0 );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_3D_CANVAS::BuildFootprintShape3DList( GLuint aOpaqueList,
|
||||||
|
GLuint aTransparentList)
|
||||||
|
{
|
||||||
|
// aOpaqueList is the gl list for non transparent items
|
||||||
|
// aTransparentList is the gl list for non transparent items,
|
||||||
|
// which need to be drawn after all other items
|
||||||
|
|
||||||
|
BOARD* pcb = GetBoard();
|
||||||
|
glNewList( aOpaqueList, GL_COMPILE );
|
||||||
|
bool loadTransparentObjects = false;
|
||||||
|
|
||||||
|
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||||
|
module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects,
|
||||||
|
loadTransparentObjects );
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
|
||||||
|
glNewList( aTransparentList, GL_COMPILE );
|
||||||
|
loadTransparentObjects = true;
|
||||||
|
|
||||||
|
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||||
|
module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects,
|
||||||
|
loadTransparentObjects );
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EDA_3D_CANVAS::Draw3DAxis()
|
||||||
|
{
|
||||||
|
if( ! m_glLists[GL_ID_AXIS] )
|
||||||
|
{
|
||||||
|
m_glLists[GL_ID_AXIS] = glGenLists( 1 );
|
||||||
|
glNewList( m_glLists[GL_ID_AXIS], GL_COMPILE );
|
||||||
|
|
||||||
glEnable( GL_COLOR_MATERIAL );
|
glEnable( GL_COLOR_MATERIAL );
|
||||||
SetGLColor( WHITE );
|
SetGLColor( WHITE );
|
||||||
glBegin( GL_LINES );
|
glBegin( GL_LINES );
|
||||||
|
@ -626,52 +905,20 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
||||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||||
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
|
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
glEndList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the board in order to draw it with its center at 0,0 3D coordinates
|
|
||||||
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
|
||||||
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
|
||||||
0.0F );
|
|
||||||
|
|
||||||
// Draw Board:
|
|
||||||
// For testing purpose only, display calculation time to generate 3D data
|
|
||||||
// #define PRINT_CALCULATION_TIME
|
|
||||||
|
|
||||||
#ifdef PRINT_CALCULATION_TIME
|
|
||||||
unsigned strtime = GetRunningMicroSecs();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BuildBoard3DView();
|
|
||||||
|
|
||||||
// Draw grid
|
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
|
|
||||||
DrawGrid( g_Parm_3D_Visu.m_3D_Grid );
|
|
||||||
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
// Test for errors
|
|
||||||
CheckGLError();
|
|
||||||
|
|
||||||
#ifdef PRINT_CALCULATION_TIME
|
|
||||||
unsigned endtime = GetRunningMicroSecs();
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( "Built data %.1f ms", (double) (endtime - strtime) / 1000 );
|
|
||||||
Parent()->SetStatusText( msg, 0 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return m_gllist;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// draw a 3D grid: an horizontal grid (XY plane and Z = 0,
|
// draw a 3D grid: an horizontal grid (XY plane and Z = 0,
|
||||||
// and a vertical grid (XZ plane and Y = 0)
|
// and a vertical grid (XZ plane and Y = 0)
|
||||||
void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
|
void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )
|
||||||
{
|
{
|
||||||
double zpos = 0.0;
|
double zpos = 0.0;
|
||||||
EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines
|
EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines
|
||||||
EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
|
EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
|
||||||
double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
|
const double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
|
||||||
double transparency = 0.4;
|
const double transparency = 0.3;
|
||||||
|
|
||||||
glNormal3f( 0.0, 0.0, 1.0 );
|
glNormal3f( 0.0, 0.0, 1.0 );
|
||||||
|
|
||||||
|
@ -806,7 +1053,7 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
|
||||||
int inner_radius = aVia->GetDrillValue() / 2;
|
int inner_radius = aVia->GetDrillValue() / 2;
|
||||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||||
|
|
||||||
aVia->ReturnLayerPair( &top_layer, &bottom_layer );
|
aVia->LayerPair( &top_layer, &bottom_layer );
|
||||||
|
|
||||||
// Drawing via hole:
|
// Drawing via hole:
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
if( g_Parm_3D_Visu.IsRealisticMode() )
|
||||||
|
@ -826,8 +1073,11 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
|
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,
|
||||||
|
bool aAllowNonTransparentObjects,
|
||||||
|
bool aAllowTransparentObjects )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Read from disk and draws the footprint 3D shapes if exists
|
// Read from disk and draws the footprint 3D shapes if exists
|
||||||
S3D_MASTER* shape3D = m_3D_Drawings;
|
S3D_MASTER* shape3D = m_3D_Drawings;
|
||||||
double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() );
|
double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() );
|
||||||
|
@ -849,6 +1099,9 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
|
||||||
|
|
||||||
for( ; shape3D != NULL; shape3D = shape3D->Next() )
|
for( ; shape3D != NULL; shape3D = shape3D->Next() )
|
||||||
{
|
{
|
||||||
|
shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects );
|
||||||
|
shape3D->SetLoadTransparentObjects( aAllowTransparentObjects );
|
||||||
|
|
||||||
if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
|
if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
|
||||||
shape3D->ReadData();
|
shape3D->ReadData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <3d_draw_basic_functions.h>
|
#include <3d_draw_basic_functions.h>
|
||||||
|
|
||||||
// Imported function:
|
// Imported function:
|
||||||
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
|
extern void TransfertToGLlist( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
|
||||||
extern void CheckGLError();
|
extern void CheckGLError();
|
||||||
|
|
||||||
// Number of segments to approximate a circle by segments
|
// Number of segments to approximate a circle by segments
|
||||||
|
@ -116,7 +116,7 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
|
||||||
coords[3].y = coords[2].y; // only z change
|
coords[3].y = coords[2].y; // only z change
|
||||||
|
|
||||||
// Creates the GL_QUAD
|
// Creates the GL_QUAD
|
||||||
Set_Object_Data( coords, aBiuTo3DUnits );
|
TransfertToGLlist( coords, aBiuTo3DUnits );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <kiface_i.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
#include <3d_canvas.h>
|
#include <3d_canvas.h>
|
||||||
|
@ -40,21 +41,24 @@
|
||||||
INFO3D_VISU g_Parm_3D_Visu;
|
INFO3D_VISU g_Parm_3D_Visu;
|
||||||
|
|
||||||
// Key to store 3D Viewer config:
|
// Key to store 3D Viewer config:
|
||||||
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
|
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
|
||||||
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
|
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
|
||||||
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
|
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
|
||||||
static const wxString keyShowRealisticMode( wxT( "ShowRealisticMode" ) );
|
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
||||||
static const wxString keyShowAxis( wxT( "ShowAxis" ) );
|
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
|
||||||
static const wxString keyShowZones( wxT( "ShowZones" ) );
|
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
|
||||||
static const wxString keyShowFootprints( wxT( "ShowFootprints" ) );
|
static const wxChar keyShowGridSize[] = wxT( "Grid3DSize" );
|
||||||
static const wxString keyShowCopperThickness( wxT( "ShowCopperThickness" ) );
|
static const wxChar keyShowZones[] = wxT( "ShowZones" );
|
||||||
static const wxString keyShowAdhesiveLayers( wxT( "ShowAdhesiveLayers" ) );
|
static const wxChar keyShowFootprints[] = wxT( "ShowFootprints" );
|
||||||
static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) );
|
static const wxChar keyShowCopperThickness[] = wxT( "ShowCopperThickness" );
|
||||||
static const wxString keyShowSolderMaskLayers( wxT( "ShowSolderMasLayers" ) );
|
static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
|
||||||
static const wxString keyShowSolderPasteLayers( wxT( "ShowSolderPasteLayers" ) );
|
static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
|
||||||
static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) );
|
static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
|
||||||
static const wxString keyShowBoardBody( wxT( "ShowBoardBody" ) );
|
static const wxChar keyShowSolderPasteLayers[] =wxT( "ShowSolderPasteLayers" );
|
||||||
static const wxString keyShowEcoLayers( wxT( "ShowEcoLayers" ) );
|
static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
|
||||||
|
static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
|
||||||
|
static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( EDA_3D_FRAME, EDA_BASE_FRAME )
|
BEGIN_EVENT_TABLE( EDA_3D_FRAME, EDA_BASE_FRAME )
|
||||||
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
|
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
|
||||||
|
@ -72,11 +76,13 @@ EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END,
|
||||||
|
|
||||||
EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
|
EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
|
||||||
|
|
||||||
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
END_EVENT_TABLE()
|
||||||
const wxString& title,
|
|
||||||
long style ) :
|
|
||||||
EDA_BASE_FRAME( parent, DISPLAY3D_FRAME_TYPE, title,
|
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
const wxString& aTitle, long style ) :
|
||||||
|
KIWAY_PLAYER( aKiway, aParent, DISPLAY3D_FRAME_TYPE, aTitle,
|
||||||
|
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||||
{
|
{
|
||||||
m_canvas = NULL;
|
m_canvas = NULL;
|
||||||
m_reloadRequest = false;
|
m_reloadRequest = false;
|
||||||
|
@ -87,7 +93,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
||||||
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
|
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
|
||||||
SetIcon( icon );
|
SetIcon( icon );
|
||||||
|
|
||||||
GetSettings();
|
LoadSettings( config() );
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
|
||||||
// Create the status line
|
// Create the status line
|
||||||
|
@ -139,84 +145,84 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_FRAME::GetSettings()
|
void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
|
||||||
|
|
||||||
if( config )
|
INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||||
{
|
|
||||||
EDA_BASE_FRAME::LoadSettings();
|
|
||||||
|
|
||||||
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
aCfg->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
||||||
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
aCfg->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
||||||
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
aCfg->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
||||||
|
|
||||||
bool tmp;
|
bool tmp;
|
||||||
config->Read( keyShowRealisticMode, &tmp, false );
|
aCfg->Read( keyShowRealisticMode, &tmp, false );
|
||||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||||
|
|
||||||
config->Read( keyShowAxis, &tmp, true );
|
aCfg->Read( keyShowAxis, &tmp, true );
|
||||||
prms.SetFlag( FL_AXIS, tmp );
|
prms.SetFlag( FL_AXIS, tmp );
|
||||||
|
|
||||||
config->Read( keyShowFootprints, &tmp, true );
|
aCfg->Read( keyShowGrid, &tmp, true );
|
||||||
prms.SetFlag( FL_MODULE, tmp );
|
prms.SetFlag( FL_GRID, tmp );
|
||||||
|
|
||||||
config->Read( keyShowCopperThickness, &tmp, false );
|
aCfg->Read( keyShowGridSize, &prms.m_3D_Grid, 10.0 );
|
||||||
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
|
prms.SetFlag( FL_MODULE, tmp );
|
||||||
|
|
||||||
config->Read( keyShowZones, &tmp, true );
|
aCfg->Read( keyShowFootprints, &tmp, true );
|
||||||
prms.SetFlag( FL_ZONE, tmp );
|
prms.SetFlag( FL_MODULE, tmp );
|
||||||
|
|
||||||
config->Read( keyShowAdhesiveLayers, &tmp, true );
|
aCfg->Read( keyShowCopperThickness, &tmp, false );
|
||||||
prms.SetFlag( FL_ADHESIVE, tmp );
|
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
|
||||||
|
|
||||||
config->Read( keyShowSilkScreenLayers, &tmp, true );
|
aCfg->Read( keyShowZones, &tmp, true );
|
||||||
prms.SetFlag( FL_SILKSCREEN, tmp );
|
prms.SetFlag( FL_ZONE, tmp );
|
||||||
|
|
||||||
config->Read( keyShowSolderMaskLayers, &tmp, true );
|
aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
|
||||||
prms.SetFlag( FL_SOLDERMASK, tmp );
|
prms.SetFlag( FL_ADHESIVE, tmp );
|
||||||
|
|
||||||
config->Read( keyShowSolderPasteLayers, &tmp, true );
|
aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
|
||||||
prms.SetFlag( FL_SOLDERPASTE, tmp );
|
prms.SetFlag( FL_SILKSCREEN, tmp );
|
||||||
|
|
||||||
config->Read( keyShowCommentsLayer, &tmp, true );
|
aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
|
||||||
prms.SetFlag( FL_COMMENTS, tmp );
|
prms.SetFlag( FL_SOLDERMASK, tmp );
|
||||||
|
|
||||||
config->Read( keyShowEcoLayers, &tmp, true );
|
aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
|
||||||
prms.SetFlag( FL_ECO, tmp );
|
prms.SetFlag( FL_SOLDERPASTE, tmp );
|
||||||
|
|
||||||
config->Read( keyShowBoardBody, &tmp, true );
|
aCfg->Read( keyShowCommentsLayer, &tmp, true );
|
||||||
prms.SetFlag( FL_SHOW_BOARD_BODY, tmp );
|
prms.SetFlag( FL_COMMENTS, tmp );
|
||||||
}
|
|
||||||
|
aCfg->Read( keyShowEcoLayers, &tmp, true );
|
||||||
|
prms.SetFlag( FL_ECO, tmp );
|
||||||
|
|
||||||
|
aCfg->Read( keyShowBoardBody, &tmp, true );
|
||||||
|
prms.SetFlag( FL_SHOW_BOARD_BODY, tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_FRAME::SaveSettings()
|
void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
|
||||||
if( !config )
|
INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||||
return;
|
|
||||||
|
|
||||||
EDA_BASE_FRAME::SaveSettings();
|
aCfg->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
||||||
|
aCfg->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
||||||
config->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
aCfg->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||||
config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||||
config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
aCfg->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
||||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
aCfg->Write( keyShowGrid, prms.GetFlag( FL_GRID ) );
|
||||||
config->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
aCfg->Write( keyShowGridSize, prms.m_3D_Grid );
|
||||||
config->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
aCfg->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
||||||
config->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
aCfg->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||||
config->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
aCfg->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
||||||
config->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
aCfg->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
||||||
config->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
aCfg->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
||||||
config->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
aCfg->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
||||||
config->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
aCfg->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
||||||
config->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
aCfg->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||||
config->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
aCfg->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||||
config->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
aCfg->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||||
config->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,52 +370,52 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_MENU3D_AXIS_ONOFF:
|
case ID_MENU3D_AXIS_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
|
||||||
NewDisplay();
|
m_canvas->Refresh();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_MODULE_ONOFF:
|
case ID_MENU3D_MODULE_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
|
||||||
NewDisplay();
|
m_canvas->Refresh();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_USE_COPPER_THICKNESS:
|
case ID_MENU3D_USE_COPPER_THICKNESS:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_BOARD);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_ZONE_ONOFF:
|
case ID_MENU3D_ZONE_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_BOARD);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_ADHESIVE_ONOFF:
|
case ID_MENU3D_ADHESIVE_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_TECH_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_SILKSCREEN_ONOFF:
|
case ID_MENU3D_SILKSCREEN_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_TECH_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_SOLDER_MASK_ONOFF:
|
case ID_MENU3D_SOLDER_MASK_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_TECH_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_SOLDER_PASTE_ONOFF:
|
case ID_MENU3D_SOLDER_PASTE_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_TECH_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_COMMENTS_ONOFF:
|
case ID_MENU3D_COMMENTS_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_AUX_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_ECO_ONOFF:
|
case ID_MENU3D_ECO_ONOFF:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
|
||||||
NewDisplay();
|
NewDisplay(GL_ID_AUX_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -434,7 +440,6 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||||
GetMenuBar()->Check( ii, false );
|
GetMenuBar()->Check( ii, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_MENU3D_GRID_NOGRID:
|
case ID_MENU3D_GRID_NOGRID:
|
||||||
|
@ -466,18 +471,17 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewDisplay();
|
NewDisplay( GL_ID_GRID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_FRAME::NewDisplay()
|
void EDA_3D_FRAME::NewDisplay( GLuint aGlList )
|
||||||
{
|
{
|
||||||
m_reloadRequest = false;
|
m_reloadRequest = false;
|
||||||
|
|
||||||
m_canvas->ClearLists();
|
m_canvas->ClearLists( aGlList );
|
||||||
m_canvas->CreateDrawGL_List();
|
m_canvas->CreateDrawGL_List();
|
||||||
|
|
||||||
// m_canvas->InitGL();
|
|
||||||
m_canvas->Refresh( true );
|
m_canvas->Refresh( true );
|
||||||
m_canvas->DisplayStatus();
|
m_canvas->DisplayStatus();
|
||||||
}
|
}
|
||||||
|
@ -507,6 +511,9 @@ void EDA_3D_FRAME::Set3DBgColor()
|
||||||
|
|
||||||
newcolor = wxGetColourFromUser( this, oldcolor );
|
newcolor = wxGetColourFromUser( this, oldcolor );
|
||||||
|
|
||||||
|
if( !newcolor.IsOk() ) // Happens on cancel dialog
|
||||||
|
return;
|
||||||
|
|
||||||
if( newcolor != oldcolor )
|
if( newcolor != oldcolor )
|
||||||
{
|
{
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
||||||
|
@ -515,3 +522,8 @@ void EDA_3D_FRAME::Set3DBgColor()
|
||||||
NewDisplay();
|
NewDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOARD* EDA_3D_FRAME::GetBoard()
|
||||||
|
{
|
||||||
|
return Parent()->GetBoard();
|
||||||
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
|
|
|
@ -109,6 +109,10 @@ public:
|
||||||
private:
|
private:
|
||||||
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
||||||
FILE3D_TYPE m_ShapeType;
|
FILE3D_TYPE m_ShapeType;
|
||||||
|
double m_lastTransparency; // last transparency value from
|
||||||
|
// last material in use
|
||||||
|
bool m_loadTransparentObjects;
|
||||||
|
bool m_loadNonTransparentObjects;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
S3D_MASTER( EDA_ITEM* aParent );
|
S3D_MASTER( EDA_ITEM* aParent );
|
||||||
|
@ -117,11 +121,41 @@ public:
|
||||||
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
|
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
|
||||||
S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }
|
S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
void SetLastTransparency( double aValue ) { m_lastTransparency = aValue; }
|
||||||
|
|
||||||
|
void SetLoadTransparentObjects( bool aLoad )
|
||||||
|
{ m_loadTransparentObjects = aLoad; }
|
||||||
|
|
||||||
|
void SetLoadNonTransparentObjects( bool aLoad )
|
||||||
|
{ m_loadNonTransparentObjects = aLoad; }
|
||||||
|
|
||||||
void Insert( S3D_MATERIAL* aMaterial );
|
void Insert( S3D_MATERIAL* aMaterial );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IsOpenGlAllowed
|
||||||
|
* @return true if opengl current list accepts a gl data
|
||||||
|
* used to filter transparent objects, which are drawn after
|
||||||
|
* non transparent objects
|
||||||
|
*/
|
||||||
|
bool IsOpenGlAllowed();
|
||||||
|
|
||||||
void Copy( S3D_MASTER* pattern );
|
void Copy( S3D_MASTER* pattern );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReadData
|
||||||
|
* Select the parser to read the 3D data file (vrml, x3d ...)
|
||||||
|
* and build the description objects list
|
||||||
|
*/
|
||||||
int ReadData();
|
int ReadData();
|
||||||
void Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices );
|
|
||||||
|
/**
|
||||||
|
* Function ObjectCoordsTo3DUnits
|
||||||
|
* @param aVertices = a list of 3D coordinates in shape units
|
||||||
|
* to convert to 3D canvas units, according to the
|
||||||
|
* footprint 3Dshape rotation, offset and scale parameters
|
||||||
|
*/
|
||||||
|
void ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices );
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||||
|
@ -147,6 +181,13 @@ public:
|
||||||
*/
|
*/
|
||||||
const wxString GetShape3DFullFilename();
|
const wxString GetShape3DFullFilename();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetShape3DName
|
||||||
|
* @param aShapeName = file name of the data file relative to the 3D shape
|
||||||
|
*
|
||||||
|
* Set the filename of the 3D shape, and depending on the file extention
|
||||||
|
* (vrl, x3d, idf ) the type of file.
|
||||||
|
*/
|
||||||
void SetShape3DName( const wxString& aShapeName );
|
void SetShape3DName( const wxString& aShapeName );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -166,13 +166,22 @@ void EDA_3D_FRAME::CreateMenuBar()
|
||||||
wxMenu * gridlistMenu = new wxMenu;
|
wxMenu * gridlistMenu = new wxMenu;
|
||||||
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
|
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
|
||||||
_( "3D Grid" ), KiBitmap( grid_xpm ) );
|
_( "3D Grid" ), KiBitmap( grid_xpm ) );
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
|
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
|
||||||
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
|
gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
|
||||||
|
gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
|
||||||
|
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
|
||||||
|
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
|
||||||
|
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
|
// If the grid is on, check the corresponding menuitem showing the grid size
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
|
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
|
{
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
|
gridlistMenu->Check( ID_MENU3D_GRID_10_MM, g_Parm_3D_Visu.m_3D_Grid == 10.0 );
|
||||||
|
gridlistMenu->Check( ID_MENU3D_GRID_5_MM, g_Parm_3D_Visu.m_3D_Grid == 5.0 );
|
||||||
|
gridlistMenu->Check( ID_MENU3D_GRID_2P5_MM, g_Parm_3D_Visu.m_3D_Grid == 2.5 );
|
||||||
|
gridlistMenu->Check( ID_MENU3D_GRID_1_MM, g_Parm_3D_Visu.m_3D_Grid == 1.0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
|
||||||
|
|
||||||
prefsMenu->AppendSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#ifndef __3D_VIEWER_H__
|
#ifndef __3D_VIEWER_H__
|
||||||
#define __3D_VIEWER_H__
|
#define __3D_VIEWER_H__
|
||||||
|
|
||||||
#include <wxstruct.h> // for EDA_BASE_FRAME.
|
#include <draw_frame.h>
|
||||||
|
|
||||||
#if !wxUSE_GLCANVAS
|
#if !wxUSE_GLCANVAS
|
||||||
#error Please build wxWidgets with Opengl support (./configure --with-opengl)
|
#error Please build wxWidgets with Opengl support (./configure --with-opengl)
|
||||||
|
@ -53,24 +53,29 @@
|
||||||
|
|
||||||
#include <3d_struct.h>
|
#include <3d_struct.h>
|
||||||
|
|
||||||
|
#define KISYS3DMOD "KISYS3DMOD"
|
||||||
|
|
||||||
class EDA_3D_CANVAS;
|
class EDA_3D_CANVAS;
|
||||||
class PCB_BASE_FRAME;
|
class PCB_BASE_FRAME;
|
||||||
|
|
||||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
|
||||||
#define LIB3D_PATH wxT( "packages3d" )
|
#define LIB3D_PATH wxT( "packages3d" )
|
||||||
|
|
||||||
class EDA_3D_FRAME : public EDA_BASE_FRAME
|
|
||||||
|
class EDA_3D_FRAME : public KIWAY_PLAYER
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
EDA_3D_CANVAS* m_canvas;
|
EDA_3D_CANVAS* m_canvas;
|
||||||
bool m_reloadRequest;
|
bool m_reloadRequest;
|
||||||
wxString m_defaultFileName; /// Filename to propose for screenshot
|
wxString m_defaultFileName; /// Filename to propose for screenshot
|
||||||
|
|
||||||
/// Tracks whether to use Orthographic or Perspective projection
|
/// Tracks whether to use Orthographic or Perspective projection
|
||||||
bool m_ortho;
|
bool m_ortho;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title,
|
EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, const wxString& aTitle,
|
||||||
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
||||||
|
|
||||||
~EDA_3D_FRAME()
|
~EDA_3D_FRAME()
|
||||||
{
|
{
|
||||||
m_auimgr.UnInit();
|
m_auimgr.UnInit();
|
||||||
|
@ -78,6 +83,8 @@ public:
|
||||||
|
|
||||||
PCB_BASE_FRAME* Parent() { return (PCB_BASE_FRAME*)GetParent(); }
|
PCB_BASE_FRAME* Parent() { return (PCB_BASE_FRAME*)GetParent(); }
|
||||||
|
|
||||||
|
BOARD* GetBoard();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReloadRequest
|
* Function ReloadRequest
|
||||||
* must be called when reloading data from Pcbnew is needed
|
* must be called when reloading data from Pcbnew is needed
|
||||||
|
@ -93,8 +100,10 @@ public:
|
||||||
* Function NewDisplay
|
* Function NewDisplay
|
||||||
* Rebuild the display list.
|
* Rebuild the display list.
|
||||||
* must be called when 3D opengl data is modified
|
* must be called when 3D opengl data is modified
|
||||||
|
* @param aGlList = the list to rebuild.
|
||||||
|
* if 0 (default) all lists are rebuilt
|
||||||
*/
|
*/
|
||||||
void NewDisplay();
|
void NewDisplay( GLuint aGlList = 0 );
|
||||||
|
|
||||||
void SetDefaultFileName(const wxString &aFn) { m_defaultFileName = aFn; }
|
void SetDefaultFileName(const wxString &aFn) { m_defaultFileName = aFn; }
|
||||||
const wxString &GetDefaultFileName() const { return m_defaultFileName; }
|
const wxString &GetDefaultFileName() const { return m_defaultFileName; }
|
||||||
|
@ -121,8 +130,9 @@ private:
|
||||||
// to the current display options
|
// to the current display options
|
||||||
void ReCreateMainToolbar();
|
void ReCreateMainToolbar();
|
||||||
void SetToolbars();
|
void SetToolbars();
|
||||||
void GetSettings();
|
|
||||||
void SaveSettings();
|
void LoadSettings( wxConfigBase* aCfg ); // overload virtual
|
||||||
|
void SaveSettings( wxConfigBase* aCfg ); // overload virtual
|
||||||
|
|
||||||
// Other functions
|
// Other functions
|
||||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
|
|
|
@ -74,7 +74,6 @@ enum DISPLAY3D_FLG {
|
||||||
FL_LAST
|
FL_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class INFO3D_VISU
|
class INFO3D_VISU
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
class S3D_MASTER;
|
class S3D_MASTER;
|
||||||
class S3D_VERTEX;
|
class S3D_VERTEX;
|
||||||
|
|
||||||
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
extern void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||||
|
|
||||||
class S3D_MODEL_PARSER;
|
class S3D_MODEL_PARSER;
|
||||||
class X3D_MODEL_PARSER;
|
class X3D_MODEL_PARSER;
|
||||||
|
|
|
@ -519,8 +519,12 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
|
||||||
vertices.push_back( vertex );
|
vertices.push_back( vertex );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetMaster()->Set_Object_Coords( vertices );
|
if( GetMaster()->IsOpenGlAllowed() )
|
||||||
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
|
{
|
||||||
|
GetMaster()->ObjectCoordsTo3DUnits( vertices );
|
||||||
|
TransfertToGLlist( vertices, vrmlunits_to_3Dunits );
|
||||||
|
}
|
||||||
|
|
||||||
vertices.clear();
|
vertices.clear();
|
||||||
coordIndex.clear();
|
coordIndex.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,8 +479,11 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||||
vertices.push_back( triplets.at( *id ) );
|
vertices.push_back( triplets.at( *id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetMaster()->Set_Object_Coords( vertices );
|
if( GetMaster()->IsOpenGlAllowed() )
|
||||||
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
|
{
|
||||||
|
GetMaster()->ObjectCoordsTo3DUnits( vertices );
|
||||||
|
TransfertToGLlist( vertices, vrmlunits_to_3Dunits );
|
||||||
|
}
|
||||||
|
|
||||||
vertices.clear();
|
vertices.clear();
|
||||||
coordIndex.clear();
|
coordIndex.clear();
|
||||||
|
|
|
@ -23,8 +23,9 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
|
||||||
# reports.
|
# reports.
|
||||||
#
|
#
|
||||||
|
|
||||||
option( USE_KIWAY_DLLS
|
#option( USE_KIWAY_DLLS "Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." ON )
|
||||||
"Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." OFF )
|
set( USE_KIWAY_DLLS true ) # this is now mandatory, the code is the same anyways, the old code is gone.
|
||||||
|
|
||||||
|
|
||||||
# The desire is to migrate designs *away from* case independence, and to create designs which use
|
# The desire is to migrate designs *away from* case independence, and to create designs which use
|
||||||
# literally (case specific) interpreted component names. But for backwards compatibility,
|
# literally (case specific) interpreted component names. But for backwards compatibility,
|
||||||
|
@ -81,7 +82,7 @@ mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost.
|
||||||
# when not defined by user, the default is python.exe under Windows and python2 for others
|
# when not defined by user, the default is python.exe under Windows and python2 for others
|
||||||
# python binary file should be is exec path.
|
# python binary file should be is exec path.
|
||||||
|
|
||||||
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF )
|
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
|
||||||
|
|
||||||
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
|
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
|
||||||
set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." )
|
set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." )
|
||||||
|
@ -115,6 +116,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
OUTPUT_VARIABLE GCC_VERSION
|
OUTPUT_VARIABLE GCC_VERSION
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||||
|
|
||||||
|
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
set( TO_LINKER -XLinker )
|
||||||
|
else()
|
||||||
|
set( TO_LINKER -Wl )
|
||||||
|
endif()
|
||||||
|
|
||||||
# Establish -Wall early, so specialized relaxations of this may come
|
# Establish -Wall early, so specialized relaxations of this may come
|
||||||
# subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
|
# subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
|
||||||
set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
|
set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
|
||||||
|
@ -150,10 +157,17 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package( OpenMP QUIET )
|
find_package( OpenMP QUIET )
|
||||||
|
|
||||||
if( OPENMP_FOUND )
|
if( OPENMP_FOUND )
|
||||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||||
add_definitions( -DUSE_OPENMP )
|
add_definitions( -DUSE_OPENMP )
|
||||||
|
|
||||||
|
# MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
|
||||||
|
# set it either. Not sure this is the most elegant solution but it works.
|
||||||
|
if( MINGW )
|
||||||
|
set( OPENMP_LIBRARIES gomp )
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( MINGW )
|
if( MINGW )
|
||||||
|
@ -189,19 +203,14 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
|
||||||
|
|
||||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|
||||||
set( TO_LINKER -XLinker )
|
|
||||||
else()
|
|
||||||
set( TO_LINKER -Wl )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
|
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
|
||||||
if( NOT APPLE )
|
if( NOT APPLE )
|
||||||
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||||
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||||
|
|
||||||
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# quiet GCC while in boost
|
# quiet GCC while in boost
|
||||||
|
@ -215,16 +224,16 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
|
||||||
|
|
||||||
# Allows .dylib relocation in the future
|
# Allows .dylib relocation in the future - needed by fixbundle
|
||||||
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
|
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
|
||||||
|
|
||||||
if( NOT CMAKE_CXX_COMPILER )
|
if( NOT CMAKE_CXX_COMPILER )
|
||||||
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
|
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
|
||||||
endif( NOT CMAKE_CXX_COMPILER )
|
endif()
|
||||||
|
|
||||||
if( NOT CMAKE_CXX_COMPILER )
|
if( NOT CMAKE_CXX_COMPILER )
|
||||||
EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
|
EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
|
||||||
endif( NOT CMAKE_CXX_COMPILER )
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -340,7 +349,7 @@ include( ExternalProject )
|
||||||
include( CheckFindPackageResult )
|
include( CheckFindPackageResult )
|
||||||
|
|
||||||
# Turn on wxWidgets compatibility mode for some classes
|
# Turn on wxWidgets compatibility mode for some classes
|
||||||
add_definitions(-DWX_COMPATIBILITY)
|
add_definitions( -DWX_COMPATIBILITY )
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Find OpenGL library #
|
# Find OpenGL library #
|
||||||
|
@ -348,6 +357,12 @@ add_definitions(-DWX_COMPATIBILITY)
|
||||||
find_package( OpenGL QUIET )
|
find_package( OpenGL QUIET )
|
||||||
check_find_package_result( OPENGL_FOUND "OpenGL" )
|
check_find_package_result( OPENGL_FOUND "OpenGL" )
|
||||||
|
|
||||||
|
# Dick 5-Feb-2014:
|
||||||
|
# Marco: We cannot use both ExternalProject_Add() add and find_package()
|
||||||
|
# in the same CMake tree and have them both reference the same package:
|
||||||
|
# http://stackoverflow.com/questions/6351609/cmake-linking-to-library-downloaded-from-externalproject-add
|
||||||
|
# https://www.mail-archive.com/cmake@cmake.org/msg47501.html
|
||||||
|
|
||||||
# Handle target used to specify if a target needs wx-widgets or other libraries
|
# Handle target used to specify if a target needs wx-widgets or other libraries
|
||||||
# Always defined, empty if no libraries are to be build
|
# Always defined, empty if no libraries are to be build
|
||||||
add_custom_target( lib-dependencies )
|
add_custom_target( lib-dependencies )
|
||||||
|
@ -380,8 +395,8 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
|
||||||
|
|
||||||
|
|
||||||
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
|
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
|
||||||
|
|
||||||
message(STATUS "Scripting ENABLED")
|
message(STATUS "Scripting ENABLED")
|
||||||
include( download_wxpython )
|
include( download_wxpython )
|
||||||
|
|
||||||
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
|
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
|
||||||
|
@ -439,14 +454,18 @@ endif( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC)
|
||||||
#####################
|
#####################
|
||||||
# Find GLEW library #
|
# Find GLEW library #
|
||||||
#####################
|
#####################
|
||||||
find_package(GLEW)
|
if( NOT GLEW_FOUND )
|
||||||
check_find_package_result(GLEW_FOUND "GLEW")
|
find_package( GLEW )
|
||||||
|
check_find_package_result( GLEW_FOUND "GLEW" )
|
||||||
|
endif()
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Find Cairo library #
|
# Find Cairo library #
|
||||||
######################
|
######################
|
||||||
find_package(Cairo 1.8.1 QUIET)
|
if( NOT CAIRO_FOUND )
|
||||||
check_find_package_result(CAIRO_FOUND "Cairo")
|
find_package( Cairo 1.8.1 QUIET )
|
||||||
|
check_find_package_result( CAIRO_FOUND "Cairo" )
|
||||||
|
endif()
|
||||||
|
|
||||||
# Download boost and possibly build parts of it
|
# Download boost and possibly build parts of it
|
||||||
#################################################
|
#################################################
|
||||||
|
@ -458,6 +477,8 @@ if( KICAD_SKIP_BOOST )
|
||||||
message( FATAL_ERROR "Boost 1.54+ libraries are required." )
|
message( FATAL_ERROR "Boost 1.54+ libraries are required." )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_custom_target( boost ) # it is required to meet some further dependencies
|
||||||
|
|
||||||
message( WARNING "
|
message( WARNING "
|
||||||
WARNING: You decided to skip building boost library.
|
WARNING: You decided to skip building boost library.
|
||||||
KiCad developers strongly advise you to build the bundled boost library, as it is known to work with KiCad.
|
KiCad developers strongly advise you to build the bundled boost library, as it is known to work with KiCad.
|
||||||
|
@ -482,8 +503,8 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
if( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
||||||
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
|
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
|
||||||
endif( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
endif()
|
||||||
|
|
||||||
# Include wxWidgets macros.
|
# Include wxWidgets macros.
|
||||||
include( ${wxWidgets_USE_FILE} )
|
include( ${wxWidgets_USE_FILE} )
|
||||||
|
@ -531,15 +552,15 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||||
set( PythonInterp_FIND_VERSION 2.6 )
|
set( PythonInterp_FIND_VERSION 2.6 )
|
||||||
set( PythonLibs_FIND_VERSION 2.6 )
|
set( PythonLibs_FIND_VERSION 2.6 )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# force a python version < 3.0
|
# force a python version < 3.0
|
||||||
set( PythonInterp_FIND_VERSION 2.6)
|
set( PythonInterp_FIND_VERSION 2.6)
|
||||||
set( PythonLibs_FIND_VERSION 2.6 )
|
set( PythonLibs_FIND_VERSION 2.6 )
|
||||||
|
|
||||||
find_package( PythonInterp )
|
find_package( PythonInterp )
|
||||||
|
|
||||||
check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
||||||
|
|
||||||
if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
|
if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
|
||||||
message( FATAL_ERROR "Python 2.x is required." )
|
message( FATAL_ERROR "Python 2.x is required." )
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -59,7 +59,9 @@ set( BOOST_LIBS_BUILT
|
||||||
)
|
)
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
if( NOT BZIP2_FOUND )
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
|
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
|
||||||
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
|
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
|
||||||
|
@ -99,7 +101,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if( MINGW )
|
if( MINGW AND NOT CMAKE_HOST_UNIX ) # building for MINGW on windows not UNIX
|
||||||
if( MSYS )
|
if( MSYS )
|
||||||
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
|
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
|
||||||
# bootstrap.bat with cmd.exe does. It's ugly but it works. At least for Boost
|
# bootstrap.bat with cmd.exe does. It's ugly but it works. At least for Boost
|
||||||
|
@ -113,14 +115,16 @@ if( MINGW )
|
||||||
set( b2_libs ${b2_libs} --with-${lib} )
|
set( b2_libs ${b2_libs} --with-${lib} )
|
||||||
endforeach()
|
endforeach()
|
||||||
unset( BOOST_CFLAGS )
|
unset( BOOST_CFLAGS )
|
||||||
|
|
||||||
else()
|
else()
|
||||||
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
|
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
|
||||||
#message( STATUS "libs_csv:${libs_csv}" )
|
#message( STATUS "libs_csv:${libs_csv}" )
|
||||||
|
|
||||||
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
|
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
|
||||||
# pass to *both* C and C++ compilers
|
# pass to *both* C and C++ compilers
|
||||||
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
||||||
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
set( BOOST_CXXFLAGS "cxxflags=${PIC_FLAG}" )
|
||||||
|
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
||||||
unset( b2_libs )
|
unset( b2_libs )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@ set( CAIRO_ROOT "${PROJECT_SOURCE_DIR}/cairo_root" )
|
||||||
|
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
if( NOT BZIP2_FOUND )
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( PREFIX ${DOWNLOAD_DIR}/cairo )
|
set( PREFIX ${DOWNLOAD_DIR}/cairo )
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ if ( KICAD_BUILD_STATIC )
|
||||||
endif( KICAD_BUILD_STATIC )
|
endif( KICAD_BUILD_STATIC )
|
||||||
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|
||||||
set( CAIRO_CFLAGS "CFLAGS=" )
|
set( CAIRO_CFLAGS "CFLAGS=" )
|
||||||
set( CAIRO_LDFLAGS "LDFLAGS=-framework CoreServices -framework Cocoa" )
|
set( CAIRO_LDFLAGS "LDFLAGS=-framework CoreServices -framework Cocoa" )
|
||||||
|
@ -94,8 +96,14 @@ ExternalProject_Add( cairo
|
||||||
|
|
||||||
#BINARY_DIR "${PREFIX}"
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
BUILD_COMMAND $(MAKE)
|
BUILD_COMMAND $(MAKE)
|
||||||
|
|
||||||
INSTALL_DIR "${CAIRO_ROOT}"
|
INSTALL_DIR "${CAIRO_ROOT}"
|
||||||
INSTALL_COMMAND $(MAKE) install
|
INSTALL_COMMAND $(MAKE) install
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# match these with whatever FindCairo.cmake sets
|
||||||
|
# Dick i'vent set it because /lib and /lib64 issue in non multiarch binaries OSs
|
||||||
|
#set( CAIRO_FOUND true )
|
||||||
|
set( CAIRO_INCLUDE_DIR ${CAIRO_ROOT}/include )
|
||||||
|
set( CAIRO_LIBRARIES ${CAIRO_ROOT}/lib )
|
||||||
|
|
|
@ -33,11 +33,13 @@ set( GLEW_ROOT "${PROJECT_SOURCE_DIR}/glew_root" )
|
||||||
|
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
if( NOT BZIP2_FOUND )
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( PREFIX ${DOWNLOAD_DIR}/glew )
|
set( PREFIX ${DOWNLOAD_DIR}/glew )
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
if( CMAKE_OSX_ARCHITECTURES )
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
set( GLEW_CFLAGS "CFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
set( GLEW_CFLAGS "CFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||||
set( GLEW_LDFLAGS "LDFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
set( GLEW_LDFLAGS "LDFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||||
|
|
|
@ -33,13 +33,15 @@ set( PIXMAN_ROOT "${PROJECT_SOURCE_DIR}/pixman_root" )
|
||||||
|
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
if( NOT BZIP2_FOUND )
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( PREFIX ${DOWNLOAD_DIR}/pixman )
|
set( PREFIX ${DOWNLOAD_DIR}/pixman )
|
||||||
|
|
||||||
set(PIXMAN_CPPFLAGS "CFLAGS=")
|
set(PIXMAN_CPPFLAGS "CFLAGS=")
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
if( CMAKE_OSX_ARCHITECTURES )
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
set(PIXMAN_CPPFLAGS "${PIXMAN_CPPFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
|
set(PIXMAN_CPPFLAGS "${PIXMAN_CPPFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -33,7 +33,9 @@ set( PKGCONFIG_ROOT "${PROJECT_SOURCE_DIR}/pkgconfig_root" )
|
||||||
|
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
if( NOT BZIP2_FOUND )
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( PREFIX ${DOWNLOAD_DIR}/pkgconfig )
|
set( PREFIX ${DOWNLOAD_DIR}/pkgconfig )
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,10 @@ if (APPLE)
|
||||||
STRING(REGEX REPLACE " -arch " "," LIBWXPYTHON_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
STRING(REGEX REPLACE " -arch " "," LIBWXPYTHON_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
||||||
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_arch=${LIBWXPYTHON_ARCHITECTURES})
|
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_arch=${LIBWXPYTHON_ARCHITECTURES})
|
||||||
endif( CMAKE_OSX_ARCHITECTURES )
|
endif( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
|
||||||
|
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
SET( LIBWXPYTHON_PRECMD export CFLAGS=-Qunused-arguments && )
|
||||||
|
endif()
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
if ( KICAD_BUILD_STATIC )
|
if ( KICAD_BUILD_STATIC )
|
||||||
|
@ -74,7 +78,7 @@ ExternalProject_Add( libwxpython
|
||||||
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWXPYTHON_ROOT}"
|
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWXPYTHON_ROOT}"
|
||||||
COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --clean
|
COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --clean
|
||||||
|
|
||||||
CONFIGURE_COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --prefix=${LIBWXPYTHON_ROOT} --unicode --install ${LIBWXPYTHON_OPTS}
|
CONFIGURE_COMMAND ${LIBWXPYTHON_PRECMD} ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --prefix=${LIBWXPYTHON_ROOT} --unicode --install ${LIBWXPYTHON_OPTS}
|
||||||
|
|
||||||
#BINARY_DIR "${PREFIX}"
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,13 @@ set( LIBWX_ROOT "${PROJECT_SOURCE_DIR}/libwx_root" )
|
||||||
|
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
if( NOT BZIP2_FOUND )
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( PREFIX ${DOWNLOAD_DIR}/libwx )
|
set( PREFIX ${DOWNLOAD_DIR}/libwx )
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
if( CMAKE_OSX_ARCHITECTURES )
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
STRING(REGEX REPLACE " -arch " "," LIBWX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
STRING(REGEX REPLACE " -arch " "," LIBWX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
||||||
SET( LIBWX_ARCHITECTURES --enable-universal_binary=${LIBWX_ARCHITECTURES})
|
SET( LIBWX_ARCHITECTURES --enable-universal_binary=${LIBWX_ARCHITECTURES})
|
||||||
|
@ -80,7 +82,7 @@ ExternalProject_Add( libwx
|
||||||
#SET directories
|
#SET directories
|
||||||
set(wxWidgets_BIN_DIR ${LIBWX_ROOT}/bin)
|
set(wxWidgets_BIN_DIR ${LIBWX_ROOT}/bin)
|
||||||
set(wxWidgets_CONFIG_EXECUTABLE ${LIBWX_ROOT}/bin/wx-config)
|
set(wxWidgets_CONFIG_EXECUTABLE ${LIBWX_ROOT}/bin/wx-config)
|
||||||
set(wxWidgets_INCLUDE_DIRS ${LIBWX_ROOT}/include)
|
set(wxWidgets_INCLUDE_DIRS ${LIBWX_ROOT}/include)
|
||||||
set(wxWidgets_LIBRARY_DIRS ${LIBWX_ROOT}/lib)
|
set(wxWidgets_LIBRARY_DIRS ${LIBWX_ROOT}/lib)
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ ExternalProject_Add_Step( libwx bzr_init_libwx
|
||||||
######
|
######
|
||||||
|
|
||||||
ExternalProject_Add_Step( libwx libwx_recursive_message
|
ExternalProject_Add_Step( libwx libwx_recursive_message
|
||||||
COMMAND cmake .
|
COMMAND cmake .
|
||||||
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
|
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
|
||||||
DEPENDEES install
|
DEPENDEES install
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
KIWAY Build Symbols, Definitions and Intentions
|
||||||
|
|
||||||
|
|
||||||
|
COMPILING_DLL:
|
||||||
|
|
||||||
|
This is a signal to import_export.h, and when present, toggles the
|
||||||
|
interpretation of the #defines in that file. Its purpose should not be
|
||||||
|
extended beyond this.
|
||||||
|
|
||||||
|
|
||||||
|
USE_KIWAY_DLLS:
|
||||||
|
|
||||||
|
Comes from CMake as a user configuration variable, settable in the Cmake
|
||||||
|
user interface. It decides if KiCad will be built with the *.kiface program
|
||||||
|
modules.
|
||||||
|
|
||||||
|
|
||||||
|
BUILD_KIWAY_DLL:
|
||||||
|
|
||||||
|
Comes from CMake, but at the 2nd tier, not the top tier. By 2nd tier,
|
||||||
|
something like pcbnew/CMakeLists.txt, not /CMakeLists.txt is meant. It is
|
||||||
|
not a user configuration variable. Instead, the 2nd tier CMakeLists.txt file
|
||||||
|
looks at the top level USE_KIWAY_DLLS and decides how the object files under
|
||||||
|
the 2nd tier's control will be built. If it decides it wants to march in
|
||||||
|
lockstep with USE_KIWAY_DLLS, then this local CMakeLists.txt file may pass a
|
||||||
|
defined BUILD_KIWAY_DLL (singular) on the compiler command line to the
|
||||||
|
pertinent set of compilation steps under its control.
|
||||||
|
|
|
@ -5,8 +5,7 @@ Last Revised: 28-Feb-2010
|
||||||
Kicad needs wxWidgets, the multi platform G.U.I.
|
Kicad needs wxWidgets, the multi platform G.U.I.
|
||||||
Known problems:
|
Known problems:
|
||||||
wxMSW:
|
wxMSW:
|
||||||
*DO NOT* use wxMSW.2.8.1
|
use *only* wxWidgets >= 3.0
|
||||||
in fact: use wxWidgets >= 2.9.3
|
|
||||||
|
|
||||||
wxGTK
|
wxGTK
|
||||||
Use wxWidgets 2.8.10 or later
|
Use wxWidgets 2.8.10 or later
|
||||||
|
@ -21,15 +20,6 @@ So use a very recent version (>= 2.8.10 (that also solve other bugs)
|
||||||
wxWidgets patch:
|
wxWidgets patch:
|
||||||
|
|
||||||
|
|
||||||
wxMSW, version 2.8.x
|
|
||||||
Some zoom values smaller than 3 to 5 create artifacts on screen, mainly values < 1.
|
|
||||||
(corresponding to draw scale factor > 1 )
|
|
||||||
|
|
||||||
See http://trac.wxwidgets.org/ticket/9554 (and 11669).
|
|
||||||
|
|
||||||
This is fixed in version 2.9.3
|
|
||||||
|
|
||||||
|
|
||||||
wxWidgets 2.9.1 (all platforms)
|
wxWidgets 2.9.1 (all platforms)
|
||||||
Has a problem when using the built in string to double conversion:
|
Has a problem when using the built in string to double conversion:
|
||||||
In countries using a comm instead of a point as floating number separator
|
In countries using a comm instead of a point as floating number separator
|
||||||
|
@ -41,7 +31,7 @@ Use a version >= 2.9.3
|
||||||
|
|
||||||
|
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
wxGTK version: All
|
wxGTK version: All before wxWidgets 3.0
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
Patch for printing wide traces that were shown with missing rounded end caps.
|
Patch for printing wide traces that were shown with missing rounded end caps.
|
||||||
Without this patch, printing boards and schematics under Linux, and perhaps OSX
|
Without this patch, printing boards and schematics under Linux, and perhaps OSX
|
||||||
|
@ -57,3 +47,10 @@ Add after this line:
|
||||||
PsPrint( "1 setlinecap\n" );
|
PsPrint( "1 setlinecap\n" );
|
||||||
PsPrint("%%EndSetup\n");
|
PsPrint("%%EndSetup\n");
|
||||||
|
|
||||||
|
|
||||||
|
Known bug on Windows:
|
||||||
|
Postscript printers print tracks like tin line.
|
||||||
|
It happens only for PS drivers, and PDF printer.
|
||||||
|
Other drivers (PCL for instance) work fine,
|
||||||
|
so it is unlikely a bug inside Kicad/wxWidgets
|
||||||
|
|
||||||
|
|
12
TODO.txt
12
TODO.txt
|
@ -62,7 +62,11 @@ PCBNew
|
||||||
|
|
||||||
Dick's Final TODO List:
|
Dick's Final TODO List:
|
||||||
======================
|
======================
|
||||||
*) Get licensing cleaned up.
|
*) Get licensing cleaned up.
|
||||||
*) DLL-ization of pcbnew & eeschema
|
|
||||||
http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
|
*) DLL-ization of pcbnew & eeschema
|
||||||
https://blueprints.launchpad.net/kicad/+spec/modular-kicad
|
http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
|
||||||
|
https://blueprints.launchpad.net/kicad/+spec/modular-kicad
|
||||||
|
|
||||||
|
Issues as a result of minimal testing:
|
||||||
|
Kicad project manager will crash when requesting help file.
|
||||||
|
|
|
@ -1,53 +1,68 @@
|
||||||
|
|
||||||
include_directories(BEFORE ${INC_BEFORE})
|
include_directories( BEFORE ${INC_BEFORE} )
|
||||||
include_directories(
|
include_directories(
|
||||||
../potrace
|
../potrace
|
||||||
../common
|
../common
|
||||||
${INC_AFTER}
|
${INC_AFTER}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(BITMAP2COMPONENT_SRCS
|
set( BITMAP2COMPONENT_SRCS
|
||||||
|
../common/single_top.cpp
|
||||||
bitmap2component.cpp
|
bitmap2component.cpp
|
||||||
bitmap2cmp_gui_base
|
bitmap2cmp_gui_base
|
||||||
bitmap2cmp_gui
|
bitmap2cmp_gui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||||
if(MINGW)
|
COMPILE_DEFINITIONS "TOP_FRAME=0"
|
||||||
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
|
)
|
||||||
mingw_resource_compiler(bitmap2component)
|
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
|
||||||
else(MINGW)
|
COMPILE_DEFINITIONS "COMPILING_DLL"
|
||||||
set(BITMAP2COMPONENT_RESOURCES bitmap2component.rc)
|
)
|
||||||
endif(MINGW)
|
|
||||||
endif(WIN32)
|
add_executable( bitmap2component WIN32 MACOSX_BUNDLE
|
||||||
|
${BITMAP2COMPONENT_SRCS}
|
||||||
|
${BITMAP2COMPONENT_RESOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries( bitmap2component
|
||||||
|
common
|
||||||
|
polygon
|
||||||
|
bitmaps
|
||||||
|
${wxWidgets_LIBRARIES}
|
||||||
|
potrace
|
||||||
|
)
|
||||||
|
|
||||||
|
install( TARGETS bitmap2component
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if(APPLE)
|
if( false ) # linker map with cross reference
|
||||||
set(BITMAP2COMPONENT_RESOURCES bitmap2component.icns)
|
set_target_properties( bitmap2component PROPERTIES
|
||||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns"
|
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=bitmap2component.map"
|
||||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
)
|
||||||
set(MACOSX_BUNDLE_ICON_FILE bitmap2component.icns)
|
endif()
|
||||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.bitmap2component)
|
|
||||||
endif(APPLE)
|
|
||||||
|
|
||||||
|
|
||||||
|
if( MINGW )
|
||||||
add_executable(bitmap2component WIN32 MACOSX_BUNDLE
|
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
|
||||||
${BITMAP2COMPONENT_SRCS}
|
mingw_resource_compiler( bitmap2component )
|
||||||
${BITMAP2COMPONENT_RESOURCES})
|
else()
|
||||||
|
set( BITMAP2COMPONENT_RESOURCES bitmap2component.rc )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(APPLE)
|
if( APPLE )
|
||||||
set_target_properties(bitmap2component PROPERTIES MACOSX_BUNDLE_INFO_PLIST
|
set( BITMAP2COMPONENT_RESOURCES bitmap2component.icns )
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns" PROPERTIES
|
||||||
endif(APPLE)
|
MACOSX_PACKAGE_LOCATION Resources
|
||||||
|
)
|
||||||
target_link_libraries( bitmap2component common polygon bitmaps
|
set( MACOSX_BUNDLE_ICON_FILE bitmap2component.icns )
|
||||||
${wxWidgets_LIBRARIES}
|
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.bitmap2component )
|
||||||
potrace
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS bitmap2component
|
|
||||||
DESTINATION ${KICAD_BIN}
|
|
||||||
COMPONENT binary)
|
|
||||||
|
|
||||||
|
set_target_properties( bitmap2component PROPERTIES
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
|
@ -21,16 +21,15 @@
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <macros.h>
|
||||||
|
|
||||||
|
#include <pgm_base.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
|
||||||
#include <wx/wx.h>
|
|
||||||
#include <wx/config.h>
|
|
||||||
#include <wx/filename.h>
|
|
||||||
|
|
||||||
#include <bitmap2cmp_gui_base.h>
|
#include <bitmap2cmp_gui_base.h>
|
||||||
|
|
||||||
#include <potracelib.h>
|
#include <potracelib.h>
|
||||||
|
@ -39,47 +38,57 @@
|
||||||
#include <colors_selection.h>
|
#include <colors_selection.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
|
#include <kiway.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
|
|
||||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||||
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
||||||
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
||||||
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
||||||
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
||||||
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
||||||
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
|
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
|
||||||
|
|
||||||
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFormat );
|
#define DEFAULT_DPI 300 // Default resolution in Bit per inches
|
||||||
|
|
||||||
/* Class BM2CMP_FRAME_BASE
|
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||||
This is the main frame for this application
|
int aFormat, int aDpi_X, int aDpi_Y );
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Class BM2CMP_FRAME_BASE
|
||||||
|
* is the main frame for this application
|
||||||
|
*/
|
||||||
class BM2CMP_FRAME : public BM2CMP_FRAME_BASE
|
class BM2CMP_FRAME : public BM2CMP_FRAME_BASE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
wxImage m_Pict_Image;
|
wxImage m_Pict_Image;
|
||||||
wxBitmap m_Pict_Bitmap;
|
wxBitmap m_Pict_Bitmap;
|
||||||
wxImage m_Greyscale_Image;
|
wxImage m_Greyscale_Image;
|
||||||
wxBitmap m_Greyscale_Bitmap;
|
wxBitmap m_Greyscale_Bitmap;
|
||||||
wxImage m_NB_Image;
|
wxImage m_NB_Image;
|
||||||
wxBitmap m_BN_Bitmap;
|
wxBitmap m_BN_Bitmap;
|
||||||
wxString m_BitmapFileName;
|
wxSize m_imageDPI; // The initial image resolution. When unknown,
|
||||||
wxString m_ConvertedFileName;
|
// set to DEFAULT_DPI x DEFAULT_DPI per Inch
|
||||||
wxSize m_FrameSize;
|
wxString m_BitmapFileName;
|
||||||
wxPoint m_FramePos;
|
wxString m_ConvertedFileName;
|
||||||
wxConfig * m_Config;
|
wxSize m_frameSize;
|
||||||
|
wxPoint m_framePos;
|
||||||
|
wxConfig* m_config;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BM2CMP_FRAME();
|
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||||
~BM2CMP_FRAME();
|
~BM2CMP_FRAME();
|
||||||
|
|
||||||
|
// overload KIWAY_PLAYER virtual
|
||||||
|
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl=0 );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
void OnLoadFile( wxCommandEvent& event );
|
void OnLoadFile( wxCommandEvent& event );
|
||||||
bool LoadFile( wxString& aFullFileName );
|
|
||||||
void OnExport( wxCommandEvent& event );
|
void OnExport( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,30 +118,51 @@ private:
|
||||||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||||
void OnOptionsSelection( wxCommandEvent& event );
|
void OnOptionsSelection( wxCommandEvent& event );
|
||||||
void OnThresholdChange( wxScrollEvent& event );
|
void OnThresholdChange( wxScrollEvent& event );
|
||||||
|
void OnResolutionChange( wxCommandEvent& event );
|
||||||
|
|
||||||
|
// called when texts controls which handle the image resolution
|
||||||
|
// lose the focus, to ensure the rigyht vaules are displayed
|
||||||
|
// because the m_imageDPI are clipped to acceptable values, and
|
||||||
|
// the text displayed could be differ duringa text edition
|
||||||
|
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
||||||
|
void UpdateDPITextValueX( wxMouseEvent& event )
|
||||||
|
{
|
||||||
|
m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
|
||||||
|
}
|
||||||
|
void UpdateDPITextValueY( wxMouseEvent& event )
|
||||||
|
{
|
||||||
|
m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
|
||||||
|
}
|
||||||
|
|
||||||
void NegateGreyscaleImage( );
|
void NegateGreyscaleImage( );
|
||||||
void ExportFile( FILE* aOutfile, int aFormat );
|
void ExportFile( FILE* aOutfile, int aFormat );
|
||||||
|
void updateImageInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
|
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
BM2CMP_FRAME_BASE( aParent )
|
||||||
{
|
{
|
||||||
|
SetKiway( this, aKiway );
|
||||||
|
|
||||||
int tmp;
|
int tmp;
|
||||||
m_Config = new wxConfig();
|
m_config = new wxConfig();
|
||||||
m_Config->Read( KEYWORD_FRAME_POSX, & m_FramePos.x, -1 );
|
m_config->Read( KEYWORD_FRAME_POSX, & m_framePos.x, -1 );
|
||||||
m_Config->Read( KEYWORD_FRAME_POSY, & m_FramePos.y, -1 );
|
m_config->Read( KEYWORD_FRAME_POSY, & m_framePos.y, -1 );
|
||||||
m_Config->Read( KEYWORD_FRAME_SIZEX, & m_FrameSize.x, -1 );
|
m_config->Read( KEYWORD_FRAME_SIZEX, & m_frameSize.x, -1 );
|
||||||
m_Config->Read( KEYWORD_FRAME_SIZEY, & m_FrameSize.y, -1 );
|
m_config->Read( KEYWORD_FRAME_SIZEY, & m_frameSize.y, -1 );
|
||||||
m_Config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName );
|
m_config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName );
|
||||||
m_Config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName );
|
m_config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName );
|
||||||
if( m_Config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) )
|
|
||||||
|
if( m_config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) )
|
||||||
m_sliderThreshold->SetValue( tmp );
|
m_sliderThreshold->SetValue( tmp );
|
||||||
if( m_Config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
|
|
||||||
|
if( m_config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
|
||||||
m_rbOptions->SetSelection( tmp ? 1 : 0 );
|
m_rbOptions->SetSelection( tmp ? 1 : 0 );
|
||||||
|
|
||||||
m_Config->Read( KEYWORD_LAST_FORMAT, &tmp );
|
m_config->Read( KEYWORD_LAST_FORMAT, &tmp );
|
||||||
m_radioBoxFormat->SetSelection( tmp );
|
m_radioBoxFormat->SetSelection( tmp );
|
||||||
|
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
icon.CopyFromBitmap( KiBitmap( icon_bitmap2component_xpm ) );
|
icon.CopyFromBitmap( KiBitmap( icon_bitmap2component_xpm ) );
|
||||||
|
@ -140,34 +170,36 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
|
||||||
|
|
||||||
GetSizer()->SetSizeHints( this );
|
GetSizer()->SetSizeHints( this );
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||||
|
|
||||||
m_buttonExport->Enable( false );
|
m_buttonExport->Enable( false );
|
||||||
|
|
||||||
if ( m_FramePos == wxDefaultPosition )
|
m_imageDPI.x = m_imageDPI.y = DEFAULT_DPI; // Default resolution in Bit per inches
|
||||||
|
|
||||||
|
if ( m_framePos == wxDefaultPosition )
|
||||||
Centre();
|
Centre();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BM2CMP_FRAME::~BM2CMP_FRAME()
|
BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||||
{
|
{
|
||||||
if( ( m_Config == NULL ) || IsIconized() )
|
if( !m_config || IsIconized() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_FrameSize = GetSize();
|
m_frameSize = GetSize();
|
||||||
m_FramePos = GetPosition();
|
m_framePos = GetPosition();
|
||||||
|
|
||||||
m_Config->Write( KEYWORD_FRAME_POSX, (long) m_FramePos.x );
|
m_config->Write( KEYWORD_FRAME_POSX, (long) m_framePos.x );
|
||||||
m_Config->Write( KEYWORD_FRAME_POSY, (long) m_FramePos.y );
|
m_config->Write( KEYWORD_FRAME_POSY, (long) m_framePos.y );
|
||||||
m_Config->Write( KEYWORD_FRAME_SIZEX, (long) m_FrameSize.x );
|
m_config->Write( KEYWORD_FRAME_SIZEX, (long) m_frameSize.x );
|
||||||
m_Config->Write( KEYWORD_FRAME_SIZEY, (long) m_FrameSize.y );
|
m_config->Write( KEYWORD_FRAME_SIZEY, (long) m_frameSize.y );
|
||||||
m_Config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
m_config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
||||||
m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
m_config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||||
m_Config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
m_config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||||
m_Config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
|
m_config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
|
||||||
m_Config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
m_config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
||||||
|
|
||||||
delete m_Config;
|
delete m_config;
|
||||||
|
|
||||||
/* This needed for OSX: avoids further OnDraw processing after this
|
/* This needed for OSX: avoids further OnDraw processing after this
|
||||||
* destructor and before the native window is destroyed
|
* destructor and before the native window is destroyed
|
||||||
|
@ -207,23 +239,24 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
||||||
*/
|
*/
|
||||||
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn(m_BitmapFileName);
|
wxFileName fn( m_BitmapFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists(path) )
|
||||||
path = wxGetCwd();
|
path = wxGetCwd();
|
||||||
|
|
||||||
wxFileDialog FileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||||
_( "Image Files " ) + wxImage::GetImageExtWildcard(),
|
_( "Image Files " ) + wxImage::GetImageExtWildcard(),
|
||||||
wxFD_OPEN );
|
wxFD_OPEN );
|
||||||
int diag = FileDlg.ShowModal();
|
|
||||||
|
int diag = fileDlg.ShowModal();
|
||||||
|
|
||||||
if( diag != wxID_OK )
|
if( diag != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString fullFilename = FileDlg.GetPath();
|
wxString fullFilename = fileDlg.GetPath();
|
||||||
|
|
||||||
if( ! LoadFile( fullFilename ) )
|
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_buttonExport->Enable( true );
|
m_buttonExport->Enable( true );
|
||||||
|
@ -232,13 +265,22 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||||
{
|
{
|
||||||
m_BitmapFileName = aFullFileName;
|
// Prj().MaybeLoadProjectSettings();
|
||||||
|
|
||||||
|
m_BitmapFileName = aFileSet[0];
|
||||||
|
|
||||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "Couldn't load image from <%s>" ), m_BitmapFileName.c_str() );
|
/* LoadFile has its own UI, no need for further failure notification here
|
||||||
|
wxString msg = wxString::Format(
|
||||||
|
_( "Could not load image '%s'" ),
|
||||||
|
GetChars( aFilename )
|
||||||
|
);
|
||||||
|
|
||||||
|
wxMessageBox( msg );
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,15 +288,32 @@ bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
||||||
|
|
||||||
int h = m_Pict_Bitmap.GetHeight();
|
int h = m_Pict_Bitmap.GetHeight();
|
||||||
int w = m_Pict_Bitmap.GetWidth();
|
int w = m_Pict_Bitmap.GetWidth();
|
||||||
int nb = m_Pict_Bitmap.GetDepth();
|
|
||||||
|
|
||||||
wxString msg;
|
// Determine image resolution in DPI (does not existing in all formats).
|
||||||
msg.Printf( wxT( "%d" ), w );
|
// the resolution can be given in bit per inches or bit per cm in file
|
||||||
m_SizeXValue->SetLabel(msg);
|
m_imageDPI.x = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||||
msg.Printf( wxT( "%d" ), h );
|
m_imageDPI.y = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||||
m_SizeYValue->SetLabel(msg);
|
|
||||||
msg.Printf( wxT( "%d" ), nb );
|
if( m_imageDPI.x > 1 && m_imageDPI.y > 1 )
|
||||||
m_BPPValue->SetLabel(msg);
|
{
|
||||||
|
if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
|
||||||
|
{
|
||||||
|
// When the initial resolution is given in bits per cm,
|
||||||
|
// experience shows adding 1.27 to the resolution converted in dpi
|
||||||
|
// before convert to int value reduce the conversion error
|
||||||
|
// but it is not perfect
|
||||||
|
m_imageDPI.x = m_imageDPI.x * 2.54 + 1.27;
|
||||||
|
m_imageDPI.y = m_imageDPI.y * 2.54 + 1.27;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // fallback to the default value
|
||||||
|
m_imageDPI.x = m_imageDPI.y = DEFAULT_DPI;
|
||||||
|
|
||||||
|
// Display image info:
|
||||||
|
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
||||||
|
m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
|
||||||
|
m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
|
||||||
|
updateImageInfo();
|
||||||
|
|
||||||
m_InitialPicturePanel->SetVirtualSize( w, h );
|
m_InitialPicturePanel->SetVirtualSize( w, h );
|
||||||
m_GreyscalePicturePanel->SetVirtualSize( w, h );
|
m_GreyscalePicturePanel->SetVirtualSize( w, h );
|
||||||
|
@ -262,16 +321,55 @@ bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
||||||
|
|
||||||
m_Greyscale_Image.Destroy();
|
m_Greyscale_Image.Destroy();
|
||||||
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
||||||
|
|
||||||
if( m_rbOptions->GetSelection() > 0 )
|
if( m_rbOptions->GetSelection() > 0 )
|
||||||
NegateGreyscaleImage( );
|
NegateGreyscaleImage( );
|
||||||
|
|
||||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||||
|
|
||||||
m_NB_Image = m_Greyscale_Image;
|
m_NB_Image = m_Greyscale_Image;
|
||||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BM2CMP_FRAME::updateImageInfo()
|
||||||
|
{
|
||||||
|
// Note: the image resolution text controls are not modified
|
||||||
|
// here, to avoid a race between text change when entered by user and
|
||||||
|
// a text change if it is modifed here.
|
||||||
|
int h = m_Pict_Bitmap.GetHeight();
|
||||||
|
int w = m_Pict_Bitmap.GetWidth();
|
||||||
|
int nb = m_Pict_Bitmap.GetDepth();
|
||||||
|
|
||||||
|
m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) );
|
||||||
|
m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) );
|
||||||
|
m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) );
|
||||||
|
|
||||||
|
m_SizeXValue_mm->SetLabel( wxString::Format( wxT( "%.1f" ),
|
||||||
|
(double) w / m_imageDPI.x * 25.4 ) );
|
||||||
|
m_SizeYValue_mm->SetLabel( wxString::Format( wxT( "%.1f" ),
|
||||||
|
(double) h / m_imageDPI.y * 25.4 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void BM2CMP_FRAME::OnResolutionChange( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
long tmp;
|
||||||
|
|
||||||
|
if( m_DPIValueX->GetValue().ToLong( &tmp ) )
|
||||||
|
m_imageDPI.x = tmp;
|
||||||
|
|
||||||
|
if( m_DPIValueY->GetValue().ToLong( &tmp ) )
|
||||||
|
m_imageDPI.y = tmp;
|
||||||
|
|
||||||
|
if( m_imageDPI.x < 32 )
|
||||||
|
m_imageDPI.x = 32;
|
||||||
|
|
||||||
|
if( m_imageDPI.y < 32 )
|
||||||
|
m_imageDPI.y = 32;
|
||||||
|
|
||||||
|
updateImageInfo();
|
||||||
|
}
|
||||||
|
|
||||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||||
{
|
{
|
||||||
|
@ -297,11 +395,12 @@ void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||||
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::NegateGreyscaleImage( )
|
void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||||
{
|
{
|
||||||
unsigned char pix;
|
unsigned char pix;
|
||||||
int h = m_Greyscale_Image.GetHeight();
|
int h = m_Greyscale_Image.GetHeight();
|
||||||
int w = m_Greyscale_Image.GetWidth();
|
int w = m_Greyscale_Image.GetWidth();
|
||||||
|
|
||||||
for( int y = 0; y < h; y++ )
|
for( int y = 0; y < h; y++ )
|
||||||
for( int x = 0; x < w; x++ )
|
for( int x = 0; x < w; x++ )
|
||||||
|
@ -321,58 +420,61 @@ void BM2CMP_FRAME::OnOptionsSelection( wxCommandEvent& event )
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
||||||
{
|
{
|
||||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int sel = m_radioBoxFormat->GetSelection();
|
int sel = m_radioBoxFormat->GetSelection();
|
||||||
|
|
||||||
switch( sel )
|
switch( sel )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
OnExportEeschema();
|
OnExportEeschema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
OnExportPcbnew( true );
|
OnExportPcbnew( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
OnExportPcbnew( false );
|
OnExportPcbnew( false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
OnExportPostScript();
|
OnExportPostScript();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
OnExportLogo();
|
OnExportLogo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExportLogo()
|
void BM2CMP_FRAME::OnExportLogo()
|
||||||
{
|
{
|
||||||
wxFileName fn(m_ConvertedFileName);
|
wxFileName fn( m_ConvertedFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists(path) )
|
||||||
path = ::wxGetCwd();
|
path = ::wxGetCwd();
|
||||||
|
|
||||||
wxString msg = _( "Logo file (*.kicad_wks)|*.kicad_wks" );
|
wxString msg = _( "Logo file (*.kicad_wks)|*.kicad_wks" );
|
||||||
wxFileDialog FileDlg( this, _( "Create a logo file" ), path, wxEmptyString,
|
wxFileDialog fileDlg( this, _( "Create a logo file" ), path, wxEmptyString,
|
||||||
msg,
|
msg,
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
int diag = FileDlg.ShowModal();
|
int diag = fileDlg.ShowModal();
|
||||||
|
|
||||||
if( diag != wxID_OK )
|
if( diag != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ConvertedFileName = FileDlg.GetPath();
|
m_ConvertedFileName = fileDlg.GetPath();
|
||||||
|
|
||||||
FILE* outfile;
|
FILE* outfile;
|
||||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
|
@ -389,24 +491,26 @@ void BM2CMP_FRAME::OnExportLogo()
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExportPostScript()
|
void BM2CMP_FRAME::OnExportPostScript()
|
||||||
{
|
{
|
||||||
wxFileName fn(m_ConvertedFileName);
|
wxFileName fn( m_ConvertedFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||||
path = ::wxGetCwd();
|
path = ::wxGetCwd();
|
||||||
|
|
||||||
wxString msg = _( "Postscript file (*.ps)|*.ps" );
|
wxString msg = _( "Postscript file (*.ps)|*.ps" );
|
||||||
wxFileDialog FileDlg( this, _( "Create a Postscript file" ), path, wxEmptyString,
|
wxFileDialog fileDlg( this, _( "Create a Postscript file" ), path, wxEmptyString,
|
||||||
msg,
|
msg,
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
int diag = FileDlg.ShowModal();
|
|
||||||
|
int diag = fileDlg.ShowModal();
|
||||||
|
|
||||||
if( diag != wxID_OK )
|
if( diag != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ConvertedFileName = FileDlg.GetPath();
|
m_ConvertedFileName = fileDlg.GetPath();
|
||||||
|
|
||||||
FILE* outfile;
|
FILE* outfile;
|
||||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
|
@ -423,27 +527,29 @@ void BM2CMP_FRAME::OnExportPostScript()
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExportEeschema()
|
void BM2CMP_FRAME::OnExportEeschema()
|
||||||
{
|
{
|
||||||
wxFileName fn(m_ConvertedFileName);
|
wxFileName fn( m_ConvertedFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists(path) )
|
||||||
path = ::wxGetCwd();
|
path = ::wxGetCwd();
|
||||||
|
|
||||||
wxString msg = _( "Schematic lib file (*.lib)|*.lib" );
|
wxString msg = _( "Schematic lib file (*.lib)|*.lib" );
|
||||||
wxFileDialog FileDlg( this, _( "Create a lib file for Eeschema" ), path, wxEmptyString,
|
|
||||||
|
wxFileDialog fileDlg( this, _( "Create a lib file for Eeschema" ), path, wxEmptyString,
|
||||||
msg,
|
msg,
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
int diag = FileDlg.ShowModal();
|
|
||||||
|
int diag = fileDlg.ShowModal();
|
||||||
|
|
||||||
if( diag != wxID_OK )
|
if( diag != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ConvertedFileName = FileDlg.GetPath();
|
m_ConvertedFileName = fileDlg.GetPath();
|
||||||
|
|
||||||
FILE* outfile;
|
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
|
||||||
|
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
{
|
{
|
||||||
|
@ -460,29 +566,29 @@ void BM2CMP_FRAME::OnExportEeschema()
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||||
{
|
{
|
||||||
wxFileName fn(m_ConvertedFileName);
|
wxFileName fn( m_ConvertedFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||||
path = ::wxGetCwd();
|
path = ::wxGetCwd();
|
||||||
|
|
||||||
wxString msg = aLegacyFormat ?
|
wxString msg = aLegacyFormat ?
|
||||||
_( "Footprint file (*.emp)|*.emp" ) :
|
_( "Footprint file (*.emp)|*.emp" ) :
|
||||||
_( "Footprint file (*.kicad_mod)|*.kicad_mod" );
|
_( "Footprint file (*.kicad_mod)|*.kicad_mod" );
|
||||||
wxFileDialog FileDlg( this, _( "Create a footprint file for PcbNew" ),
|
|
||||||
|
wxFileDialog fileDlg( this, _( "Create a footprint file for PcbNew" ),
|
||||||
path, wxEmptyString,
|
path, wxEmptyString,
|
||||||
msg,
|
msg,
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
int diag = FileDlg.ShowModal();
|
|
||||||
|
int diag = fileDlg.ShowModal();
|
||||||
|
|
||||||
if( diag != wxID_OK )
|
if( diag != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ConvertedFileName = FileDlg.GetPath();
|
m_ConvertedFileName = fileDlg.GetPath();
|
||||||
|
|
||||||
|
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
FILE* outfile;
|
|
||||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
|
||||||
|
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
{
|
{
|
||||||
|
@ -496,6 +602,7 @@ void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
||||||
{
|
{
|
||||||
// Create a potrace bitmap
|
// Create a potrace bitmap
|
||||||
|
@ -514,40 +621,93 @@ void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
||||||
/* fill the bitmap with data */
|
/* fill the bitmap with data */
|
||||||
for( int y = 0; y < h; y++ )
|
for( int y = 0; y < h; y++ )
|
||||||
{
|
{
|
||||||
for( int x = 0; x<w; x++ )
|
for( int x = 0; x < w; x++ )
|
||||||
{
|
{
|
||||||
unsigned char pix = m_NB_Image.GetGreen( x, y );
|
unsigned char pix = m_NB_Image.GetGreen( x, y );
|
||||||
BM_PUT( potrace_bitmap, x, y, pix ? 1 : 0 );
|
BM_PUT( potrace_bitmap, x, y, pix ? 1 : 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap2component( potrace_bitmap, aOutfile, aFormat );
|
bitmap2component( potrace_bitmap, aOutfile, aFormat, m_imageDPI.x, m_imageDPI.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// EDA_APP
|
|
||||||
|
|
||||||
IMPLEMENT_APP( EDA_APP )
|
//-----<KIFACE>-----------------------------------------------------------------
|
||||||
|
|
||||||
///-----------------------------------------------------------------------------
|
namespace BMP2CMP {
|
||||||
// EDA_APP
|
|
||||||
// main program
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool EDA_APP::OnInit()
|
static struct IFACE : public KIFACE_I
|
||||||
{
|
{
|
||||||
wxInitAllImageHandlers();
|
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||||
|
|
||||||
InitEDA_Appl( wxT( "BMP2CMP" ) );
|
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
|
||||||
|
{
|
||||||
|
switch( aClassId )
|
||||||
|
{
|
||||||
|
|
||||||
wxFrame* frame = new BM2CMP_FRAME();
|
default:
|
||||||
SetTopWindow( frame );
|
{
|
||||||
frame->Show( true );
|
KIWAY_PLAYER* frame = new BM2CMP_FRAME( aKiway, aParent );
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
/**
|
||||||
}
|
* Function IfaceOrAddress
|
||||||
|
* return a pointer to the requested object. The safest way to use this
|
||||||
|
* is to retrieve a pointer to a static instance of an interface, similar to
|
||||||
|
* how the KIFACE interface is exported. But if you know what you are doing
|
||||||
|
* use it to retrieve anything you want.
|
||||||
|
*
|
||||||
|
* @param aDataId identifies which object you want the address of.
|
||||||
|
*
|
||||||
|
* @return void* - and must be cast into the know type.
|
||||||
|
*/
|
||||||
|
void* IfaceOrAddress( int aDataId )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
|
||||||
|
KIFACE_I( aDSOname, aType )
|
||||||
|
{}
|
||||||
|
|
||||||
void EDA_APP::MacOpenFile( const wxString& aFileName )
|
} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
|
||||||
|
|
||||||
|
} // namespace BMP2CMP
|
||||||
|
|
||||||
|
using namespace BMP2CMP;
|
||||||
|
|
||||||
|
static PGM_BASE* process;
|
||||||
|
|
||||||
|
KIFACE_I& Kiface()
|
||||||
{
|
{
|
||||||
|
return kiface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
||||||
|
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
||||||
|
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
||||||
|
{
|
||||||
|
process = (PGM_BASE*) aProgram;
|
||||||
|
return &kiface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(BUILD_KIWAY_DLLS)
|
||||||
|
PGM_BASE& Pgm()
|
||||||
|
{
|
||||||
|
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
||||||
|
return *process;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||||
|
{
|
||||||
|
return start_common();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
// C++ code generated with wxFormBuilder (version Nov 5 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
|
||||||
{
|
{
|
||||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||||
|
|
||||||
|
@ -41,33 +41,43 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
||||||
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL );
|
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL );
|
||||||
|
|
||||||
wxFlexGridSizer* fgSizerInfo;
|
wxFlexGridSizer* fgSizerInfo;
|
||||||
fgSizerInfo = new wxFlexGridSizer( 3, 3, 0, 0 );
|
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||||
|
fgSizerInfo->AddGrowableCol( 1 );
|
||||||
|
fgSizerInfo->AddGrowableCol( 2 );
|
||||||
fgSizerInfo->SetFlexibleDirection( wxBOTH );
|
fgSizerInfo->SetFlexibleDirection( wxBOTH );
|
||||||
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||||
|
|
||||||
m_staticTextSizeX = new wxStaticText( m_panelRight, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextSize = new wxStaticText( m_panelRight, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticTextSizeX->Wrap( -1 );
|
m_staticTextSize->Wrap( -1 );
|
||||||
fgSizerInfo->Add( m_staticTextSizeX, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
fgSizerInfo->Add( m_staticTextSize, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
m_SizeXValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_SizeXValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_SizeXValue->Wrap( -1 );
|
m_SizeXValue->Wrap( -1 );
|
||||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_SizeXunits = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_SizeXunits->Wrap( -1 );
|
|
||||||
fgSizerInfo->Add( m_SizeXunits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_staticTextSizeY = new wxStaticText( m_panelRight, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_staticTextSizeY->Wrap( -1 );
|
|
||||||
fgSizerInfo->Add( m_staticTextSizeY, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_SizeYValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_SizeYValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_SizeYValue->Wrap( -1 );
|
m_SizeYValue->Wrap( -1 );
|
||||||
fgSizerInfo->Add( m_SizeYValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_SizeYunits = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_SizePixUnits = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_SizeYunits->Wrap( -1 );
|
m_SizePixUnits->Wrap( -1 );
|
||||||
fgSizerInfo->Add( m_SizeYunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_staticTextSize1 = new wxStaticText( m_panelRight, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextSize1->Wrap( -1 );
|
||||||
|
fgSizerInfo->Add( m_staticTextSize1, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_RIGHT, 5 );
|
||||||
|
|
||||||
|
m_SizeXValue_mm = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_SizeXValue_mm->Wrap( -1 );
|
||||||
|
fgSizerInfo->Add( m_SizeXValue_mm, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_SizeYValue_mm = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_SizeYValue_mm->Wrap( -1 );
|
||||||
|
fgSizerInfo->Add( m_SizeYValue_mm, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_Size_mmxUnits = new wxStaticText( m_panelRight, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_Size_mmxUnits->Wrap( -1 );
|
||||||
|
fgSizerInfo->Add( m_Size_mmxUnits, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_staticTextBPP = new wxStaticText( m_panelRight, wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextBPP = new wxStaticText( m_panelRight, wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticTextBPP->Wrap( -1 );
|
m_staticTextBPP->Wrap( -1 );
|
||||||
|
@ -75,17 +85,38 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
||||||
|
|
||||||
m_BPPValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_BPPValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_BPPValue->Wrap( -1 );
|
m_BPPValue->Wrap( -1 );
|
||||||
fgSizerInfo->Add( m_BPPValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_BPPunits = new wxStaticText( m_panelRight, wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_BPPunits = new wxStaticText( m_panelRight, wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_BPPunits->Wrap( -1 );
|
m_BPPunits->Wrap( -1 );
|
||||||
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
fgSizerInfo->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_staticTextBPI = new wxStaticText( m_panelRight, wxID_ANY, _("Resolution:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextBPI->Wrap( -1 );
|
||||||
|
fgSizerInfo->Add( m_staticTextBPI, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_DPIValueX = new wxTextCtrl( m_panelRight, wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_DPIValueX->SetMinSize( wxSize( 40,-1 ) );
|
||||||
|
|
||||||
|
fgSizerInfo->Add( m_DPIValueX, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_DPIValueY = new wxTextCtrl( m_panelRight, wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_DPIValueY->SetMinSize( wxSize( 40,-1 ) );
|
||||||
|
|
||||||
|
fgSizerInfo->Add( m_DPIValueY, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_DPI_Units = new wxStaticText( m_panelRight, wxID_ANY, _("DPI"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_DPI_Units->Wrap( -1 );
|
||||||
|
fgSizerInfo->Add( m_DPI_Units, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 );
|
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||||
|
|
||||||
|
|
||||||
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
@ -98,18 +129,18 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
||||||
wxString m_radioBoxFormatChoices[] = { _("Eeschema"), _("Pcbnew old fmt (.emp)"), _("Pcbnew kicad_mod"), _("Postscript"), _("Logo for title block") };
|
wxString m_radioBoxFormatChoices[] = { _("Eeschema"), _("Pcbnew old fmt (.emp)"), _("Pcbnew kicad_mod"), _("Postscript"), _("Logo for title block") };
|
||||||
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
|
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
|
||||||
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
|
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
|
||||||
m_radioBoxFormat->SetSelection( 4 );
|
m_radioBoxFormat->SetSelection( 2 );
|
||||||
brightSizer->Add( m_radioBoxFormat, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
|
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
|
||||||
int m_rbOptionsNChoices = sizeof( m_rbOptionsChoices ) / sizeof( wxString );
|
int m_rbOptionsNChoices = sizeof( m_rbOptionsChoices ) / sizeof( wxString );
|
||||||
m_rbOptions = new wxRadioBox( m_panelRight, wxID_ANY, _("Options"), wxDefaultPosition, wxDefaultSize, m_rbOptionsNChoices, m_rbOptionsChoices, 1, wxRA_SPECIFY_COLS );
|
m_rbOptions = new wxRadioBox( m_panelRight, wxID_ANY, _("Options"), wxDefaultPosition, wxDefaultSize, m_rbOptionsNChoices, m_rbOptionsChoices, 1, wxRA_SPECIFY_COLS );
|
||||||
m_rbOptions->SetSelection( 0 );
|
m_rbOptions->SetSelection( 0 );
|
||||||
brightSizer->Add( m_rbOptions, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
brightSizer->Add( m_rbOptions, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
m_ThresholdText = new wxStaticText( m_panelRight, wxID_ANY, _("Threshold Value:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_ThresholdText = new wxStaticText( m_panelRight, wxID_ANY, _("Threshold Value:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_ThresholdText->Wrap( -1 );
|
m_ThresholdText->Wrap( -1 );
|
||||||
brightSizer->Add( m_ThresholdText, 0, wxRIGHT|wxLEFT, 5 );
|
brightSizer->Add( m_ThresholdText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_sliderThreshold = new wxSlider( m_panelRight, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
m_sliderThreshold = new wxSlider( m_panelRight, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
||||||
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
|
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
|
||||||
|
@ -131,6 +162,10 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
||||||
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||||
|
m_DPIValueX->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueX ), NULL, this );
|
||||||
|
m_DPIValueX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnResolutionChange ), NULL, this );
|
||||||
|
m_DPIValueY->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueY ), NULL, this );
|
||||||
|
m_DPIValueY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnResolutionChange ), NULL, this );
|
||||||
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||||
m_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
|
m_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
|
||||||
m_rbOptions->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), NULL, this );
|
m_rbOptions->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), NULL, this );
|
||||||
|
@ -143,6 +178,10 @@ BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||||
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
|
||||||
|
m_DPIValueX->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueX ), NULL, this );
|
||||||
|
m_DPIValueX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnResolutionChange ), NULL, this );
|
||||||
|
m_DPIValueY->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BM2CMP_FRAME_BASE::UpdatePPITextValueY ), NULL, this );
|
||||||
|
m_DPIValueY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnResolutionChange ), NULL, this );
|
||||||
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||||
m_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
|
m_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
|
||||||
m_rbOptions->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), NULL, this );
|
m_rbOptions->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), NULL, this );
|
||||||
|
|
|
@ -20,8 +20,10 @@
|
||||||
<property name="path">.</property>
|
<property name="path">.</property>
|
||||||
<property name="precompiled_header"></property>
|
<property name="precompiled_header"></property>
|
||||||
<property name="relative_path">1</property>
|
<property name="relative_path">1</property>
|
||||||
|
<property name="skip_lua_events">1</property>
|
||||||
<property name="skip_php_events">1</property>
|
<property name="skip_php_events">1</property>
|
||||||
<property name="skip_python_events">1</property>
|
<property name="skip_python_events">1</property>
|
||||||
|
<property name="ui_table">UI</property>
|
||||||
<property name="use_enum">0</property>
|
<property name="use_enum">0</property>
|
||||||
<property name="use_microsoft_bom">0</property>
|
<property name="use_microsoft_bom">0</property>
|
||||||
<object class="Frame" expanded="1">
|
<object class="Frame" expanded="1">
|
||||||
|
@ -44,7 +46,7 @@
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="size">527,470</property>
|
<property name="size">527,470</property>
|
||||||
<property name="style">wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>
|
<property name="style">wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>
|
||||||
<property name="subclass"></property>
|
<property name="subclass">KIWAY_PLAYER; kiway_player.h</property>
|
||||||
<property name="title">Bitmap to Component Converter</property>
|
<property name="title">Bitmap to Component Converter</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
|
@ -506,7 +508,7 @@
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticBoxSizer" expanded="1">
|
<object class="wxStaticBoxSizer" expanded="1">
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
|
@ -521,16 +523,16 @@
|
||||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxFlexGridSizer" expanded="1">
|
<object class="wxFlexGridSizer" expanded="1">
|
||||||
<property name="cols">3</property>
|
<property name="cols">4</property>
|
||||||
<property name="flexible_direction">wxBOTH</property>
|
<property name="flexible_direction">wxBOTH</property>
|
||||||
<property name="growablecols"></property>
|
<property name="growablecols">1,2</property>
|
||||||
<property name="growablerows"></property>
|
<property name="growablerows"></property>
|
||||||
<property name="hgap">0</property>
|
<property name="hgap">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">fgSizerInfo</property>
|
<property name="name">fgSizerInfo</property>
|
||||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<property name="rows">3</property>
|
<property name="rows">0</property>
|
||||||
<property name="vgap">0</property>
|
<property name="vgap">0</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
|
@ -564,7 +566,7 @@
|
||||||
<property name="gripper">0</property>
|
<property name="gripper">0</property>
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="label">Size X:</property>
|
<property name="label">Size:</property>
|
||||||
<property name="max_size"></property>
|
<property name="max_size"></property>
|
||||||
<property name="maximize_button">0</property>
|
<property name="maximize_button">0</property>
|
||||||
<property name="maximum_size"></property>
|
<property name="maximum_size"></property>
|
||||||
|
@ -572,7 +574,7 @@
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_staticTextSizeX</property>
|
<property name="name">m_staticTextSize</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
|
@ -617,7 +619,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -700,173 +702,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</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">pixels</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_SizeXunits</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">wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</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">Size Y:</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_staticTextSizeY</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">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -949,7 +785,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -987,7 +823,339 @@
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_SizeYunits</property>
|
<property name="name">m_SizePixUnits</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">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_RIGHT</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">Size:</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_staticTextSize1</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">wxBOTTOM|wxRIGHT</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">0000</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_SizeXValue_mm</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">wxBOTTOM|wxRIGHT</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">0000</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_SizeYValue_mm</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">wxBOTTOM|wxRIGHT</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">mm</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_Size_mmxUnits</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
|
@ -1115,7 +1283,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -1279,6 +1447,364 @@
|
||||||
<event name="OnUpdateUI"></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="spacer" expanded="1">
|
||||||
|
<property name="height">0</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="width">0</property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</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">Resolution:</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_staticTextBPI</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">wxBOTTOM|wxRIGHT</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxTextCtrl" 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="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="maxlength"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size">40,-1</property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_DPIValueX</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">300</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">UpdatePPITextValueX</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">OnResolutionChange</event>
|
||||||
|
<event name="OnTextEnter"></event>
|
||||||
|
<event name="OnTextMaxLen"></event>
|
||||||
|
<event name="OnTextURL"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxTextCtrl" 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="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="maxlength"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size">40,-1</property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_DPIValueY</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">300</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">UpdatePPITextValueY</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">OnResolutionChange</event>
|
||||||
|
<event name="OnTextEnter"></event>
|
||||||
|
<event name="OnTextMaxLen"></event>
|
||||||
|
<event name="OnTextURL"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</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">DPI</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_DPI_Units</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>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1461,7 +1987,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxRadioBox" expanded="1">
|
<object class="wxRadioBox" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -1509,7 +2035,7 @@
|
||||||
<property name="pin_button">1</property>
|
<property name="pin_button">1</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="resize">Resizable</property>
|
<property name="resize">Resizable</property>
|
||||||
<property name="selection">4</property>
|
<property name="selection">2</property>
|
||||||
<property name="show">1</property>
|
<property name="show">1</property>
|
||||||
<property name="size"></property>
|
<property name="size"></property>
|
||||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||||
|
@ -1551,7 +2077,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxRadioBox" expanded="1">
|
<object class="wxRadioBox" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -1641,7 +2167,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
// C++ code generated with wxFormBuilder (version Nov 5 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -11,6 +11,9 @@
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
#include <wx/xrc/xmlres.h>
|
#include <wx/xrc/xmlres.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
class KIWAY_PLAYER;
|
||||||
|
|
||||||
|
#include "kiway_player.h"
|
||||||
#include <wx/scrolwin.h>
|
#include <wx/scrolwin.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <wx/font.h>
|
#include <wx/font.h>
|
||||||
|
@ -22,6 +25,7 @@
|
||||||
#include <wx/icon.h>
|
#include <wx/icon.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
#include <wx/textctrl.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/statbox.h>
|
#include <wx/statbox.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
|
@ -37,7 +41,7 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Class BM2CMP_FRAME_BASE
|
/// Class BM2CMP_FRAME_BASE
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class BM2CMP_FRAME_BASE : public wxFrame
|
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -47,15 +51,21 @@ class BM2CMP_FRAME_BASE : public wxFrame
|
||||||
wxScrolledWindow* m_GreyscalePicturePanel;
|
wxScrolledWindow* m_GreyscalePicturePanel;
|
||||||
wxScrolledWindow* m_BNPicturePanel;
|
wxScrolledWindow* m_BNPicturePanel;
|
||||||
wxPanel* m_panelRight;
|
wxPanel* m_panelRight;
|
||||||
wxStaticText* m_staticTextSizeX;
|
wxStaticText* m_staticTextSize;
|
||||||
wxStaticText* m_SizeXValue;
|
wxStaticText* m_SizeXValue;
|
||||||
wxStaticText* m_SizeXunits;
|
|
||||||
wxStaticText* m_staticTextSizeY;
|
|
||||||
wxStaticText* m_SizeYValue;
|
wxStaticText* m_SizeYValue;
|
||||||
wxStaticText* m_SizeYunits;
|
wxStaticText* m_SizePixUnits;
|
||||||
|
wxStaticText* m_staticTextSize1;
|
||||||
|
wxStaticText* m_SizeXValue_mm;
|
||||||
|
wxStaticText* m_SizeYValue_mm;
|
||||||
|
wxStaticText* m_Size_mmxUnits;
|
||||||
wxStaticText* m_staticTextBPP;
|
wxStaticText* m_staticTextBPP;
|
||||||
wxStaticText* m_BPPValue;
|
wxStaticText* m_BPPValue;
|
||||||
wxStaticText* m_BPPunits;
|
wxStaticText* m_BPPunits;
|
||||||
|
wxStaticText* m_staticTextBPI;
|
||||||
|
wxTextCtrl* m_DPIValueX;
|
||||||
|
wxTextCtrl* m_DPIValueY;
|
||||||
|
wxStaticText* m_DPI_Units;
|
||||||
wxButton* m_buttonLoad;
|
wxButton* m_buttonLoad;
|
||||||
wxButton* m_buttonExport;
|
wxButton* m_buttonExport;
|
||||||
wxRadioBox* m_radioBoxFormat;
|
wxRadioBox* m_radioBoxFormat;
|
||||||
|
@ -66,6 +76,9 @@ class BM2CMP_FRAME_BASE : public wxFrame
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
|
virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||||
|
virtual void UpdatePPITextValueX( wxMouseEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnResolutionChange( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void UpdatePPITextValueY( wxMouseEvent& event ) { event.Skip(); }
|
||||||
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnExport( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnExport( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnOptionsSelection( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnOptionsSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
|
@ -138,12 +138,12 @@ BITMAPCONV_INFO::BITMAPCONV_INFO()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFormat )
|
int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||||
|
int aFormat, int aDpi_X, int aDpi_Y )
|
||||||
{
|
{
|
||||||
potrace_param_t* param;
|
potrace_param_t* param;
|
||||||
potrace_state_t* st;
|
potrace_state_t* st;
|
||||||
|
|
||||||
|
|
||||||
// set tracing parameters, starting from defaults
|
// set tracing parameters, starting from defaults
|
||||||
param = potrace_param_default();
|
param = potrace_param_default();
|
||||||
if( !param )
|
if( !param )
|
||||||
|
@ -171,8 +171,8 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
info.m_Format = KICAD_LOGO;
|
info.m_Format = KICAD_LOGO;
|
||||||
info.m_ScaleX = 1e3 * 25.4 / 300; // the conversion scale from PPI to micro
|
info.m_ScaleX = 1e3 * 25.4 / aDpi_X; // the conversion scale from PPI to micro
|
||||||
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom
|
info.m_ScaleY = 1e3 * 25.4 / aDpi_Y; // Y axis is top to bottom
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -186,22 +186,22 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
info.m_Format = EESCHEMA_FMT;
|
info.m_Format = EESCHEMA_FMT;
|
||||||
info.m_ScaleX = 1000.0 / 300; // the conversion scale from PPI to UI
|
info.m_ScaleX = 1000.0 / aDpi_X; // the conversion scale from PPI to UI
|
||||||
info.m_ScaleY = -info.m_ScaleX; // Y axis is bottom to Top for components in libs
|
info.m_ScaleY = -1000.0 / aDpi_Y; // Y axis is bottom to Top for components in libs
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
info.m_Format = PCBNEW_KICAD_MOD;
|
info.m_Format = PCBNEW_KICAD_MOD;
|
||||||
info.m_ScaleX = 1e6 * 25.4 / 300; // the conversion scale from PPI to UI
|
info.m_ScaleX = 1e6 * 25.4 / aDpi_X; // the conversion scale from PPI to UI
|
||||||
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
|
info.m_ScaleY = 1e6 * 25.4 / aDpi_Y; // Y axis is top to bottom in modedit
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
info.m_Format = PCBNEW_LEGACY_EMP;
|
info.m_Format = PCBNEW_LEGACY_EMP;
|
||||||
info.m_ScaleX = 10000.0 / 300; // the conversion scale
|
info.m_ScaleX = 10000.0 / aDpi_X; // the conversion scale
|
||||||
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
|
info.m_ScaleY = 10000.0 / aDpi_Y; // Y axis is top to bottom in modedit
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,48 @@ if( WIN32 AND MSYS )
|
||||||
add_definitions( -DGLEW_STATIC )
|
add_definitions( -DGLEW_STATIC )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# A shared library subsetted from common which restricts what can go into
|
||||||
|
# a single_top link image. By not linking to common, we control what does
|
||||||
|
# statically go into single_top link images. My current thinking is that only
|
||||||
|
# wxWidgets should be a shared link from single top, everything else should be
|
||||||
|
# statically bound into it. Otherwise you will have DSO loading problems. After it
|
||||||
|
# sets the LIB PATHS however, we want the *.kiface modules to use shared linking.
|
||||||
|
add_library( singletop STATIC EXCLUDE_FROM_ALL
|
||||||
|
confirm.cpp
|
||||||
|
eda_doc.cpp
|
||||||
|
kiway.cpp
|
||||||
|
kiway_holder.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# A shared library used by multiple *.kiface files and one or two program
|
||||||
|
# launchers. Object files can migrate into here over time, but only if they are
|
||||||
|
# surely needed and certainly used from more than one place without recompilation.
|
||||||
|
# Functions and data all need to use the #include <import_export.h> and be declared
|
||||||
|
# as APIEXPORT
|
||||||
|
set( LIB_KICAD_SRCS
|
||||||
|
colors.cpp
|
||||||
|
dlist.cpp
|
||||||
|
string.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
if( future )
|
||||||
|
add_library( lib_kicad SHARED
|
||||||
|
)
|
||||||
|
target_link_libraries( lib_kicad
|
||||||
|
${wxWidgets_LIBRARIES}
|
||||||
|
)
|
||||||
|
set_target_properties( lib_kicad PROPERTIES
|
||||||
|
OUTPUT_NAME ki
|
||||||
|
)
|
||||||
|
install( TARGETS lib_kicad
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set( COMMON_ABOUT_DLG_SRCS
|
set( COMMON_ABOUT_DLG_SRCS
|
||||||
dialog_about/AboutDialog_main.cpp
|
dialog_about/AboutDialog_main.cpp
|
||||||
dialog_about/dialog_about.cpp
|
dialog_about/dialog_about.cpp
|
||||||
|
@ -93,11 +135,13 @@ set( COMMON_PAGE_LAYOUT_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
set( COMMON_SRCS
|
set( COMMON_SRCS
|
||||||
|
${LIB_KICAD_SRCS}
|
||||||
${COMMON_ABOUT_DLG_SRCS}
|
${COMMON_ABOUT_DLG_SRCS}
|
||||||
${COMMON_PAGE_LAYOUT_SRCS}
|
${COMMON_PAGE_LAYOUT_SRCS}
|
||||||
base_struct.cpp
|
base_struct.cpp
|
||||||
basicframe.cpp
|
basicframe.cpp
|
||||||
bezier_curves.cpp
|
bezier_curves.cpp
|
||||||
|
bin_mod.cpp
|
||||||
bitmap.cpp
|
bitmap.cpp
|
||||||
block_commande.cpp
|
block_commande.cpp
|
||||||
build_version.cpp
|
build_version.cpp
|
||||||
|
@ -107,6 +151,7 @@ set( COMMON_SRCS
|
||||||
class_marker_base.cpp
|
class_marker_base.cpp
|
||||||
class_plotter.cpp
|
class_plotter.cpp
|
||||||
class_undoredo_container.cpp
|
class_undoredo_container.cpp
|
||||||
|
colors.cpp
|
||||||
common.cpp
|
common.cpp
|
||||||
common_plot_functions.cpp
|
common_plot_functions.cpp
|
||||||
common_plotHPGL_functions.cpp
|
common_plotHPGL_functions.cpp
|
||||||
|
@ -115,13 +160,13 @@ set( COMMON_SRCS
|
||||||
common_plotGERBER_functions.cpp
|
common_plotGERBER_functions.cpp
|
||||||
common_plotDXF_functions.cpp
|
common_plotDXF_functions.cpp
|
||||||
common_plotSVG_functions.cpp
|
common_plotSVG_functions.cpp
|
||||||
|
config_params.cpp
|
||||||
confirm.cpp
|
confirm.cpp
|
||||||
copy_to_clipboard.cpp
|
copy_to_clipboard.cpp
|
||||||
dialog_shim.cpp
|
dialog_shim.cpp
|
||||||
displlst.cpp
|
displlst.cpp
|
||||||
dlist.cpp
|
draw_frame.cpp
|
||||||
drawframe.cpp
|
draw_panel.cpp
|
||||||
drawpanel.cpp
|
|
||||||
drawtxt.cpp
|
drawtxt.cpp
|
||||||
dsnlexer.cpp
|
dsnlexer.cpp
|
||||||
eda_dde.cpp
|
eda_dde.cpp
|
||||||
|
@ -134,16 +179,19 @@ set( COMMON_SRCS
|
||||||
hotkeys_basic.cpp
|
hotkeys_basic.cpp
|
||||||
hotkey_grid_table.cpp
|
hotkey_grid_table.cpp
|
||||||
html_messagebox.cpp
|
html_messagebox.cpp
|
||||||
|
kiface_i.cpp
|
||||||
kiway.cpp
|
kiway.cpp
|
||||||
|
kiway_holder.cpp
|
||||||
msgpanel.cpp
|
msgpanel.cpp
|
||||||
netlist_keywords.cpp
|
netlist_keywords.cpp
|
||||||
newstroke_font.cpp
|
newstroke_font.cpp
|
||||||
projet_config.cpp
|
project.cpp
|
||||||
ptree.cpp
|
ptree.cpp
|
||||||
reporter.cpp
|
reporter.cpp
|
||||||
richio.cpp
|
richio.cpp
|
||||||
|
search_stack.cpp
|
||||||
selcolor.cpp
|
selcolor.cpp
|
||||||
string.cpp
|
systemdirsappend.cpp
|
||||||
trigo.cpp
|
trigo.cpp
|
||||||
utf8.cpp
|
utf8.cpp
|
||||||
wildcards_and_files_ext.cpp
|
wildcards_and_files_ext.cpp
|
||||||
|
@ -153,9 +201,11 @@ set( COMMON_SRCS
|
||||||
zoom.cpp
|
zoom.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# We will not want edaappl.cpp linked into the KIFACE, only into the KIWAY.
|
|
||||||
if( TRUE OR NOT USE_KIWAY_DLLS )
|
if( TRUE OR NOT USE_KIWAY_DLLS )
|
||||||
list( APPEND COMMON_SRCS edaappl.cpp )
|
#if( NOT USE_KIWAY_DLLS )
|
||||||
|
# We DO NOT want pgm_base.cpp linked into the KIFACE, only into the KIWAY.
|
||||||
|
# Check the map files to verify eda_pgm.o not being linked in.
|
||||||
|
list( APPEND COMMON_SRCS pgm_base.cpp )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( NOT HAVE_STRTOKR )
|
if( NOT HAVE_STRTOKR )
|
||||||
|
@ -184,11 +234,10 @@ set( COMMON_SRCS
|
||||||
geometry/shape_collisions.cpp
|
geometry/shape_collisions.cpp
|
||||||
geometry/shape_index.cpp
|
geometry/shape_index.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
add_library( common STATIC ${COMMON_SRCS} )
|
add_library( common STATIC ${COMMON_SRCS} )
|
||||||
add_dependencies( common lib-dependencies )
|
add_dependencies( common lib-dependencies )
|
||||||
|
|
||||||
|
|
||||||
set( PCB_COMMON_SRCS
|
set( PCB_COMMON_SRCS
|
||||||
base_screen.cpp
|
base_screen.cpp
|
||||||
eda_text.cpp
|
eda_text.cpp
|
||||||
|
|
|
@ -197,7 +197,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
|
||||||
* otherwise the actual value is rounded when read from dialog and converted
|
* otherwise the actual value is rounded when read from dialog and converted
|
||||||
* in internal units, and therefore modified.
|
* in internal units, and therefore modified.
|
||||||
*/
|
*/
|
||||||
wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
|
wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
|
||||||
{
|
{
|
||||||
double value_to_print = To_User_Unit( aUnit, aValue );
|
double value_to_print = To_User_Unit( aUnit, aValue );
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
|
||||||
|
|
||||||
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
|
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
|
||||||
{
|
{
|
||||||
wxString msg = ReturnStringFromValue( g_UserUnit, aValue );
|
wxString msg = StringFromValue( g_UserUnit, aValue );
|
||||||
|
|
||||||
aTextCtr.SetValue( msg );
|
aTextCtr.SetValue( msg );
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
|
int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
|
||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
double dtmp = 0;
|
double dtmp = 0;
|
||||||
|
@ -348,21 +348,21 @@ int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ReturnValueFromString( const wxString& aTextValue )
|
int ValueFromString( const wxString& aTextValue )
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
value = ReturnValueFromString( g_UserUnit, aTextValue);
|
value = ValueFromString( g_UserUnit, aTextValue);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr )
|
int ValueFromTextCtrl( const wxTextCtrl& aTextCtr )
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
wxString msg = aTextCtr.GetValue();
|
wxString msg = aTextCtr.GetValue();
|
||||||
|
|
||||||
value = ReturnValueFromString( g_UserUnit, msg );
|
value = ValueFromString( g_UserUnit, msg );
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
|
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
#include <online_help.h>
|
#include <online_help.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <eda_doc.h>
|
#include <eda_doc.h>
|
||||||
|
@ -61,11 +62,9 @@ static const wxChar entryPerspective[] = wxT( "Perspective" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
|
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||||
ID_DRAWFRAME_TYPE aFrameType,
|
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||||
const wxString& aTitle,
|
long aStyle, const wxString& aFrameName ) :
|
||||||
const wxPoint& aPos, const wxSize& aSize,
|
|
||||||
long aStyle, const wxString & aFrameName ) :
|
|
||||||
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
|
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
|
||||||
{
|
{
|
||||||
wxSize minsize;
|
wxSize minsize;
|
||||||
|
@ -108,7 +107,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
|
||||||
|
|
||||||
void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
||||||
{
|
{
|
||||||
SaveSettings(); // virtual, wxFrame specific
|
SaveSettings( config() ); // virtual, wxFrame specific
|
||||||
|
|
||||||
event.Skip(); // we did not "handle" the event, only eavesdropped on it.
|
event.Skip(); // we did not "handle" the event, only eavesdropped on it.
|
||||||
}
|
}
|
||||||
|
@ -116,9 +115,6 @@ void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
||||||
|
|
||||||
EDA_BASE_FRAME::~EDA_BASE_FRAME()
|
EDA_BASE_FRAME::~EDA_BASE_FRAME()
|
||||||
{
|
{
|
||||||
if( wxGetApp().GetHtmlHelpController() )
|
|
||||||
wxGetApp().SetHtmlHelpController( NULL );
|
|
||||||
|
|
||||||
delete m_autoSaveTimer;
|
delete m_autoSaveTimer;
|
||||||
|
|
||||||
// This is needed for OSX: avoids further OnDraw processing after this
|
// This is needed for OSX: avoids further OnDraw processing after this
|
||||||
|
@ -174,54 +170,45 @@ void EDA_BASE_FRAME::SetLanguage( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
wxGetApp().SetLanguageIdentifier( id );
|
Pgm().SetLanguageIdentifier( id );
|
||||||
wxGetApp().SetLanguage();
|
Pgm().SetLanguage();
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
GetMenuBar()->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::LoadSettings()
|
void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxString text;
|
|
||||||
int Ypos_min;
|
|
||||||
wxConfig* config;
|
|
||||||
|
|
||||||
config = wxGetApp().GetSettings();
|
|
||||||
|
|
||||||
int maximized = 0;
|
int maximized = 0;
|
||||||
|
|
||||||
if( config )
|
wxString text = m_FrameName + wxT( "Pos_x" );
|
||||||
|
aCfg->Read( text, &m_FramePos.x );
|
||||||
|
|
||||||
|
text = m_FrameName + wxT( "Pos_y" );
|
||||||
|
aCfg->Read( text, &m_FramePos.y );
|
||||||
|
|
||||||
|
text = m_FrameName + wxT( "Size_x" );
|
||||||
|
aCfg->Read( text, &m_FrameSize.x, 600 );
|
||||||
|
|
||||||
|
text = m_FrameName + wxT( "Size_y" );
|
||||||
|
aCfg->Read( text, &m_FrameSize.y, 400 );
|
||||||
|
|
||||||
|
text = m_FrameName + wxT( "Maximized" );
|
||||||
|
aCfg->Read( text, &maximized, 0 );
|
||||||
|
|
||||||
|
if( m_hasAutoSave )
|
||||||
{
|
{
|
||||||
text = m_FrameName + wxT( "Pos_x" );
|
text = m_FrameName + entryAutoSaveInterval;
|
||||||
config->Read( text, &m_FramePos.x );
|
aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Pos_y" );
|
|
||||||
config->Read( text, &m_FramePos.y );
|
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Size_x" );
|
|
||||||
config->Read( text, &m_FrameSize.x, 600 );
|
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Size_y" );
|
|
||||||
config->Read( text, &m_FrameSize.y, 400 );
|
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Maximized" );
|
|
||||||
config->Read( text, &maximized, 0 );
|
|
||||||
|
|
||||||
if( m_hasAutoSave )
|
|
||||||
{
|
|
||||||
text = m_FrameName + entryAutoSaveInterval;
|
|
||||||
config->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure Window title bar is visible
|
// Ensure Window title bar is visible
|
||||||
#if defined( __WXMAC__ )
|
#if defined( __WXMAC__ )
|
||||||
// for macOSX, the window must be below system (macOSX) toolbar
|
// for macOSX, the window must be below system (macOSX) toolbar
|
||||||
// Ypos_min = GetMBarHeight(); seems no more exist in new API (subject to change)
|
// Ypos_min = GetMBarHeight(); seems no more exist in new API (subject to change)
|
||||||
Ypos_min = 20;
|
int Ypos_min = 20;
|
||||||
#else
|
#else
|
||||||
Ypos_min = 0;
|
int Ypos_min = 0;
|
||||||
#endif
|
#endif
|
||||||
if( m_FramePos.y < Ypos_min )
|
if( m_FramePos.y < Ypos_min )
|
||||||
m_FramePos.y = Ypos_min;
|
m_FramePos.y = Ypos_min;
|
||||||
|
@ -229,44 +216,39 @@ void EDA_BASE_FRAME::LoadSettings()
|
||||||
if( maximized )
|
if( maximized )
|
||||||
Maximize();
|
Maximize();
|
||||||
|
|
||||||
// Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
|
aCfg->Read( m_FrameName + entryPerspective, &m_perspective );
|
||||||
// the main frame and all it's managed windows and all of the legacy frame persistence
|
|
||||||
// position code can be removed.
|
|
||||||
if( config )
|
|
||||||
config->Read( m_FrameName + entryPerspective, &m_perspective );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::SaveSettings()
|
void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxConfig* config = wxGetApp().GetSettings();
|
|
||||||
|
|
||||||
if( !config || IsIconized() )
|
if( IsIconized() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_FrameSize = GetSize();
|
m_FrameSize = GetSize();
|
||||||
m_FramePos = GetPosition();
|
m_FramePos = GetPosition();
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Pos_x" );
|
text = m_FrameName + wxT( "Pos_x" );
|
||||||
config->Write( text, (long) m_FramePos.x );
|
aCfg->Write( text, (long) m_FramePos.x );
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Pos_y" );
|
text = m_FrameName + wxT( "Pos_y" );
|
||||||
config->Write( text, (long) m_FramePos.y );
|
aCfg->Write( text, (long) m_FramePos.y );
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Size_x" );
|
text = m_FrameName + wxT( "Size_x" );
|
||||||
config->Write( text, (long) m_FrameSize.x );
|
aCfg->Write( text, (long) m_FrameSize.x );
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Size_y" );
|
text = m_FrameName + wxT( "Size_y" );
|
||||||
config->Write( text, (long) m_FrameSize.y );
|
aCfg->Write( text, (long) m_FrameSize.y );
|
||||||
|
|
||||||
text = m_FrameName + wxT( "Maximized" );
|
text = m_FrameName + wxT( "Maximized" );
|
||||||
config->Write( text, IsMaximized() );
|
aCfg->Write( text, IsMaximized() );
|
||||||
|
|
||||||
if( m_hasAutoSave )
|
if( m_hasAutoSave )
|
||||||
{
|
{
|
||||||
text = m_FrameName + entryAutoSaveInterval;
|
text = m_FrameName + entryAutoSaveInterval;
|
||||||
config->Write( text, m_autoSaveInterval );
|
aCfg->Write( text, m_autoSaveInterval );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once this is fully implemented, wxAuiManager will be used to maintain
|
// Once this is fully implemented, wxAuiManager will be used to maintain
|
||||||
|
@ -276,8 +258,16 @@ void EDA_BASE_FRAME::SaveSettings()
|
||||||
|
|
||||||
// printf( "perspective(%s): %s\n",
|
// printf( "perspective(%s): %s\n",
|
||||||
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
|
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
|
||||||
|
aCfg->Write( m_FrameName + entryPerspective, perspective );
|
||||||
|
}
|
||||||
|
|
||||||
config->Write( m_FrameName + entryPerspective, perspective );
|
|
||||||
|
wxConfigBase* EDA_BASE_FRAME::config()
|
||||||
|
{
|
||||||
|
// KICAD_MANAGER_FRAME overrides this
|
||||||
|
wxConfigBase* ret = Kiface().KifaceSettings();
|
||||||
|
wxASSERT( ret );
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,12 +278,12 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
|
||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
|
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
|
||||||
wxFileHistory * aFileHistory )
|
wxFileHistory* aFileHistory )
|
||||||
{
|
{
|
||||||
wxFileHistory* fileHistory = aFileHistory;
|
wxFileHistory* fileHistory = aFileHistory;
|
||||||
|
|
||||||
if( fileHistory == NULL )
|
if( !fileHistory )
|
||||||
fileHistory = & wxGetApp().GetFileHistory();
|
fileHistory = &Kiface().GetFileHistory();
|
||||||
|
|
||||||
fileHistory->AddFileToHistory( FullFileName );
|
fileHistory->AddFileToHistory( FullFileName );
|
||||||
}
|
}
|
||||||
|
@ -302,33 +292,36 @@ void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
|
||||||
wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
|
wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
|
||||||
wxFileHistory* aFileHistory )
|
wxFileHistory* aFileHistory )
|
||||||
{
|
{
|
||||||
wxString fn, msg;
|
|
||||||
size_t i;
|
|
||||||
wxFileHistory* fileHistory = aFileHistory;
|
wxFileHistory* fileHistory = aFileHistory;
|
||||||
|
|
||||||
if( fileHistory == NULL )
|
if( !fileHistory )
|
||||||
fileHistory = & wxGetApp().GetFileHistory();
|
fileHistory = &Kiface().GetFileHistory();
|
||||||
|
|
||||||
int baseId = fileHistory->GetBaseId();
|
int baseId = fileHistory->GetBaseId();
|
||||||
|
|
||||||
wxASSERT( cmdId >= baseId && cmdId < baseId + ( int )fileHistory->GetCount() );
|
wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
|
||||||
|
|
||||||
i = ( size_t )( cmdId - baseId );
|
unsigned i = cmdId - baseId;
|
||||||
|
|
||||||
if( i < fileHistory->GetCount() )
|
if( i < fileHistory->GetCount() )
|
||||||
{
|
{
|
||||||
fn = fileHistory->GetHistoryFile( i );
|
wxString fn = fileHistory->GetHistoryFile( i );
|
||||||
|
|
||||||
if( !wxFileName::FileExists( fn ) )
|
if( wxFileName::FileExists( fn ) )
|
||||||
|
return fn;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "file <%s> was not found." ), GetChars( fn ) );
|
wxString msg = wxString::Format(
|
||||||
|
wxT( "file '%s' was not found." ),
|
||||||
|
GetChars( fn ) );
|
||||||
|
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
|
|
||||||
fileHistory->RemoveFileFromHistory( i );
|
fileHistory->RemoveFileFromHistory( i );
|
||||||
fn = wxEmptyString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fn;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -339,28 +332,28 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
|
||||||
/* We have to get document for beginners,
|
/* We have to get document for beginners,
|
||||||
* or the the full specific doc
|
* or the the full specific doc
|
||||||
* if event id is wxID_INDEX, we want the document for beginners.
|
* if event id is wxID_INDEX, we want the document for beginners.
|
||||||
* else the specific doc file (its name is in wxGetApp().GetHelpFileName())
|
* else the specific doc file (its name is in Kiface().GetHelpFileName())
|
||||||
* The document for beginners is the same for all KiCad utilities
|
* The document for beginners is the same for all KiCad utilities
|
||||||
*/
|
*/
|
||||||
if( event.GetId() == wxID_INDEX )
|
if( event.GetId() == wxID_INDEX )
|
||||||
{
|
{
|
||||||
// Temporary change the help filename
|
// Temporarily change the help filename
|
||||||
wxString tmp = wxGetApp().GetHelpFileName();
|
wxString tmp = Kiface().GetHelpFileName();
|
||||||
|
|
||||||
// Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
|
// Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
|
||||||
wxGetApp().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) );
|
Kiface().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) );
|
||||||
wxString helpFile = wxGetApp().GetHelpFile();
|
wxString helpFile = Kiface().GetHelpFile();
|
||||||
|
|
||||||
if( !helpFile )
|
if( !helpFile )
|
||||||
{ // Try to find "Getting_Started_in_KiCad.pdf"
|
{ // Try to find "Getting_Started_in_KiCad.pdf"
|
||||||
wxGetApp().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
|
Kiface().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
|
||||||
helpFile = wxGetApp().GetHelpFile();
|
helpFile = Kiface().GetHelpFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !helpFile )
|
if( !helpFile )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Help file %s could not be found." ),
|
msg.Printf( _( "Help file %s could not be found." ),
|
||||||
GetChars( wxGetApp().GetHelpFileName() ) );
|
GetChars( Kiface().GetHelpFileName() ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -368,36 +361,36 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
|
||||||
GetAssociatedDocument( this, helpFile );
|
GetAssociatedDocument( this, helpFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().SetHelpFileName( tmp );
|
Kiface().SetHelpFileName( tmp );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
|
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
|
||||||
|
|
||||||
if( wxGetApp().GetHtmlHelpController() == NULL )
|
if( Kiface().GetHtmlHelpController() == NULL )
|
||||||
{
|
{
|
||||||
wxGetApp().InitOnLineHelp();
|
Kiface().InitOnLineHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( wxGetApp().GetHtmlHelpController() )
|
if( Kiface().GetHtmlHelpController() )
|
||||||
{
|
{
|
||||||
wxGetApp().GetHtmlHelpController()->DisplayContents();
|
Kiface().GetHtmlHelpController()->DisplayContents();
|
||||||
wxGetApp().GetHtmlHelpController()->Display( wxGetApp().GetHelpFileName() );
|
Kiface().GetHtmlHelpController()->Display( Kiface().GetHelpFileName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Help file %s could not be found." ), GetChars( wxGetApp().GetHelpFileName() ) );
|
msg.Printf( _( "Help file %s could not be found." ), GetChars( Kiface().GetHelpFileName() ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
||||||
wxString helpFile = wxGetApp().GetHelpFile();
|
wxString helpFile = Kiface().GetHelpFile();
|
||||||
|
|
||||||
if( !helpFile )
|
if( !helpFile )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Help file %s could not be found." ),
|
msg.Printf( _( "Help file %s could not be found." ),
|
||||||
GetChars( wxGetApp().GetHelpFileName() ) );
|
GetChars( Kiface().GetHelpFileName() ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -413,8 +406,8 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
|
||||||
|
|
||||||
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
|
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn = wxGetApp().GetEditorName();
|
wxFileName fn = Pgm().GetEditorName();
|
||||||
wxString wildcard( wxT( "*" ) );
|
wxString wildcard( wxT( "*" ) );
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
wildcard += wxT( ".exe" );
|
wildcard += wxT( ".exe" );
|
||||||
|
@ -430,18 +423,16 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxASSERT( wxGetApp().GetCommonSettings() );
|
wxString editor = dlg.GetPath();
|
||||||
|
|
||||||
wxConfig* cfg = wxGetApp().GetCommonSettings();
|
Pgm().SetEditorName( editor );
|
||||||
wxGetApp().SetEditorName( dlg.GetPath() );
|
|
||||||
cfg->Write( wxT( "Editor" ), wxGetApp().GetEditorName() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::GetKicadAbout( wxCommandEvent& event )
|
void EDA_BASE_FRAME::GetKicadAbout( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
bool ShowAboutDialog(wxWindow * parent);
|
bool ShowAboutDialog(wxWindow * parent);
|
||||||
ShowAboutDialog(this);
|
ShowAboutDialog( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -535,7 +526,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
wxPlatformInfo info;
|
wxPlatformInfo info;
|
||||||
|
|
||||||
tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" );
|
tmp = wxT( "Application: " ) + Pgm().App().GetAppName() + wxT( "\n" );
|
||||||
tmp << wxT( "Version: " ) << GetBuildVersion()
|
tmp << wxT( "Version: " ) << GetBuildVersion()
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
<< wxT( " Debug" )
|
<< wxT( " Debug" )
|
||||||
|
@ -666,14 +657,14 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName,
|
||||||
if( !autoSaveFileName.FileExists() )
|
if( !autoSaveFileName.FileExists() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg = wxString::Format( _(
|
||||||
|
"Well this is potentially embarrassing! It appears that the last time "
|
||||||
|
"you were editing the file '%s' it was not saved properly. Do you wish to restore the last "
|
||||||
|
"edits you made?" ),
|
||||||
|
GetChars( aFileName.GetFullName() )
|
||||||
|
);
|
||||||
|
|
||||||
msg.Printf( _( "Well this is potentially embarrassing! It appears that the last time \
|
int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
|
||||||
you were editing the file <%s> it was not saved properly. Do you wish to restore the last \
|
|
||||||
edits you made?" ),
|
|
||||||
GetChars( aFileName.GetFullName() ) );
|
|
||||||
|
|
||||||
int response = wxMessageBox( msg, wxGetApp().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
|
|
||||||
|
|
||||||
// Make a backup of the current file, delete the file, and rename the auto save file to
|
// Make a backup of the current file, delete the file, and rename the auto save file to
|
||||||
// the file name.
|
// the file name.
|
||||||
|
@ -703,7 +694,7 @@ edits you made?" ),
|
||||||
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
|
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
|
wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
|
||||||
wxGetApp().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
|
Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -716,29 +707,21 @@ edits you made?" ),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetModalMode
|
|
||||||
* Disable or enable all other windows, to emulate a dialog behavior
|
|
||||||
* Useful when the frame is used to show and selec items
|
|
||||||
* (see FOOTPRINT_VIEWER_FRAME and LIB_VIEW_FRAME)
|
|
||||||
*
|
|
||||||
* @param aModal = true to disable all other opened windows (i.e.
|
|
||||||
* this windows is in dialog mode
|
|
||||||
* = false to enable other windows
|
|
||||||
* This function is analog to MakeModal( aModal ), deprecated since wxWidgets 2.9.4
|
|
||||||
*/
|
|
||||||
void EDA_BASE_FRAME::SetModalMode( bool aModal )
|
void EDA_BASE_FRAME::SetModalMode( bool aModal )
|
||||||
{
|
{
|
||||||
// Disable all other windows
|
// Disable all other windows
|
||||||
#if wxCHECK_VERSION(2, 9, 4)
|
#if wxCHECK_VERSION(2, 9, 4)
|
||||||
if ( IsTopLevel() )
|
if( IsTopLevel() )
|
||||||
{
|
{
|
||||||
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||||
while (node)
|
|
||||||
|
while( node )
|
||||||
{
|
{
|
||||||
wxWindow *win = node->GetData();
|
wxWindow* win = node->GetData();
|
||||||
if (win != this)
|
|
||||||
win->Enable(!aModal);
|
if( win != this )
|
||||||
|
win->Enable( !aModal );
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
|
||||||
|
#include <wx/config.h>
|
||||||
|
#include <bin_mod.h>
|
||||||
|
#include <online_help.h>
|
||||||
|
|
||||||
|
|
||||||
|
BIN_MOD::BIN_MOD( const char* aName ) :
|
||||||
|
m_name( aName ),
|
||||||
|
m_config( 0 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BIN_MOD::Init()
|
||||||
|
{
|
||||||
|
// do an OS specific wxConfig instantiation, using the bin_mod (EXE/DLL/DSO) name.
|
||||||
|
m_config = new wxConfig( wxString::FromUTF8( m_name ) );
|
||||||
|
|
||||||
|
m_history.Load( *m_config );
|
||||||
|
|
||||||
|
// Prepare On Line Help. Use only lower case for help file names, in order to
|
||||||
|
// avoid problems with upper/lower case file names under windows and unix.
|
||||||
|
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
|
||||||
|
m_help_file = wxString::FromUTF8( m_name ) + wxT( ".html" );
|
||||||
|
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
||||||
|
m_help_file = wxString::FromUTF8( m_name ) + wxT( ".pdf" );
|
||||||
|
#else
|
||||||
|
#error Help files format not defined
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BIN_MOD::End()
|
||||||
|
{
|
||||||
|
if( m_config )
|
||||||
|
{
|
||||||
|
m_history.Save( *m_config );
|
||||||
|
|
||||||
|
// Deleting a wxConfigBase writes its contents to disk if changed.
|
||||||
|
// Might be NULL if called twice, in which case nothing happens.
|
||||||
|
delete m_config;
|
||||||
|
m_config = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BIN_MOD::~BIN_MOD()
|
||||||
|
{
|
||||||
|
End();
|
||||||
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
|
||||||
|
#include <colors.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The predefined colors used in KiCad.
|
||||||
|
* Please: if you change a value, remember these values are carefully chosen
|
||||||
|
* to have good results in Pcbnew, that uses the ORed value of basic colors
|
||||||
|
* when displaying superimposed objects
|
||||||
|
* This list must have exactly NBCOLORS items
|
||||||
|
*/
|
||||||
|
const StructColors g_ColorRefs[NBCOLORS] =
|
||||||
|
{
|
||||||
|
{ 0, 0, 0, BLACK, wxT( "Black" ), DARKDARKGRAY },
|
||||||
|
{ 72, 72, 72, DARKDARKGRAY, wxT( "Gray 1" ), DARKGRAY },
|
||||||
|
{ 132, 132, 132, DARKGRAY, wxT( "Gray 2" ), LIGHTGRAY },
|
||||||
|
{ 194, 194, 194, LIGHTGRAY, wxT( "Gray 3" ), WHITE },
|
||||||
|
{ 255, 255, 255, WHITE, wxT( "White" ), WHITE },
|
||||||
|
{ 194, 255, 255, LIGHTYELLOW, wxT( "L.Yellow" ), WHITE },
|
||||||
|
{ 72, 0, 0, DARKBLUE, wxT( "Blue 1" ), BLUE },
|
||||||
|
{ 0, 72, 0, DARKGREEN, wxT( "Green 1" ), GREEN },
|
||||||
|
{ 72, 72, 0, DARKCYAN, wxT( "Cyan 1" ), CYAN },
|
||||||
|
{ 0, 0, 72, DARKRED, wxT( "Red 1" ), RED },
|
||||||
|
{ 72, 0, 72, DARKMAGENTA, wxT( "Magenta 1" ), MAGENTA },
|
||||||
|
{ 0, 72, 72, DARKBROWN, wxT( "Brown 1" ), BROWN },
|
||||||
|
{ 132, 0, 0, BLUE, wxT( "Blue 2" ), LIGHTBLUE },
|
||||||
|
{ 0, 132, 0, GREEN, wxT( "Green 2" ), LIGHTGREEN },
|
||||||
|
{ 132, 132, 0, CYAN, wxT( "Cyan 2" ), LIGHTCYAN },
|
||||||
|
{ 0, 0, 132, RED, wxT( "Red 2" ), LIGHTRED },
|
||||||
|
{ 132, 0, 132, MAGENTA, wxT( "Magenta 2" ), LIGHTMAGENTA },
|
||||||
|
{ 0, 132, 132, BROWN, wxT( "Brown 2" ), YELLOW },
|
||||||
|
{ 194, 0, 0, LIGHTBLUE, wxT( "Blue 3" ), PUREBLUE, },
|
||||||
|
{ 0, 194, 0, LIGHTGREEN, wxT( "Green 3" ), PUREGREEN },
|
||||||
|
{ 194, 194, 0, LIGHTCYAN, wxT( "Cyan 3" ), PURECYAN },
|
||||||
|
{ 0, 0, 194, LIGHTRED, wxT( "Red 3" ), PURERED },
|
||||||
|
{ 194, 0, 194, LIGHTMAGENTA, wxT( "Magenta 3" ), PUREMAGENTA },
|
||||||
|
{ 0, 194, 194, YELLOW, wxT( "Yellow 3" ), PUREYELLOW },
|
||||||
|
{ 255, 0, 0, PUREBLUE, wxT( "Blue 4" ), WHITE },
|
||||||
|
{ 0, 255, 0, PUREGREEN, wxT( "Green 4" ), WHITE },
|
||||||
|
{ 255, 255, 0, PURECYAN, wxT( "Cyan 4" ), WHITE },
|
||||||
|
{ 0, 0, 255, PURERED, wxT( "Red 4" ), WHITE },
|
||||||
|
{ 255, 0, 255, PUREMAGENTA, wxT( "Magenta 4" ), WHITE },
|
||||||
|
{ 0, 255, 255, PUREYELLOW, wxT( "Yellow 4" ), WHITE },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
EDA_COLOR_T ColorByName( const wxString& aName )
|
||||||
|
{
|
||||||
|
// look for a match in the palette itself
|
||||||
|
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
|
||||||
|
{
|
||||||
|
if( 0 == aName.CmpNoCase( g_ColorRefs[trying].m_Name ) )
|
||||||
|
return trying;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not found, no idea...
|
||||||
|
return UNSPECIFIED_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ColorIsLight( EDA_COLOR_T aColor )
|
||||||
|
{
|
||||||
|
const StructColors &c = g_ColorRefs[ColorGetBase( aColor )];
|
||||||
|
int r = c.m_Red;
|
||||||
|
int g = c.m_Green;
|
||||||
|
int b = c.m_Blue;
|
||||||
|
return ((r * r) + (g * g) + (b * b)) > (128 * 128 * 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EDA_COLOR_T ColorFindNearest( const wxColour &aColor )
|
||||||
|
{
|
||||||
|
return ColorFindNearest( aColor.Red(), aColor.Green(), aColor.Blue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EDA_COLOR_T ColorFindNearest( int aR, int aG, int aB )
|
||||||
|
{
|
||||||
|
EDA_COLOR_T candidate = BLACK;
|
||||||
|
|
||||||
|
/* Find the 'nearest' color in the palette. This is fun. There is
|
||||||
|
a gazilion of metrics for the color space and no one of the
|
||||||
|
useful one is in the RGB color space. Who cares, this is a CAD,
|
||||||
|
not a photosomething...
|
||||||
|
|
||||||
|
I hereby declare that the distance is the sum of the square of the
|
||||||
|
component difference. Think about the RGB color cube. Now get the
|
||||||
|
euclidean distance, but without the square root... for ordering
|
||||||
|
purposes it's the same, obviously. Also each component can't be
|
||||||
|
less of the target one, since I found this currently work better...
|
||||||
|
*/
|
||||||
|
int nearest_distance = 255 * 255 * 3 + 1; // Can't beat this
|
||||||
|
|
||||||
|
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
|
||||||
|
{
|
||||||
|
const StructColors &c = g_ColorRefs[trying];
|
||||||
|
int distance = (aR - c.m_Red) * (aR - c.m_Red) +
|
||||||
|
(aG - c.m_Green) * (aG - c.m_Green) +
|
||||||
|
(aB - c.m_Blue) * (aB - c.m_Blue);
|
||||||
|
if( distance < nearest_distance && c.m_Red >= aR &&
|
||||||
|
c.m_Green >= aG && c.m_Blue >= aB )
|
||||||
|
{
|
||||||
|
nearest_distance = distance;
|
||||||
|
candidate = trying;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 )
|
||||||
|
{
|
||||||
|
/* Memoization storage. This could be potentially called for each
|
||||||
|
* color merge so a cache is useful (there are few colours anyway) */
|
||||||
|
static EDA_COLOR_T mix_cache[NBCOLORS][NBCOLORS];
|
||||||
|
|
||||||
|
// TODO how is alpha used? it's a mac only thing, I have no idea
|
||||||
|
aColor1 = ColorGetBase( aColor1 );
|
||||||
|
aColor2 = ColorGetBase( aColor2 );
|
||||||
|
|
||||||
|
// First easy thing: a black gives always the other colour
|
||||||
|
if( aColor1 == BLACK )
|
||||||
|
return aColor2;
|
||||||
|
if( aColor2 == BLACK)
|
||||||
|
return aColor1;
|
||||||
|
|
||||||
|
/* Now we are sure that black can't occur, so the rule is:
|
||||||
|
* BLACK means not computed yet. If we're lucky we already have
|
||||||
|
* an answer */
|
||||||
|
EDA_COLOR_T candidate = mix_cache[aColor1][aColor2];
|
||||||
|
if( candidate != BLACK )
|
||||||
|
return candidate;
|
||||||
|
|
||||||
|
// Blend the two colors (i.e. OR the RGB values)
|
||||||
|
const StructColors &c1 = g_ColorRefs[aColor1];
|
||||||
|
const StructColors &c2 = g_ColorRefs[aColor2];
|
||||||
|
|
||||||
|
// Ask the palette for the nearest color to the mix
|
||||||
|
wxColour mixed( c1.m_Red | c2.m_Red,
|
||||||
|
c1.m_Green | c2.m_Green,
|
||||||
|
c1.m_Blue | c2.m_Blue );
|
||||||
|
candidate = ColorFindNearest( mixed );
|
||||||
|
|
||||||
|
/* Here, BLACK is *not* a good answer, since it would recompute the next time.
|
||||||
|
* Even theorically its not possible (with the current rules), but
|
||||||
|
* maybe the metric will change in the future */
|
||||||
|
if( candidate == BLACK)
|
||||||
|
candidate = DARKDARKGRAY;
|
||||||
|
|
||||||
|
// Store the result in the cache. The operation is commutative, too
|
||||||
|
mix_cache[aColor1][aColor2] = candidate;
|
||||||
|
mix_cache[aColor2][aColor1] = candidate;
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
|
|
@ -65,48 +65,6 @@ EDA_UNITS_T g_UserUnit;
|
||||||
EDA_COLOR_T g_GhostColor;
|
EDA_COLOR_T g_GhostColor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The predefined colors used in KiCad.
|
|
||||||
* Please: if you change a value, remember these values are carefully chosen
|
|
||||||
* to have good results in Pcbnew, that uses the ORed value of basic colors
|
|
||||||
* when displaying superimposed objects
|
|
||||||
* This list must have exactly NBCOLORS items
|
|
||||||
*/
|
|
||||||
const StructColors g_ColorRefs[NBCOLORS] =
|
|
||||||
{
|
|
||||||
{ 0, 0, 0, BLACK, wxT( "Black" ), DARKDARKGRAY },
|
|
||||||
{ 72, 72, 72, DARKDARKGRAY, wxT( "Gray 1" ), DARKGRAY },
|
|
||||||
{ 132, 132, 132, DARKGRAY, wxT( "Gray 2" ), LIGHTGRAY },
|
|
||||||
{ 194, 194, 194, LIGHTGRAY, wxT( "Gray 3" ), WHITE },
|
|
||||||
{ 255, 255, 255, WHITE, wxT( "White" ), WHITE },
|
|
||||||
{ 194, 255, 255, LIGHTYELLOW, wxT( "L.Yellow" ), WHITE },
|
|
||||||
{ 72, 0, 0, DARKBLUE, wxT( "Blue 1" ), BLUE },
|
|
||||||
{ 0, 72, 0, DARKGREEN, wxT( "Green 1" ), GREEN },
|
|
||||||
{ 72, 72, 0, DARKCYAN, wxT( "Cyan 1" ), CYAN },
|
|
||||||
{ 0, 0, 72, DARKRED, wxT( "Red 1" ), RED },
|
|
||||||
{ 72, 0, 72, DARKMAGENTA, wxT( "Magenta 1" ), MAGENTA },
|
|
||||||
{ 0, 72, 72, DARKBROWN, wxT( "Brown 1" ), BROWN },
|
|
||||||
{ 132, 0, 0, BLUE, wxT( "Blue 2" ), LIGHTBLUE },
|
|
||||||
{ 0, 132, 0, GREEN, wxT( "Green 2" ), LIGHTGREEN },
|
|
||||||
{ 132, 132, 0, CYAN, wxT( "Cyan 2" ), LIGHTCYAN },
|
|
||||||
{ 0, 0, 132, RED, wxT( "Red 2" ), LIGHTRED },
|
|
||||||
{ 132, 0, 132, MAGENTA, wxT( "Magenta 2" ), LIGHTMAGENTA },
|
|
||||||
{ 0, 132, 132, BROWN, wxT( "Brown 2" ), YELLOW },
|
|
||||||
{ 194, 0, 0, LIGHTBLUE, wxT( "Blue 3" ), PUREBLUE, },
|
|
||||||
{ 0, 194, 0, LIGHTGREEN, wxT( "Green 3" ), PUREGREEN },
|
|
||||||
{ 194, 194, 0, LIGHTCYAN, wxT( "Cyan 3" ), PURECYAN },
|
|
||||||
{ 0, 0, 194, LIGHTRED, wxT( "Red 3" ), PURERED },
|
|
||||||
{ 194, 0, 194, LIGHTMAGENTA, wxT( "Magenta 3" ), PUREMAGENTA },
|
|
||||||
{ 0, 194, 194, YELLOW, wxT( "Yellow 3" ), PUREYELLOW },
|
|
||||||
{ 255, 0, 0, PUREBLUE, wxT( "Blue 4" ), WHITE },
|
|
||||||
{ 0, 255, 0, PUREGREEN, wxT( "Green 4" ), WHITE },
|
|
||||||
{ 255, 255, 0, PURECYAN, wxT( "Cyan 4" ), WHITE },
|
|
||||||
{ 0, 0, 255, PURERED, wxT( "Red 4" ), WHITE },
|
|
||||||
{ 255, 0, 255, PUREMAGENTA, wxT( "Magenta 4" ), WHITE },
|
|
||||||
{ 0, 255, 255, PUREYELLOW, wxT( "Yellow 4" ), WHITE },
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to use local notation or C standard notation for floating point numbers
|
* Function to use local notation or C standard notation for floating point numbers
|
||||||
* some countries use 1,5 and others (and C) 1.5
|
* some countries use 1,5 and others (and C) 1.5
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
|
|
|
@ -211,34 +211,34 @@ void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt)
|
||||||
putc( '(', fout );
|
putc( '(', fout );
|
||||||
for( unsigned i = 0; i < txt.length(); i++ )
|
for( unsigned i = 0; i < txt.length(); i++ )
|
||||||
{
|
{
|
||||||
// Lazyness made me use stdio buffering yet another time...
|
// Lazyness made me use stdio buffering yet another time...
|
||||||
wchar_t ch = txt[i];
|
wchar_t ch = txt[i];
|
||||||
if( ch < 256 )
|
if( ch < 256 )
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
// The ~ shouldn't reach the outside
|
// The ~ shouldn't reach the outside
|
||||||
case '~':
|
case '~':
|
||||||
break;
|
break;
|
||||||
// These characters must be escaped
|
// These characters must be escaped
|
||||||
case '(':
|
case '(':
|
||||||
case ')':
|
case ')':
|
||||||
case '\\':
|
case '\\':
|
||||||
putc( '\\', fout );
|
putc( '\\', fout );
|
||||||
|
|
||||||
// FALLTHRU
|
// FALLTHRU
|
||||||
default:
|
default:
|
||||||
putc( ch, fout );
|
putc( ch, fout );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putc( ')', fout );
|
putc( ')', fout );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sister function for the ReturnGraphicTextWidth in drawtxt.cpp
|
* Sister function for the GraphicTextWidth in drawtxt.cpp
|
||||||
* Does the same processing (i.e. calculates a text string width) but
|
* Does the same processing (i.e. calculates a text string width) but
|
||||||
* using postscript metrics for the Helvetica font (optionally used for
|
* using postscript metrics for the Helvetica font (optionally used for
|
||||||
* PS and PDF plotting
|
* PS and PDF plotting
|
||||||
|
@ -303,7 +303,7 @@ void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXS
|
||||||
}
|
}
|
||||||
|
|
||||||
void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
double aScale, bool aMirror )
|
double aScale, bool aMirror )
|
||||||
{
|
{
|
||||||
wxASSERT( !outputFile );
|
wxASSERT( !outputFile );
|
||||||
m_plotMirror = aMirror;
|
m_plotMirror = aMirror;
|
||||||
|
@ -354,31 +354,31 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
|
||||||
switch( aH_justify )
|
switch( aH_justify )
|
||||||
{
|
{
|
||||||
case GR_TEXT_HJUSTIFY_CENTER:
|
case GR_TEXT_HJUSTIFY_CENTER:
|
||||||
dx = -tw / 2;
|
dx = -tw / 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||||
dx = -tw;
|
dx = -tw;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_HJUSTIFY_LEFT:
|
case GR_TEXT_HJUSTIFY_LEFT:
|
||||||
dx = 0;
|
dx = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( aV_justify )
|
switch( aV_justify )
|
||||||
{
|
{
|
||||||
case GR_TEXT_VJUSTIFY_CENTER:
|
case GR_TEXT_VJUSTIFY_CENTER:
|
||||||
dy = th / 2;
|
dy = th / 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_TOP:
|
case GR_TEXT_VJUSTIFY_TOP:
|
||||||
dy = th;
|
dy = th;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||||
dy = 0;
|
dy = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RotatePoint( &dx, &dy, aOrient );
|
RotatePoint( &dx, &dy, aOrient );
|
||||||
|
@ -620,7 +620,7 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||||
}
|
}
|
||||||
if( penState != plume || pos != penLastpos )
|
if( penState != plume || pos != penLastpos )
|
||||||
{
|
{
|
||||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||||
fprintf( outputFile, "%g %g %sto\n",
|
fprintf( outputFile, "%g %g %sto\n",
|
||||||
pos_dev.x, pos_dev.y,
|
pos_dev.x, pos_dev.y,
|
||||||
( plume=='D' ) ? "line" : "move" );
|
( plume=='D' ) ? "line" : "move" );
|
||||||
|
@ -650,39 +650,39 @@ bool PS_PLOTTER::StartPlot()
|
||||||
|
|
||||||
static const char* PSMacro[] =
|
static const char* PSMacro[] =
|
||||||
{
|
{
|
||||||
"%%BeginProlog\n"
|
"%%BeginProlog\n"
|
||||||
"/line { newpath moveto lineto stroke } bind def\n",
|
"/line { newpath moveto lineto stroke } bind def\n",
|
||||||
"/cir0 { newpath 0 360 arc stroke } bind def\n",
|
"/cir0 { newpath 0 360 arc stroke } bind def\n",
|
||||||
"/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
"/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
||||||
"/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
"/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
||||||
"/arc0 { newpath arc stroke } bind def\n",
|
"/arc0 { newpath arc stroke } bind def\n",
|
||||||
"/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
"/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
||||||
" grestore stroke } bind def\n",
|
" grestore stroke } bind def\n",
|
||||||
"/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
"/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
||||||
" grestore stroke } bind def\n",
|
" grestore stroke } bind def\n",
|
||||||
"/poly0 { stroke } bind def\n",
|
"/poly0 { stroke } bind def\n",
|
||||||
"/poly1 { closepath gsave fill grestore stroke } bind def\n",
|
"/poly1 { closepath gsave fill grestore stroke } bind def\n",
|
||||||
"/poly2 { closepath gsave fill grestore stroke } bind def\n",
|
"/poly2 { closepath gsave fill grestore stroke } bind def\n",
|
||||||
"/rect0 { rectstroke } bind def\n",
|
"/rect0 { rectstroke } bind def\n",
|
||||||
"/rect1 { rectfill } bind def\n",
|
"/rect1 { rectfill } bind def\n",
|
||||||
"/rect2 { rectfill } bind def\n",
|
"/rect2 { rectfill } bind def\n",
|
||||||
"/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
|
"/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
|
||||||
"/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
|
"/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
|
||||||
"/dashedline { [200] 100 setdash } bind def\n",
|
"/dashedline { [200] 100 setdash } bind def\n",
|
||||||
"/solidline { [] 0 setdash } bind def\n",
|
"/solidline { [] 0 setdash } bind def\n",
|
||||||
|
|
||||||
// This is for 'hidden' text (search anchors for PDF)
|
// This is for 'hidden' text (search anchors for PDF)
|
||||||
"/phantomshow { moveto\n",
|
"/phantomshow { moveto\n",
|
||||||
" /KicadFont findfont 0.000001 scalefont setfont\n",
|
" /KicadFont findfont 0.000001 scalefont setfont\n",
|
||||||
" show } bind def\n",
|
" show } bind def\n",
|
||||||
|
|
||||||
// This is for regular postscript text
|
// This is for regular postscript text
|
||||||
"/textshow { gsave\n",
|
"/textshow { gsave\n",
|
||||||
" findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
|
" findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
|
||||||
" } bind def\n",
|
" } bind def\n",
|
||||||
|
|
||||||
// Utility for getting Latin1 encoded fonts
|
// Utility for getting Latin1 encoded fonts
|
||||||
"/reencodefont {\n",
|
"/reencodefont {\n",
|
||||||
" findfont dup length dict begin\n",
|
" findfont dup length dict begin\n",
|
||||||
" { 1 index /FID ne\n",
|
" { 1 index /FID ne\n",
|
||||||
" { def }\n",
|
" { def }\n",
|
||||||
|
@ -692,13 +692,13 @@ bool PS_PLOTTER::StartPlot()
|
||||||
" currentdict\n",
|
" currentdict\n",
|
||||||
" end } bind def\n"
|
" end } bind def\n"
|
||||||
|
|
||||||
// Remap AdobeStandard fonts to Latin1
|
// Remap AdobeStandard fonts to Latin1
|
||||||
"/KicadFont /Helvetica reencodefont definefont pop\n",
|
"/KicadFont /Helvetica reencodefont definefont pop\n",
|
||||||
"/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
|
"/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
|
||||||
"/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
|
"/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
|
||||||
"/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
|
"/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
|
||||||
"%%EndProlog\n",
|
"%%EndProlog\n",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
time_t time1970 = time( NULL );
|
time_t time1970 = time( NULL );
|
||||||
|
@ -726,8 +726,8 @@ bool PS_PLOTTER::StartPlot()
|
||||||
psPaperSize.Set( pageInfo.GetHeightMils(), pageInfo.GetWidthMils() );
|
psPaperSize.Set( pageInfo.GetHeightMils(), pageInfo.GetWidthMils() );
|
||||||
|
|
||||||
fprintf( outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
|
fprintf( outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
|
||||||
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
|
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
|
||||||
(int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
|
(int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
|
||||||
|
|
||||||
// Specify the size of the sheet and the name associated with that size.
|
// Specify the size of the sheet and the name associated with that size.
|
||||||
// (If the "User size" option has been selected for the sheet size,
|
// (If the "User size" option has been selected for the sheet size,
|
||||||
|
@ -775,9 +775,9 @@ bool PS_PLOTTER::StartPlot()
|
||||||
// within the Document Structuring Convention.
|
// within the Document Structuring Convention.
|
||||||
fputs( "%%Page: 1 1\n"
|
fputs( "%%Page: 1 1\n"
|
||||||
"%%BeginPageSetup\n"
|
"%%BeginPageSetup\n"
|
||||||
"gsave\n"
|
"gsave\n"
|
||||||
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
||||||
"linemode1\n", outputFile );
|
"linemode1\n", outputFile );
|
||||||
|
|
||||||
|
|
||||||
// Rototranslate the coordinate to achieve the landscape layout
|
// Rototranslate the coordinate to achieve the landscape layout
|
||||||
|
@ -803,7 +803,7 @@ bool PS_PLOTTER::EndPlot()
|
||||||
wxASSERT( outputFile );
|
wxASSERT( outputFile );
|
||||||
fputs( "showpage\n"
|
fputs( "showpage\n"
|
||||||
"grestore\n"
|
"grestore\n"
|
||||||
"%%EOF\n", outputFile );
|
"%%EOF\n", outputFile );
|
||||||
fclose( outputFile );
|
fclose( outputFile );
|
||||||
outputFile = NULL;
|
outputFile = NULL;
|
||||||
|
|
||||||
|
@ -813,15 +813,15 @@ bool PS_PLOTTER::EndPlot()
|
||||||
|
|
||||||
|
|
||||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_COLOR_T aColor,
|
enum EDA_COLOR_T aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
double aOrient,
|
double aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold )
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
@ -874,7 +874,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
if( m_textMode == PLOTTEXTMODE_PHANTOM )
|
if( m_textMode == PLOTTEXTMODE_PHANTOM )
|
||||||
{
|
{
|
||||||
fputsPostscriptString( outputFile, aText );
|
fputsPostscriptString( outputFile, aText );
|
||||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||||
fprintf( outputFile, " %g %g phantomshow\n",
|
fprintf( outputFile, " %g %g phantomshow\n",
|
||||||
pos_dev.x, pos_dev.y );
|
pos_dev.x, pos_dev.y );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,36 @@
|
||||||
/*********************/
|
/*
|
||||||
/* projet_config.cpp */
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
/*********************/
|
*
|
||||||
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2011 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 <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <param_config.h>
|
#include <config_params.h>
|
||||||
|
|
||||||
#include <wx/apptrait.h>
|
#include <wx/apptrait.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
@ -19,8 +40,89 @@
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
|
||||||
#define CONFIG_VERSION 1
|
void wxConfigSaveParams( wxConfigBase* aCfg,
|
||||||
#define FORCE_LOCAL_CONFIG true
|
const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
|
||||||
|
{
|
||||||
|
wxASSERT( aCfg );
|
||||||
|
|
||||||
|
BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
|
||||||
|
{
|
||||||
|
if( param.m_Group )
|
||||||
|
aCfg->SetPath( param.m_Group );
|
||||||
|
else
|
||||||
|
aCfg->SetPath( aGroup );
|
||||||
|
|
||||||
|
if( param.m_Setup )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||||
|
{
|
||||||
|
if( param.m_Ident )
|
||||||
|
aCfg->DeleteGroup( param.m_Ident );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
param.SaveParam( aCfg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxConfigLoadParams( wxConfigBase* aCfg,
|
||||||
|
const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
|
||||||
|
{
|
||||||
|
wxASSERT( aCfg );
|
||||||
|
|
||||||
|
BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
|
||||||
|
{
|
||||||
|
if( param.m_Group )
|
||||||
|
aCfg->SetPath( param.m_Group );
|
||||||
|
else
|
||||||
|
aCfg->SetPath( aGroup );
|
||||||
|
|
||||||
|
if( param.m_Setup )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
param.ReadParam( aCfg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
|
||||||
|
{
|
||||||
|
wxASSERT( aCfg );
|
||||||
|
|
||||||
|
BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
|
||||||
|
{
|
||||||
|
if( !param.m_Setup )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||||
|
{
|
||||||
|
if( param.m_Ident )
|
||||||
|
aCfg->DeleteGroup( param.m_Ident );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
param.SaveParam( aCfg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
|
||||||
|
{
|
||||||
|
wxASSERT( aCfg );
|
||||||
|
|
||||||
|
BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
|
||||||
|
{
|
||||||
|
if( !param.m_Setup )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
param.ReadParam( aCfg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
|
void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
|
||||||
|
@ -35,220 +137,6 @@ void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
|
|
||||||
const wxString& GroupName,
|
|
||||||
bool ForceUseLocalConfig )
|
|
||||||
{
|
|
||||||
wxFileName fn = fileName;
|
|
||||||
|
|
||||||
// Free old config file.
|
|
||||||
if( m_projectSettings )
|
|
||||||
{
|
|
||||||
delete m_projectSettings;
|
|
||||||
m_projectSettings = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Force the file extension.
|
|
||||||
* This allows the user to enter a filename without extension
|
|
||||||
* or use an existing name to create the project file
|
|
||||||
*/
|
|
||||||
if( fn.GetExt() != ProjectFileExtension )
|
|
||||||
{
|
|
||||||
fn.SetExt( ProjectFileExtension );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update the library search path list if a new project file is loaded. */
|
|
||||||
if( m_projectFileName != fn )
|
|
||||||
{
|
|
||||||
RemoveLibraryPath( m_projectFileName.GetPath() );
|
|
||||||
InsertLibraryPath( fn.GetPath(), 0 );
|
|
||||||
m_projectFileName = fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init local config filename
|
|
||||||
if( ForceUseLocalConfig || fn.FileExists() )
|
|
||||||
{
|
|
||||||
m_CurrentOptionFile = fn.GetFullPath();
|
|
||||||
m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString,
|
|
||||||
m_CurrentOptionFile, wxEmptyString );
|
|
||||||
m_projectSettings->DontCreateOnDemand();
|
|
||||||
|
|
||||||
if( ForceUseLocalConfig )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* Check the application version against the version saved in the
|
|
||||||
* project file.
|
|
||||||
*
|
|
||||||
* TODO: Push the version test up the stack so that when one of the
|
|
||||||
* KiCad application version changes, the other applications
|
|
||||||
* settings do not get updated. Practically, this can go away.
|
|
||||||
* It isn't used anywhere as far as I know (WLS).
|
|
||||||
*/
|
|
||||||
int version = -1;
|
|
||||||
int def_version = 0;
|
|
||||||
|
|
||||||
m_projectSettings->SetPath( GroupName );
|
|
||||||
version = m_projectSettings->Read( wxT( "version" ), def_version );
|
|
||||||
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
|
|
||||||
|
|
||||||
if( version > 0 )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delete m_projectSettings; // Version incorrect
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString defaultFileName;
|
|
||||||
defaultFileName = m_libSearchPaths.FindValidPath( wxT( "kicad.pro" ) );
|
|
||||||
|
|
||||||
if( defaultFileName.IsEmpty() )
|
|
||||||
{
|
|
||||||
wxLogDebug( wxT( "Template file <kicad.pro> not found." ) );
|
|
||||||
fn = wxFileName( GetTraits()->GetStandardPaths().GetDocumentsDir(),
|
|
||||||
wxT( "kicad" ), ProjectFileExtension );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fn = defaultFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new project file using the default name.
|
|
||||||
m_CurrentOptionFile = fn.GetFullPath();
|
|
||||||
m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString,
|
|
||||||
wxEmptyString, fn.GetFullPath() );
|
|
||||||
m_projectSettings->DontCreateOnDemand();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::WriteProjectConfig( const wxString& fileName,
|
|
||||||
const wxString& GroupName,
|
|
||||||
const PARAM_CFG_ARRAY& params )
|
|
||||||
{
|
|
||||||
ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );
|
|
||||||
|
|
||||||
/* Write date ( surtout pour eviter bug de wxFileConfig
|
|
||||||
* qui se trompe de rubrique si declaration [xx] en premiere ligne
|
|
||||||
* (en fait si groupe vide) */
|
|
||||||
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
|
|
||||||
|
|
||||||
m_projectSettings->Write( wxT( "update" ), DateAndTime() );
|
|
||||||
m_projectSettings->Write( wxT( "last_client" ), GetAppName() );
|
|
||||||
|
|
||||||
/* Save parameters */
|
|
||||||
m_projectSettings->DeleteGroup( GroupName ); // Erase all data
|
|
||||||
m_projectSettings->Flush();
|
|
||||||
|
|
||||||
m_projectSettings->SetPath( GroupName );
|
|
||||||
m_projectSettings->Write( wxT( "version" ), CONFIG_VERSION );
|
|
||||||
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
|
|
||||||
|
|
||||||
BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
|
|
||||||
{
|
|
||||||
if( param.m_Group )
|
|
||||||
m_projectSettings->SetPath( param.m_Group );
|
|
||||||
else
|
|
||||||
m_projectSettings->SetPath( GroupName );
|
|
||||||
|
|
||||||
if( param.m_Setup )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
|
||||||
{
|
|
||||||
if( param.m_Ident )
|
|
||||||
m_projectSettings->DeleteGroup( param.m_Ident );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
param.SaveParam( m_projectSettings );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_projectSettings->SetPath( UNIX_STRING_DIR_SEP );
|
|
||||||
|
|
||||||
delete m_projectSettings;
|
|
||||||
m_projectSettings = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
|
|
||||||
{
|
|
||||||
if( m_settings == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
unsigned count = List.size();
|
|
||||||
for( unsigned i=0; i<count; ++i )
|
|
||||||
{
|
|
||||||
const PARAM_CFG_BASE& param = List[i];
|
|
||||||
|
|
||||||
if( param.m_Setup == false )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
|
||||||
{
|
|
||||||
if( param.m_Ident )
|
|
||||||
m_settings->DeleteGroup( param.m_Ident );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
param.SaveParam( m_settings );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
|
|
||||||
const wxString& GroupName,
|
|
||||||
const PARAM_CFG_ARRAY& params,
|
|
||||||
bool Load_Only_if_New )
|
|
||||||
{
|
|
||||||
ReCreatePrjConfig( local_config_filename, GroupName, false );
|
|
||||||
|
|
||||||
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
|
|
||||||
wxString timestamp = m_projectSettings->Read( wxT( "update" ) );
|
|
||||||
|
|
||||||
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
|
|
||||||
&& (timestamp == m_CurrentOptionFileDateAndTime) )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_CurrentOptionFileDateAndTime = timestamp;
|
|
||||||
|
|
||||||
BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
|
|
||||||
{
|
|
||||||
if( param.m_Group )
|
|
||||||
m_projectSettings->SetPath( param.m_Group );
|
|
||||||
else
|
|
||||||
m_projectSettings->SetPath( GroupName );
|
|
||||||
|
|
||||||
if( param.m_Setup )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
param.ReadParam( m_projectSettings );
|
|
||||||
}
|
|
||||||
|
|
||||||
delete m_projectSettings;
|
|
||||||
m_projectSettings = NULL;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List )
|
|
||||||
{
|
|
||||||
BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
|
|
||||||
{
|
|
||||||
if( param.m_Setup == false )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
param.ReadParam( m_settings );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type,
|
PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type,
|
||||||
const wxChar* group )
|
const wxChar* group )
|
||||||
{
|
{
|
||||||
|
@ -286,7 +174,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
|
||||||
|
|
||||||
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int itmp = aConfig->Read( m_Ident, m_Default );
|
int itmp = aConfig->Read( m_Ident, m_Default );
|
||||||
|
@ -300,7 +188,7 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aConfig->Write( m_Ident, *m_Pt_param );
|
aConfig->Write( m_Ident, *m_Pt_param );
|
||||||
|
@ -330,7 +218,7 @@ PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool Insetup,
|
||||||
|
|
||||||
void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dtmp = (double) m_Default * m_BIU_to_cfgunit;
|
double dtmp = (double) m_Default * m_BIU_to_cfgunit;
|
||||||
|
@ -347,7 +235,7 @@ void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We cannot use aConfig->Write for a double, because
|
// We cannot use aConfig->Write for a double, because
|
||||||
|
@ -383,8 +271,9 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
|
||||||
|
|
||||||
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) );
|
EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) );
|
||||||
|
|
||||||
if( itmp == UNSPECIFIED_COLOR )
|
if( itmp == UNSPECIFIED_COLOR )
|
||||||
|
@ -395,7 +284,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aConfig->Write( m_Ident, ColorGetName( *m_Pt_param ) );
|
aConfig->Write( m_Ident, ColorGetName( *m_Pt_param ) );
|
||||||
|
@ -433,7 +322,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
|
||||||
|
|
||||||
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dtmp = m_Default;
|
double dtmp = m_Default;
|
||||||
|
@ -448,7 +337,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We cannot use aConfig->Write for a double, because
|
// We cannot use aConfig->Write for a double, because
|
||||||
|
@ -483,7 +372,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
|
||||||
|
|
||||||
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int itmp = aConfig->Read( m_Ident, (int) m_Default );
|
int itmp = aConfig->Read( m_Ident, (int) m_Default );
|
||||||
|
@ -494,7 +383,7 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aConfig->Write( m_Ident, *m_Pt_param );
|
aConfig->Write( m_Ident, *m_Pt_param );
|
||||||
|
@ -524,22 +413,22 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
|
||||||
|
|
||||||
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*m_Pt_param = aConfig->Read( m_Ident, m_default );
|
*m_Pt_param = aConfig->Read( m_Ident, m_default );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aConfig->Write( m_Ident, *m_Pt_param );
|
aConfig->Write( m_Ident, *m_Pt_param );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
|
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
|
||||||
wxString* ptparam,
|
wxString* ptparam,
|
||||||
const wxChar* group ) :
|
const wxChar* group ) :
|
||||||
|
@ -551,7 +440,7 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
|
||||||
|
|
||||||
void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString prm = aConfig->Read( m_Ident );
|
wxString prm = aConfig->Read( m_Ident );
|
||||||
|
@ -567,7 +456,7 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString prm = *m_Pt_param;
|
wxString prm = *m_Pt_param;
|
||||||
|
@ -588,7 +477,7 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
|
||||||
|
|
||||||
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int indexlib = 1; // We start indexlib to 1 because first
|
int indexlib = 1; // We start indexlib to 1 because first
|
||||||
|
@ -617,15 +506,15 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
|
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
|
||||||
{
|
{
|
||||||
if( m_Pt_param == NULL || aConfig == NULL )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxArrayString* libname_list = m_Pt_param;
|
wxArrayString* libname_list = m_Pt_param;
|
||||||
|
|
||||||
unsigned indexlib = 0;
|
|
||||||
wxString configkey;
|
wxString configkey;
|
||||||
wxString libname;
|
wxString libname;
|
||||||
|
|
||||||
for( ; indexlib < libname_list->GetCount(); indexlib++ )
|
for( unsigned indexlib = 0; indexlib < libname_list->GetCount(); indexlib++ )
|
||||||
{
|
{
|
||||||
configkey = m_Ident;
|
configkey = m_Ident;
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
|
|
||||||
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ static wxString HtmlNewline( const unsigned int amount = 1 );
|
||||||
static void InitKiCadAboutNew( AboutAppInfo& info )
|
static void InitKiCadAboutNew( AboutAppInfo& info )
|
||||||
{
|
{
|
||||||
// Set application specific icon
|
// Set application specific icon
|
||||||
const wxTopLevelWindow * const tlw = wxDynamicCast(::wxGetApp().GetTopWindow(), wxTopLevelWindow);
|
const wxTopLevelWindow* const tlw = wxDynamicCast( Pgm().App().GetTopWindow(), wxTopLevelWindow);
|
||||||
|
|
||||||
if( tlw )
|
if( tlw )
|
||||||
info.SetIcon( tlw->GetIcon() );
|
info.SetIcon( tlw->GetIcon() );
|
||||||
|
@ -56,10 +56,10 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set title */
|
/* Set title */
|
||||||
info.SetAppName( wxT( ".: " ) + wxGetApp().GetTitle() + wxT( " :." ) );
|
info.SetAppName( wxT( ".: " ) + Pgm().App().GetAppName() + wxT( " :." ) );
|
||||||
|
|
||||||
/* Copyright information */
|
/* Copyright information */
|
||||||
info.SetCopyright( wxT( "(C) 1992-2013 KiCad Developers Team" ) );
|
info.SetCopyright( wxT( "(C) 1992-2014 KiCad Developers Team" ) );
|
||||||
|
|
||||||
/* KiCad build version */
|
/* KiCad build version */
|
||||||
wxString version;
|
wxString version;
|
||||||
|
|
|
@ -24,12 +24,22 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dialog_shim.h>
|
#include <dialog_shim.h>
|
||||||
|
#include <kiway_player.h>
|
||||||
|
|
||||||
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
|
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name ) :
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name ) :
|
||||||
wxDialog( aParent, id, title, pos, size, style, name )
|
wxDialog( aParent, id, title, pos, size, style, name ),
|
||||||
|
KIWAY_HOLDER( 0 )
|
||||||
{
|
{
|
||||||
|
// pray that aParent is either a KIWAY_PLAYER or DIALOG_SHIM derivation.
|
||||||
|
KIWAY_HOLDER* h = dynamic_cast<KIWAY_HOLDER*>( aParent );
|
||||||
|
|
||||||
|
wxASSERT_MSG( h,
|
||||||
|
wxT( "DIALOG_SHIM's parent not derived from KIWAY_PLAYER nor DIALOG_SHIM" ) );
|
||||||
|
|
||||||
|
if( h )
|
||||||
|
SetKiway( this, &h->Kiway() );
|
||||||
|
|
||||||
#if DLGSHIM_USE_SETFOCUS
|
#if DLGSHIM_USE_SETFOCUS
|
||||||
Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) );
|
Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <dialog_get_component.h>
|
#include <dialog_get_component.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
|
||||||
#include <dialog_hotkeys_editor.h>
|
#include <dialog_hotkeys_editor.h>
|
||||||
|
@ -202,7 +202,7 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
|
||||||
|
|
||||||
wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ),
|
wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ),
|
||||||
_( "Select a key" ), C_COUNT, choices, this );
|
_( "Select a key" ), C_COUNT, choices, this );
|
||||||
int key = ReturnKeyCodeFromKeyName( keyname );
|
int key = KeyCodeFromKeyName( keyname );
|
||||||
|
|
||||||
if( key == 0 )
|
if( key == 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -251,7 +251,7 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
|
||||||
#endif
|
#endif
|
||||||
// See if this key code is handled in hotkeys names list
|
// See if this key code is handled in hotkeys names list
|
||||||
bool exists;
|
bool exists;
|
||||||
ReturnKeyNameFromKeyCode( key, &exists );
|
KeyNameFromKeyCode( key, &exists );
|
||||||
|
|
||||||
if( !exists ) // not handled, see hotkeys_basic.cpp
|
if( !exists ) // not handled, see hotkeys_basic.cpp
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_title_block.h>
|
#include <class_title_block.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <worksheet_shape_builder.h>
|
#include <worksheet_shape_builder.h>
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
#include <class_drawpanel_gal.h>
|
#include <class_drawpanel_gal.h>
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <msgpanel.h>
|
#include <msgpanel.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
|
@ -89,12 +90,12 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
|
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||||
ID_DRAWFRAME_TYPE aFrameType,
|
ID_DRAWFRAME_TYPE aFrameType,
|
||||||
const wxString& aTitle,
|
const wxString& aTitle,
|
||||||
const wxPoint& aPos, const wxSize& aSize,
|
const wxPoint& aPos, const wxSize& aSize,
|
||||||
long aStyle, const wxString & aFrameName ) :
|
long aStyle, const wxString & aFrameName ) :
|
||||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
|
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
|
||||||
{
|
{
|
||||||
m_drawToolBar = NULL;
|
m_drawToolBar = NULL;
|
||||||
m_optionsToolBar = NULL;
|
m_optionsToolBar = NULL;
|
||||||
|
@ -564,7 +565,7 @@ void EDA_DRAW_FRAME::SetPrevGrid()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
|
int EDA_DRAW_FRAME::BlockCommand( int key )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -615,25 +616,21 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::LoadSettings()
|
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxASSERT( wxGetApp().GetSettings() != NULL );
|
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||||
|
|
||||||
wxConfig* cfg = wxGetApp().GetSettings();
|
aCfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
|
||||||
|
|
||||||
EDA_BASE_FRAME::LoadSettings();
|
|
||||||
cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
|
|
||||||
bool btmp;
|
bool btmp;
|
||||||
|
if( aCfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
|
||||||
if ( cfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
|
|
||||||
SetGridVisibility( btmp );
|
SetGridVisibility( btmp );
|
||||||
|
|
||||||
int itmp;
|
int itmp;
|
||||||
|
if( aCfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
|
||||||
if( cfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
|
|
||||||
SetGridColor( ColorFromInt( itmp ) );
|
SetGridColor( ColorFromInt( itmp ) );
|
||||||
|
|
||||||
cfg->Read( m_FrameName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
|
aCfg->Read( m_FrameName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
|
||||||
|
|
||||||
// m_LastGridSizeId is an offset, expected to be >= 0
|
// m_LastGridSizeId is an offset, expected to be >= 0
|
||||||
if( m_LastGridSizeId < 0 )
|
if( m_LastGridSizeId < 0 )
|
||||||
|
@ -641,17 +638,14 @@ void EDA_DRAW_FRAME::LoadSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SaveSettings()
|
void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxASSERT( wxGetApp().GetSettings() != NULL );
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
|
||||||
wxConfig* cfg = wxGetApp().GetSettings();
|
aCfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
|
||||||
|
aCfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
|
||||||
EDA_BASE_FRAME::SaveSettings();
|
aCfg->Write( m_FrameName + GridColorEntryKeyword, ( long ) GetGridColor() );
|
||||||
cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
|
aCfg->Write( m_FrameName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
|
||||||
cfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
|
|
||||||
cfg->Write( m_FrameName + GridColorEntryKeyword, ( long ) GetGridColor() );
|
|
||||||
cfg->Write( m_FrameName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -715,7 +709,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
|
||||||
if( ( Block->GetCommand() != BLOCK_IDLE ) || ( Block->GetState() != STATE_NO_BLOCK ) )
|
if( ( Block->GetCommand() != BLOCK_IDLE ) || ( Block->GetState() != STATE_NO_BLOCK ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Block->SetCommand( (BLOCK_COMMAND_T) ReturnBlockCommand( aKey ) );
|
Block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
|
||||||
|
|
||||||
if( Block->GetCommand() == 0 )
|
if( Block->GetCommand() == 0 )
|
||||||
return false;
|
return false;
|
|
@ -28,7 +28,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_drawpanel_gal.h>
|
#include <class_drawpanel_gal.h>
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
|
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
|
|
||||||
|
@ -45,16 +46,17 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
|
||||||
#define CLIP_BOX_PADDING 2
|
#define CLIP_BOX_PADDING 2
|
||||||
|
|
||||||
// keys to store options in config:
|
// keys to store options in config:
|
||||||
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
|
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
|
||||||
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
|
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
|
||||||
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
|
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
|
||||||
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
|
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
|
||||||
|
|
||||||
/* Definitions for enabling and disabling debugging features in drawpanel.cpp.
|
|
||||||
* Please don't forget to turn these off before making any commits to Launchpad.
|
// Definitions for enabling and disabling debugging features in drawpanel.cpp.
|
||||||
*/
|
// Please don't forget to turn these off before making any commits to Launchpad.
|
||||||
#define DEBUG_SHOW_CLIP_RECT 0 // Set to 1 to draw clipping rectangle.
|
#define DEBUG_SHOW_CLIP_RECT 0 // Set to 1 to draw clipping rectangle.
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trace mask used to enable or disable the trace output of coordinates during drawing
|
* Trace mask used to enable or disable the trace output of coordinates during drawing
|
||||||
* functions. The coordinate dumping can be turned on by setting the WXTRACE environment
|
* functions. The coordinate dumping can be turned on by setting the WXTRACE environment
|
||||||
|
@ -122,12 +124,14 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||||
m_mouseCaptureCallback = NULL;
|
m_mouseCaptureCallback = NULL;
|
||||||
m_endMouseCaptureCallback = NULL;
|
m_endMouseCaptureCallback = NULL;
|
||||||
|
|
||||||
if( wxGetApp().GetSettings() )
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
|
|
||||||
|
if( cfg )
|
||||||
{
|
{
|
||||||
wxGetApp().GetSettings()->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false );
|
cfg->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false );
|
||||||
wxGetApp().GetSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
|
cfg->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
|
||||||
wxGetApp().GetSettings()->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
|
cfg->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
|
||||||
wxGetApp().GetSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
|
cfg->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_requestAutoPan = false;
|
m_requestAutoPan = false;
|
||||||
|
@ -149,10 +153,15 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||||
|
|
||||||
EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
|
EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
|
||||||
{
|
{
|
||||||
wxGetApp().GetSettings()->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
wxGetApp().GetSettings()->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
|
|
||||||
wxGetApp().GetSettings()->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
|
if( cfg )
|
||||||
wxGetApp().GetSettings()->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan );
|
{
|
||||||
|
cfg->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
|
||||||
|
cfg->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
|
||||||
|
cfg->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
|
||||||
|
cfg->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ static const char* GetHersheyShapeDescription( int AsciiCode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aWidth )
|
int GraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aWidth )
|
||||||
{
|
{
|
||||||
int tally = 0;
|
int tally = 0;
|
||||||
int char_count = aText.length();
|
int char_count = aText.length();
|
||||||
|
@ -315,7 +315,7 @@ void DrawGraphicText( EDA_RECT* aClipBox,
|
||||||
|
|
||||||
current_char_pos = aPos;
|
current_char_pos = aPos;
|
||||||
|
|
||||||
dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth );
|
dx = GraphicTextWidth( aText, size_h, aItalic, aWidth );
|
||||||
dy = size_v;
|
dy = size_v;
|
||||||
|
|
||||||
/* Do not draw the text if out of draw area! */
|
/* Do not draw the text if out of draw area! */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <eda_dde.h>
|
#include <eda_dde.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
@ -14,23 +14,25 @@
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::ReadPdfBrowserInfos()
|
void PGM_BASE::ReadPdfBrowserInfos()
|
||||||
{
|
{
|
||||||
wxASSERT( m_commonSettings != NULL );
|
wxASSERT( m_common_settings );
|
||||||
|
|
||||||
|
wxString browser = m_common_settings->Read( wxT( "PdfBrowserName" ), wxEmptyString );
|
||||||
|
SetPdfBrowserName( browser );
|
||||||
|
|
||||||
m_PdfBrowser = m_commonSettings->Read( wxT( "PdfBrowserName" ), wxEmptyString );
|
|
||||||
int tmp;
|
int tmp;
|
||||||
m_commonSettings->Read( wxT( "UseSystemBrowser" ), &tmp, 0 );
|
m_common_settings->Read( wxT( "UseSystemBrowser" ), &tmp, 0 );
|
||||||
m_useSystemPdfBrowser = tmp != 0;
|
m_use_system_pdf_browser = bool( tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::WritePdfBrowserInfos()
|
void PGM_BASE::WritePdfBrowserInfos()
|
||||||
{
|
{
|
||||||
wxASSERT( m_commonSettings != NULL );
|
wxASSERT( m_common_settings );
|
||||||
|
|
||||||
m_commonSettings->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
|
m_common_settings->Write( wxT( "PdfBrowserName" ), GetPdfBrowserName() );
|
||||||
m_commonSettings->Write( wxT( "UseSystemBrowser" ), m_useSystemPdfBrowser );
|
m_common_settings->Write( wxT( "UseSystemBrowser" ), m_use_system_pdf_browser );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +128,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
|
|
||||||
if( !wxFileExists( fullfilename ) )
|
if( !wxFileExists( fullfilename ) )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Doc File <%s> not found" ), GetChars( aDocName ) );
|
msg.Printf( _( "Doc File '%s' not found" ), GetChars( aDocName ) );
|
||||||
DisplayError( aFrame, msg );
|
DisplayError( aFrame, msg );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ EDA_TEXT::~EDA_TEXT()
|
||||||
|
|
||||||
int EDA_TEXT::LenSize( const wxString& aLine ) const
|
int EDA_TEXT::LenSize( const wxString& aLine ) const
|
||||||
{
|
{
|
||||||
return ReturnGraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold );
|
return GraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
1297
common/edaappl.cpp
1297
common/edaappl.cpp
File diff suppressed because it is too large
Load Diff
|
@ -38,7 +38,7 @@
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <footprint_info.h>
|
#include <footprint_info.h>
|
||||||
#include <io_mgr.h>
|
#include <io_mgr.h>
|
||||||
|
|
|
@ -24,13 +24,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <fctsys.h>
|
||||||
#include <wx/config.h> // wxExpandEnvVars()
|
#include <wx/config.h> // wxExpandEnvVars()
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <appl_wxstruct.h>
|
//#include <pgm_base.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
|
#include <search_stack.h>
|
||||||
#include <pcb_netlist.h>
|
#include <pcb_netlist.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
#include <footprint_info.h>
|
#include <footprint_info.h>
|
||||||
|
@ -43,20 +46,7 @@
|
||||||
using namespace FP_LIB_TABLE_T;
|
using namespace FP_LIB_TABLE_T;
|
||||||
|
|
||||||
|
|
||||||
/**
|
static const wxChar global_tbl_name[] = wxT( "fp-lib-table" );
|
||||||
* Definition for enabling and disabling footprint library trace output. See the
|
|
||||||
* wxWidgets documentation on using the WXTRACE environment variable.
|
|
||||||
*/
|
|
||||||
static const wxString traceFpLibTable( wxT( "KicadFpLibTable" ) );
|
|
||||||
|
|
||||||
|
|
||||||
/// The footprint library table name used when no project file is passed to Pcbnew or CvPcb.
|
|
||||||
/// This is used temporarily to store the project specific library table until the project
|
|
||||||
/// file being edited is save. It is then moved to the file fp-lib-table in the folder where
|
|
||||||
/// the project file is saved.
|
|
||||||
static wxString defaultProjectFileName( wxT( "prj-fp-lib-table" ) );
|
|
||||||
|
|
||||||
static wxString defaultFileName( wxT( "fp-lib-table" ) );
|
|
||||||
|
|
||||||
|
|
||||||
void FP_LIB_TABLE::ROW::SetType( const wxString& aType )
|
void FP_LIB_TABLE::ROW::SetType( const wxString& aType )
|
||||||
|
@ -406,19 +396,6 @@ void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_LIB_TABLE::Save( const wxFileName& aPath ) const throw( IO_ERROR )
|
|
||||||
{
|
|
||||||
wxFileName fn = GetProjectFileName( aPath );
|
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Saving footprint libary table <%s>." ),
|
|
||||||
GetChars( fn.GetFullPath() ) );
|
|
||||||
|
|
||||||
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
|
||||||
Format( &sf, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define OPT_SEP '|' ///< options separator character
|
#define OPT_SEP '|' ///< options separator character
|
||||||
|
|
||||||
PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList )
|
PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList )
|
||||||
|
@ -680,33 +657,8 @@ bool FP_LIB_TABLE::IsEmpty( bool aIncludeFallback )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FP_LIB_TABLE::MissingLegacyLibs( const wxArrayString& aLibNames, wxString* aErrorMsg )
|
bool FP_LIB_TABLE::ConvertFromLegacy( SEARCH_STACK& aSStack, NETLIST& aNetList,
|
||||||
{
|
const wxArrayString& aLibNames, REPORTER* aReporter ) throw( IO_ERROR )
|
||||||
bool retv = false;
|
|
||||||
|
|
||||||
for( unsigned i = 0; i < aLibNames.GetCount(); i++ )
|
|
||||||
{
|
|
||||||
wxFileName fn = wxFileName( wxEmptyString, aLibNames[i], LegacyFootprintLibPathExtension );
|
|
||||||
wxString legacyLibPath = wxGetApp().FindLibraryPath( fn );
|
|
||||||
|
|
||||||
if( legacyLibPath.IsEmpty() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( FindRowByURI( legacyLibPath ) == 0 )
|
|
||||||
{
|
|
||||||
retv = true;
|
|
||||||
|
|
||||||
if( aErrorMsg )
|
|
||||||
*aErrorMsg += wxT( "\"" ) + legacyLibPath + wxT( "\"\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retv;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aLibNames,
|
|
||||||
REPORTER* aReporter ) throw( IO_ERROR )
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
FPID lastFPID;
|
FPID lastFPID;
|
||||||
|
@ -720,7 +672,6 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
aNetList.SortByFPID();
|
aNetList.SortByFPID();
|
||||||
|
|
||||||
wxString libPath;
|
wxString libPath;
|
||||||
wxFileName fn;
|
|
||||||
|
|
||||||
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
|
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
|
||||||
|
|
||||||
|
@ -738,9 +689,9 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aLibNames.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aLibNames.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
fn = wxFileName( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
|
wxFileName fn( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
|
||||||
|
|
||||||
libPath = wxGetApp().FindLibraryPath( fn );
|
libPath = aSStack.FindValidPath( fn );
|
||||||
|
|
||||||
if( !libPath )
|
if( !libPath )
|
||||||
{
|
{
|
||||||
|
@ -766,7 +717,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( module == NULL )
|
if( !module )
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
|
@ -780,6 +731,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
// Clear the footprint assignment since the old library lookup method is no
|
// Clear the footprint assignment since the old library lookup method is no
|
||||||
// longer valid.
|
// longer valid.
|
||||||
FPID emptyFPID;
|
FPID emptyFPID;
|
||||||
|
|
||||||
component->SetFPID( emptyFPID );
|
component->SetFPID( emptyFPID );
|
||||||
retv = false;
|
retv = false;
|
||||||
continue;
|
continue;
|
||||||
|
@ -800,7 +752,9 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
|
|
||||||
if( wxFileName::GetPathSeparator() == wxChar( '\\' )
|
if( wxFileName::GetPathSeparator() == wxChar( '\\' )
|
||||||
&& uri.Find( wxChar( '/' ) ) >= 0 )
|
&& uri.Find( wxChar( '/' ) ) >= 0 )
|
||||||
|
{
|
||||||
uri.Replace( wxT( "/"), wxT( "\\" ) );
|
uri.Replace( wxT( "/"), wxT( "\\" ) );
|
||||||
|
}
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
if( uri.CmpNoCase( libPath ) )
|
if( uri.CmpNoCase( libPath ) )
|
||||||
#else
|
#else
|
||||||
|
@ -818,7 +772,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component `%s` footprint '%s' legacy library path <%s > "
|
msg.Printf( _( "Component '%s' footprint '%s' legacy library path '%s' "
|
||||||
"was not found in the footprint library table.\n" ),
|
"was not found in the footprint library table.\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( component->GetFPID().Format() ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
|
@ -836,7 +790,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component `%s` FPID '%s' is not valid.\n" ),
|
msg.Printf( _( "Component '%s' FPID '%s' is not valid.\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( newFPID.Format() ) );
|
GetChars( newFPID.Format() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
@ -857,65 +811,16 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_LIB_TABLE::SetProjectPathEnvVariable( const wxFileName& aPath )
|
|
||||||
{
|
|
||||||
wxString path;
|
|
||||||
|
|
||||||
if( !aPath.IsOk() || !aPath.DirExists() )
|
|
||||||
path = wxEmptyString;
|
|
||||||
else
|
|
||||||
path = aPath.GetPath();
|
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Setting env %s to '%s'." ),
|
|
||||||
GetChars( ProjectPathEnvVariableName() ), GetChars( path ) );
|
|
||||||
wxSetEnv( ProjectPathEnvVariableName(), path );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const wxString FP_LIB_TABLE::ProjectPathEnvVariableName()
|
|
||||||
{
|
|
||||||
return wxT( "KIPRJMOD" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
|
const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
|
||||||
{
|
{
|
||||||
return wxT( KISYSMOD );
|
return wxT( "KISYSMOD" );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString FP_LIB_TABLE::GetProjectFileName( const wxFileName& aPath )
|
|
||||||
{
|
|
||||||
wxFileName fn = aPath;
|
|
||||||
|
|
||||||
// Set $KICAD_PRJ_PATH to user's configuration path if aPath is not set or does not exist.
|
|
||||||
if( !aPath.IsOk() || !aPath.DirExists() )
|
|
||||||
{
|
|
||||||
fn.AssignDir( wxStandardPaths::Get().GetUserConfigDir() );
|
|
||||||
|
|
||||||
#if defined( __WINDOWS__ )
|
|
||||||
fn.AppendDir( wxT( "kicad" ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fn.SetName( defaultProjectFileName );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fn.AssignDir( aPath.GetPath() );
|
|
||||||
fn.SetName( defaultFileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Project specific footprint library table file '%s'." ),
|
|
||||||
GetChars( fn.GetFullPath() ) );
|
|
||||||
|
|
||||||
return fn.GetFullPath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
|
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
|
||||||
{
|
{
|
||||||
bool tableExists = true;
|
bool tableExists = true;
|
||||||
wxFileName fn = GetGlobalTableFileName();
|
wxFileName fn = GetGlobalTableFileName();
|
||||||
|
|
||||||
if( !fn.FileExists() )
|
if( !fn.FileExists() )
|
||||||
{
|
{
|
||||||
|
@ -927,21 +832,22 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS
|
||||||
GetChars( fn.GetPath() ) ) );
|
GetChars( fn.GetPath() ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to copy the default global file table from the KiCad template folder to
|
// Attempt to copy the default global file table from the KiCad
|
||||||
// the users home configuration path.
|
// template folder to the user's home configuration path.
|
||||||
wxString fileName = wxGetApp().FindLibraryPath( defaultFileName );
|
wxString fileName = Kiface().KifaceSearch().FindValidPath( global_tbl_name );
|
||||||
|
|
||||||
// The fallback is to create an empty global footprint table for the user to populate.
|
// The fallback is to create an empty global footprint table for the user to populate.
|
||||||
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
|
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
|
||||||
{
|
{
|
||||||
FP_LIB_TABLE emptyTable;
|
FP_LIB_TABLE emptyTable;
|
||||||
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
||||||
|
|
||||||
emptyTable.Format( &sf, 0 );
|
emptyTable.Format( &sf, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LINE_READER reader( fn.GetFullPath() );
|
FILE_LINE_READER reader( fn.GetFullPath() );
|
||||||
FP_LIB_TABLE_LEXER lexer( &reader );
|
FP_LIB_TABLE_LEXER lexer( &reader );
|
||||||
|
|
||||||
aTable.Parse( &lexer );
|
aTable.Parse( &lexer );
|
||||||
return tableExists;
|
return tableExists;
|
||||||
|
@ -952,38 +858,38 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
|
||||||
|
// This is possibly problematic with an uncertain wxApp title, which is now
|
||||||
|
// the case. We'll need a better technique soon.
|
||||||
fn.SetPath( wxStandardPaths::Get().GetUserConfigDir() );
|
fn.SetPath( wxStandardPaths::Get().GetUserConfigDir() );
|
||||||
|
|
||||||
#if defined( __WINDOWS__ )
|
#if defined( __WINDOWS__ )
|
||||||
fn.AppendDir( wxT( "kicad" ) );
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fn.SetName( GetFileName() );
|
fn.SetName( global_tbl_name );
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Global footprint library table file '%s'." ),
|
|
||||||
GetChars( fn.GetFullPath() ) );
|
|
||||||
|
|
||||||
return fn.GetFullPath();
|
return fn.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prefer wxString filename so it can be seen in a debugger easier than wxFileName.
|
||||||
|
|
||||||
const wxString& FP_LIB_TABLE::GetFileName()
|
void FP_LIB_TABLE::Load( const wxString& aFileName )
|
||||||
{
|
|
||||||
return defaultFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FP_LIB_TABLE::Load( const wxFileName& aFileName, FP_LIB_TABLE* aFallBackTable )
|
|
||||||
throw( IO_ERROR )
|
throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
fallBack = aFallBackTable;
|
|
||||||
|
|
||||||
// Empty footprint library tables are valid.
|
// Empty footprint library tables are valid.
|
||||||
if( aFileName.IsOk() && aFileName.FileExists() )
|
if( wxFileName::IsFileReadable( aFileName ) )
|
||||||
{
|
{
|
||||||
FILE_LINE_READER reader( aFileName.GetFullPath() );
|
FILE_LINE_READER reader( aFileName );
|
||||||
FP_LIB_TABLE_LEXER lexer( &reader );
|
FP_LIB_TABLE_LEXER lexer( &reader );
|
||||||
|
|
||||||
Parse( &lexer );
|
Parse( &lexer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FP_LIB_TABLE::Save( const wxString& aFileName ) const throw( IO_ERROR )
|
||||||
|
{
|
||||||
|
FILE_OUTPUTFORMATTER sf( aFileName );
|
||||||
|
Format( &sf, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -952,11 +952,11 @@ void OPENGL_GAL::initGlew()
|
||||||
// Check the OpenGL version (minimum 2.1 is required)
|
// Check the OpenGL version (minimum 2.1 is required)
|
||||||
if( GLEW_VERSION_2_1 )
|
if( GLEW_VERSION_2_1 )
|
||||||
{
|
{
|
||||||
wxLogInfo( wxT( "OpenGL Version 2.1 supported." ) );
|
wxLogInfo( wxT( "OpenGL 2.1 supported." ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DisplayError( parentWindow, wxT( "OpenGL Version 2.1 is not supported!" ) );
|
DisplayError( parentWindow, wxT( "OpenGL 2.1 or higher is required!" ) );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -299,14 +299,14 @@ wxString FindKicadHelpPath()
|
||||||
bool PathFound = false;
|
bool PathFound = false;
|
||||||
|
|
||||||
/* find kicad/help/ */
|
/* find kicad/help/ */
|
||||||
tmp = wxGetApp().GetExecutablePath();
|
tmp = Pgm().GetExecutablePath();
|
||||||
|
|
||||||
if( tmp.Last() == '/' )
|
if( tmp.Last() == '/' )
|
||||||
tmp.RemoveLast();
|
tmp.RemoveLast();
|
||||||
|
|
||||||
FullPath = tmp.BeforeLast( '/' ); // cd ..
|
FullPath = tmp.BeforeLast( '/' ); // cd ..
|
||||||
FullPath += wxT( "/doc/help/" );
|
FullPath += wxT( "/doc/help/" );
|
||||||
LocaleString = wxGetApp().GetLocale()->GetCanonicalName();
|
LocaleString = Pgm().GetLocale()->GetCanonicalName();
|
||||||
|
|
||||||
wxString path_tmp = FullPath;
|
wxString path_tmp = FullPath;
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -319,9 +319,9 @@ wxString FindKicadHelpPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find kicad/help/ from environment variable KICAD */
|
/* find kicad/help/ from environment variable KICAD */
|
||||||
if( !PathFound && wxGetApp().IsKicadEnvVariableDefined() )
|
if( !PathFound && Pgm().IsKicadEnvVariableDefined() )
|
||||||
{
|
{
|
||||||
FullPath = wxGetApp().GetKicadEnvVariable() + wxT( "/doc/help/" );
|
FullPath = Pgm().GetKicadEnvVariable() + wxT( "/doc/help/" );
|
||||||
|
|
||||||
if( wxDirExists( FullPath ) )
|
if( wxDirExists( FullPath ) )
|
||||||
PathFound = true;
|
PathFound = true;
|
||||||
|
@ -379,7 +379,7 @@ wxString FindKicadFile( const wxString& shortname )
|
||||||
/* Test the presence of the file in the directory shortname of
|
/* Test the presence of the file in the directory shortname of
|
||||||
* the KiCad binary path.
|
* the KiCad binary path.
|
||||||
*/
|
*/
|
||||||
FullFileName = wxGetApp().GetExecutablePath() + shortname;
|
FullFileName = Pgm().GetExecutablePath() + shortname;
|
||||||
|
|
||||||
if( wxFileExists( FullFileName ) )
|
if( wxFileExists( FullFileName ) )
|
||||||
return FullFileName;
|
return FullFileName;
|
||||||
|
@ -387,9 +387,9 @@ wxString FindKicadFile( const wxString& shortname )
|
||||||
/* Test the presence of the file in the directory shortname
|
/* Test the presence of the file in the directory shortname
|
||||||
* defined by the environment variable KiCad.
|
* defined by the environment variable KiCad.
|
||||||
*/
|
*/
|
||||||
if( wxGetApp().IsKicadEnvVariableDefined() )
|
if( Pgm().IsKicadEnvVariableDefined() )
|
||||||
{
|
{
|
||||||
FullFileName = wxGetApp().GetKicadEnvVariable() + shortname;
|
FullFileName = Pgm().GetKicadEnvVariable() + shortname;
|
||||||
|
|
||||||
if( wxFileExists( FullFileName ) )
|
if( wxFileExists( FullFileName ) )
|
||||||
return FullFileName;
|
return FullFileName;
|
||||||
|
@ -426,7 +426,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) )
|
if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) )
|
||||||
{
|
{
|
||||||
return ProcessExecute( wxGetApp().GetExecutablePath() + wxT( "/" )
|
return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" )
|
||||||
+ ExecFile + wxT( " " )
|
+ ExecFile + wxT( " " )
|
||||||
+ param, wxEXEC_ASYNC, callback );
|
+ param, wxEXEC_ASYNC, callback );
|
||||||
}
|
}
|
||||||
|
@ -450,26 +450,26 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString ReturnKicadDatasPath()
|
wxString KicadDatasPath()
|
||||||
{
|
{
|
||||||
bool PathFound = false;
|
bool PathFound = false;
|
||||||
wxString data_path;
|
wxString data_path;
|
||||||
|
|
||||||
if( wxGetApp().IsKicadEnvVariableDefined() ) // Path defined by the KICAD environment variable.
|
if( Pgm().IsKicadEnvVariableDefined() ) // Path defined by the KICAD environment variable.
|
||||||
{
|
{
|
||||||
data_path = wxGetApp().GetKicadEnvVariable();
|
data_path = Pgm().GetKicadEnvVariable();
|
||||||
PathFound = true;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
else // Path of executables.
|
else // Path of executables.
|
||||||
{
|
{
|
||||||
wxString tmp = wxGetApp().GetExecutablePath();
|
wxString tmp = Pgm().GetExecutablePath();
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
tmp.MakeLower();
|
tmp.MakeLower();
|
||||||
#endif
|
#endif
|
||||||
if( tmp.Contains( wxT( "kicad" ) ) )
|
if( tmp.Contains( wxT( "kicad" ) ) )
|
||||||
{
|
{
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
tmp = wxGetApp().GetExecutablePath();
|
tmp = Pgm().GetExecutablePath();
|
||||||
#endif
|
#endif
|
||||||
if( tmp.Last() == '/' )
|
if( tmp.Last() == '/' )
|
||||||
tmp.RemoveLast();
|
tmp.RemoveLast();
|
||||||
|
@ -527,47 +527,6 @@ wxString ReturnKicadDatasPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString& EDA_APP::GetEditorName()
|
|
||||||
{
|
|
||||||
wxString editorname = m_EditorName;
|
|
||||||
|
|
||||||
// We get the preferred editor name from environment variable first.
|
|
||||||
if( editorname.IsEmpty() )
|
|
||||||
{
|
|
||||||
// If there is no EDITOR variable set, try the desktop default
|
|
||||||
if(!wxGetEnv( wxT( "EDITOR" ), &editorname ))
|
|
||||||
{
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
editorname = "/usr/bin/open";
|
|
||||||
#elif __WXX11__
|
|
||||||
editorname = "/usr/bin/xdg-open";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( editorname.IsEmpty() ) // We must get a preferred editor name
|
|
||||||
{
|
|
||||||
DisplayInfoMessage( NULL,
|
|
||||||
_( "No default editor found, you must choose it" ) );
|
|
||||||
wxString mask( wxT( "*" ) );
|
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
|
||||||
mask += wxT( ".exe" );
|
|
||||||
#endif
|
|
||||||
editorname = EDA_FileSelector( _( "Preferred Editor:" ), wxEmptyString,
|
|
||||||
wxEmptyString, wxEmptyString, mask,
|
|
||||||
NULL, wxFD_OPEN, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !editorname.IsEmpty() )
|
|
||||||
{
|
|
||||||
m_EditorName = editorname;
|
|
||||||
m_commonSettings->Write( wxT( "Editor" ), m_EditorName );
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_EditorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool OpenPDF( const wxString& file )
|
bool OpenPDF( const wxString& file )
|
||||||
{
|
{
|
||||||
wxString command;
|
wxString command;
|
||||||
|
@ -575,12 +534,12 @@ bool OpenPDF( const wxString& file )
|
||||||
wxString type;
|
wxString type;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
wxGetApp().ReadPdfBrowserInfos();
|
Pgm().ReadPdfBrowserInfos();
|
||||||
|
|
||||||
if( !wxGetApp().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
|
if( !Pgm().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
|
||||||
{
|
{
|
||||||
AddDelimiterString( filename );
|
AddDelimiterString( filename );
|
||||||
command = wxGetApp().GetPdfBrowserFileName() + wxT( " " ) + filename;
|
command = Pgm().GetPdfBrowserName() + wxT( " " ) + filename;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1346,113 +1346,6 @@ void GRBezier( EDA_RECT* ClipBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 )
|
|
||||||
{
|
|
||||||
/* Memoization storage. This could be potentially called for each
|
|
||||||
* color merge so a cache is useful (there are few colours anyway) */
|
|
||||||
static EDA_COLOR_T mix_cache[NBCOLORS][NBCOLORS];
|
|
||||||
|
|
||||||
// TODO how is alpha used? it's a mac only thing, I have no idea
|
|
||||||
aColor1 = ColorGetBase( aColor1 );
|
|
||||||
aColor2 = ColorGetBase( aColor2 );
|
|
||||||
|
|
||||||
// First easy thing: a black gives always the other colour
|
|
||||||
if( aColor1 == BLACK )
|
|
||||||
return aColor2;
|
|
||||||
if( aColor2 == BLACK)
|
|
||||||
return aColor1;
|
|
||||||
|
|
||||||
/* Now we are sure that black can't occur, so the rule is:
|
|
||||||
* BLACK means not computed yet. If we're lucky we already have
|
|
||||||
* an answer */
|
|
||||||
EDA_COLOR_T candidate = mix_cache[aColor1][aColor2];
|
|
||||||
if( candidate != BLACK )
|
|
||||||
return candidate;
|
|
||||||
|
|
||||||
// Blend the two colors (i.e. OR the RGB values)
|
|
||||||
const StructColors &c1 = g_ColorRefs[aColor1];
|
|
||||||
const StructColors &c2 = g_ColorRefs[aColor2];
|
|
||||||
|
|
||||||
// Ask the palette for the nearest color to the mix
|
|
||||||
wxColour mixed( c1.m_Red | c2.m_Red,
|
|
||||||
c1.m_Green | c2.m_Green,
|
|
||||||
c1.m_Blue | c2.m_Blue );
|
|
||||||
candidate = ColorFindNearest( mixed );
|
|
||||||
|
|
||||||
/* Here, BLACK is *not* a good answer, since it would recompute the next time.
|
|
||||||
* Even theorically its not possible (with the current rules), but
|
|
||||||
* maybe the metric will change in the future */
|
|
||||||
if( candidate == BLACK)
|
|
||||||
candidate = DARKDARKGRAY;
|
|
||||||
|
|
||||||
// Store the result in the cache. The operation is commutative, too
|
|
||||||
mix_cache[aColor1][aColor2] = candidate;
|
|
||||||
mix_cache[aColor2][aColor1] = candidate;
|
|
||||||
return candidate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
EDA_COLOR_T ColorByName( const wxString& aName )
|
|
||||||
{
|
|
||||||
// look for a match in the palette itself
|
|
||||||
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
|
|
||||||
{
|
|
||||||
if( 0 == aName.CmpNoCase( g_ColorRefs[trying].m_Name ) )
|
|
||||||
return trying;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not found, no idea...
|
|
||||||
return UNSPECIFIED_COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ColorIsLight( EDA_COLOR_T aColor )
|
|
||||||
{
|
|
||||||
const StructColors &c = g_ColorRefs[ColorGetBase( aColor )];
|
|
||||||
int r = c.m_Red;
|
|
||||||
int g = c.m_Green;
|
|
||||||
int b = c.m_Blue;
|
|
||||||
return ((r * r) + (g * g) + (b * b)) > (128 * 128 * 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
EDA_COLOR_T ColorFindNearest( const wxColour &aColor )
|
|
||||||
{
|
|
||||||
return ColorFindNearest( aColor.Red(), aColor.Green(), aColor.Blue() );
|
|
||||||
}
|
|
||||||
|
|
||||||
EDA_COLOR_T ColorFindNearest( int aR, int aG, int aB )
|
|
||||||
{
|
|
||||||
EDA_COLOR_T candidate = BLACK;
|
|
||||||
|
|
||||||
/* Find the 'nearest' color in the palette. This is fun. There is
|
|
||||||
a gazilion of metrics for the color space and no one of the
|
|
||||||
useful one is in the RGB color space. Who cares, this is a CAD,
|
|
||||||
not a photosomething...
|
|
||||||
|
|
||||||
I hereby declare that the distance is the sum of the square of the
|
|
||||||
component difference. Think about the RGB color cube. Now get the
|
|
||||||
euclidean distance, but without the square root... for ordering
|
|
||||||
purposes it's the same, obviously. Also each component can't be
|
|
||||||
less of the target one, since I found this currently work better...
|
|
||||||
*/
|
|
||||||
int nearest_distance = 255 * 255 * 3 + 1; // Can't beat this
|
|
||||||
|
|
||||||
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
|
|
||||||
{
|
|
||||||
const StructColors &c = g_ColorRefs[trying];
|
|
||||||
int distance = (aR - c.m_Red) * (aR - c.m_Red) +
|
|
||||||
(aG - c.m_Green) * (aG - c.m_Green) +
|
|
||||||
(aB - c.m_Blue) * (aB - c.m_Blue);
|
|
||||||
if( distance < nearest_distance && c.m_Red >= aR &&
|
|
||||||
c.m_Green >= aG && c.m_Blue >= aB )
|
|
||||||
{
|
|
||||||
nearest_distance = distance;
|
|
||||||
candidate = trying;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return candidate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y,
|
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y,
|
||||||
int aSize, EDA_COLOR_T aColor )
|
int aSize, EDA_COLOR_T aColor )
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ wxString HOTKEY_EDITOR_GRID_TABLE::GetValue( int row, int col )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ReturnKeyNameFromKeyCode( hotkey_descr->m_KeyCode );
|
return KeyNameFromKeyCode( hotkey_descr->m_KeyCode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <kiface_i.h>
|
||||||
#include <hotkeys_basic.h>
|
#include <hotkeys_basic.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
@ -61,9 +61,11 @@ wxString g_ModuleEditSectionTag( wxT( "[footprinteditor]" ) );
|
||||||
EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent )
|
EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent )
|
||||||
{
|
{
|
||||||
m_KeyCode = keycode; // Key code (ascii value for ascii keys
|
m_KeyCode = keycode; // Key code (ascii value for ascii keys
|
||||||
|
|
||||||
// or wxWidgets code for function key
|
// or wxWidgets code for function key
|
||||||
m_InfoMsg = infomsg; // info message.
|
m_InfoMsg = infomsg; // info message.
|
||||||
m_Idcommand = idcommand; // internal id for the corresponding
|
m_Idcommand = idcommand; // internal id for the corresponding
|
||||||
|
|
||||||
// command (see hotkey_id_commnand list)
|
// command (see hotkey_id_commnand list)
|
||||||
m_IdMenuEvent = idmenuevent; // id to call the corresponding event
|
m_IdMenuEvent = idmenuevent; // id to call the corresponding event
|
||||||
// (if any) (see id.h)
|
// (if any) (see id.h)
|
||||||
|
@ -137,13 +139,13 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
|
||||||
{ wxT( "" ), 0 }
|
{ wxT( "" ), 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MODIFIER_CTRL wxT( "Ctrl+" )
|
#define MODIFIER_CTRL wxT( "Ctrl+" )
|
||||||
#define MODIFIER_ALT wxT( "Alt+" )
|
#define MODIFIER_ALT wxT( "Alt+" )
|
||||||
#define MODIFIER_SHIFT wxT( "Shift+" )
|
#define MODIFIER_SHIFT wxT( "Shift+" )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnKeyNameFromKeyCode
|
* Function KeyNameFromKeyCode
|
||||||
* return the key name from the key code
|
* return the key name from the key code
|
||||||
* Only some wxWidgets key values are handled for function key ( see
|
* Only some wxWidgets key values are handled for function key ( see
|
||||||
* s_Hotkey_Name_List[] )
|
* s_Hotkey_Name_List[] )
|
||||||
|
@ -151,7 +153,7 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
|
||||||
* @param aIsFound = a pointer to a bool to return true if found, or false. an be NULL default)
|
* @param aIsFound = a pointer to a bool to return true if found, or false. an be NULL default)
|
||||||
* @return the key name in a wxString
|
* @return the key name in a wxString
|
||||||
*/
|
*/
|
||||||
wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
|
wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
|
||||||
{
|
{
|
||||||
wxString keyname, modifier, fullkeyname;
|
wxString keyname, modifier, fullkeyname;
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -237,7 +239,7 @@ wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList,
|
||||||
wxString keyname;
|
wxString keyname;
|
||||||
|
|
||||||
if( aList )
|
if( aList )
|
||||||
keyname = ReturnKeyNameFromCommandId( aList, aCommandId );
|
keyname = KeyNameFromCommandId( aList, aCommandId );
|
||||||
|
|
||||||
if( !keyname.IsEmpty() )
|
if( !keyname.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -278,14 +280,14 @@ wxString AddHotkeyName( const wxString& aText,
|
||||||
{
|
{
|
||||||
wxString msg = aText;
|
wxString msg = aText;
|
||||||
wxString keyname;
|
wxString keyname;
|
||||||
EDA_HOTKEY** List;
|
EDA_HOTKEY** list;
|
||||||
|
|
||||||
if( aDescList )
|
if( aDescList )
|
||||||
{
|
{
|
||||||
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
||||||
{
|
{
|
||||||
List = aDescList->m_HK_InfoList;
|
list = aDescList->m_HK_InfoList;
|
||||||
keyname = ReturnKeyNameFromCommandId( List, aCommandId );
|
keyname = KeyNameFromCommandId( list, aCommandId );
|
||||||
|
|
||||||
if( !keyname.IsEmpty() )
|
if( !keyname.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -313,13 +315,13 @@ wxString AddHotkeyName( const wxString& aText,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnKeyNameFromCommandId
|
* Function KeyNameFromCommandId
|
||||||
* return the key name from the Command id value ( m_Idcommand member value)
|
* return the key name from the Command id value ( m_Idcommand member value)
|
||||||
* @param aList = pointer to a EDA_HOTKEY list of commands
|
* @param aList = pointer to a EDA_HOTKEY list of commands
|
||||||
* @param aCommandId = Command Id value
|
* @param aCommandId = Command Id value
|
||||||
* @return the key name in a wxString
|
* @return the key name in a wxString
|
||||||
*/
|
*/
|
||||||
wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
||||||
{
|
{
|
||||||
wxString keyname;
|
wxString keyname;
|
||||||
|
|
||||||
|
@ -329,7 +331,7 @@ wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
||||||
|
|
||||||
if( hk_decr->m_Idcommand == aCommandId )
|
if( hk_decr->m_Idcommand == aCommandId )
|
||||||
{
|
{
|
||||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,14 +341,14 @@ wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnKeyCodeFromKeyName
|
* Function KeyCodeFromKeyName
|
||||||
* return the key code from its key name
|
* return the key code from its key name
|
||||||
* Only some wxWidgets key values are handled for function key
|
* Only some wxWidgets key values are handled for function key
|
||||||
* @param keyname = wxString key name to find in s_Hotkey_Name_List[],
|
* @param keyname = wxString key name to find in s_Hotkey_Name_List[],
|
||||||
* like F2 or space or an usual (ascii) char.
|
* like F2 or space or an usual (ascii) char.
|
||||||
* @return the key code
|
* @return the key code
|
||||||
*/
|
*/
|
||||||
int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
int KeyCodeFromKeyName( const wxString& keyname )
|
||||||
{
|
{
|
||||||
int ii, keycode = 0;
|
int ii, keycode = 0;
|
||||||
|
|
||||||
|
@ -406,7 +408,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
||||||
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
|
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
|
||||||
{
|
{
|
||||||
wxString keyname;
|
wxString keyname;
|
||||||
EDA_HOTKEY** List;
|
EDA_HOTKEY** list;
|
||||||
|
|
||||||
wxString msg = wxT( "<html><body bgcolor=\"#E2E2E2\">" );
|
wxString msg = wxT( "<html><body bgcolor=\"#E2E2E2\">" );
|
||||||
|
|
||||||
|
@ -416,15 +418,16 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescL
|
||||||
|
|
||||||
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
||||||
{
|
{
|
||||||
List = aDescList->m_HK_InfoList;
|
list = aDescList->m_HK_InfoList;
|
||||||
|
|
||||||
for( ; *List != NULL; List++ )
|
for( ; *list != NULL; list++ )
|
||||||
{
|
{
|
||||||
EDA_HOTKEY* hk_decr = *List;
|
EDA_HOTKEY* hk_decr = *list;
|
||||||
|
|
||||||
if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) )
|
if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) )
|
||||||
{
|
{
|
||||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||||
|
|
||||||
// Some chars should be modified, using html encoding, to be
|
// Some chars should be modified, using html encoding, to be
|
||||||
// displayed by DisplayHtmlInfoMessage()
|
// displayed by DisplayHtmlInfoMessage()
|
||||||
keyname.Replace( wxT("<"), wxT("<") );
|
keyname.Replace( wxT("<"), wxT("<") );
|
||||||
|
@ -480,8 +483,8 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||||
|
|
||||||
msg = wxT( "$hotkey list\n" );
|
msg = wxT( "$hotkey list\n" );
|
||||||
|
|
||||||
/* Print the current hotkey list */
|
// Print the current hotkey list
|
||||||
EDA_HOTKEY** List;
|
EDA_HOTKEY** list;
|
||||||
|
|
||||||
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
||||||
{
|
{
|
||||||
|
@ -495,13 +498,13 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||||
msg += *aDescList->m_SectionTag;
|
msg += *aDescList->m_SectionTag;
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
|
|
||||||
List = aDescList->m_HK_InfoList;
|
list = aDescList->m_HK_InfoList;
|
||||||
|
|
||||||
for( ; *List != NULL; List++ )
|
for( ; *list != NULL; list++ )
|
||||||
{
|
{
|
||||||
EDA_HOTKEY* hk_decr = *List;
|
EDA_HOTKEY* hk_decr = *list;
|
||||||
msg += wxT( "shortcut " );
|
msg += wxT( "shortcut " );
|
||||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||||
AddDelimiterString( keyname );
|
AddDelimiterString( keyname );
|
||||||
infokey = hk_decr->m_InfoMsg;
|
infokey = hk_decr->m_InfoMsg;
|
||||||
AddDelimiterString( infokey );
|
AddDelimiterString( infokey );
|
||||||
|
@ -548,21 +551,21 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
|
||||||
{
|
{
|
||||||
wxFile cfgfile( aFilename );
|
wxFile cfgfile( aFilename );
|
||||||
|
|
||||||
/* get length */
|
// get length
|
||||||
cfgfile.SeekEnd();
|
cfgfile.SeekEnd();
|
||||||
wxFileOffset size = cfgfile.Tell();
|
wxFileOffset size = cfgfile.Tell();
|
||||||
cfgfile.Seek( 0 );
|
cfgfile.Seek( 0 );
|
||||||
|
|
||||||
/* read data */
|
// read data
|
||||||
char* buffer = new char[size];
|
char* buffer = new char[size];
|
||||||
cfgfile.Read( buffer, size );
|
cfgfile.Read( buffer, size );
|
||||||
|
|
||||||
wxString data( buffer, wxConvUTF8 );
|
wxString data( buffer, wxConvUTF8 );
|
||||||
|
|
||||||
/* parse */
|
// parse
|
||||||
ParseHotkeyConfig( data, aDescList );
|
ParseHotkeyConfig( data, aDescList );
|
||||||
|
|
||||||
/* cleanup */
|
// cleanup
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
cfgfile.Close();
|
cfgfile.Close();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -603,7 +606,7 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList )
|
||||||
void ParseHotkeyConfig( const wxString& data,
|
void ParseHotkeyConfig( const wxString& data,
|
||||||
struct EDA_HOTKEY_CONFIG* aDescList )
|
struct EDA_HOTKEY_CONFIG* aDescList )
|
||||||
{
|
{
|
||||||
/* Read the config */
|
// Read the config
|
||||||
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
|
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
|
||||||
EDA_HOTKEY** CurrentHotkeyList = 0;
|
EDA_HOTKEY** CurrentHotkeyList = 0;
|
||||||
|
|
||||||
|
@ -643,23 +646,23 @@ void ParseHotkeyConfig( const wxString& data,
|
||||||
if( CurrentHotkeyList == NULL )
|
if( CurrentHotkeyList == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Get the key name */
|
// Get the key name
|
||||||
lineTokenizer.SetString( lineTokenizer.GetString(), L"\"\r\n\t ", wxTOKEN_STRTOK );
|
lineTokenizer.SetString( lineTokenizer.GetString(), L"\"\r\n\t ", wxTOKEN_STRTOK );
|
||||||
wxString keyname = lineTokenizer.GetNextToken();
|
wxString keyname = lineTokenizer.GetNextToken();
|
||||||
|
|
||||||
wxString remainder = lineTokenizer.GetString();
|
wxString remainder = lineTokenizer.GetString();
|
||||||
|
|
||||||
/* Get the command name */
|
// Get the command name
|
||||||
wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' );
|
wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' );
|
||||||
|
|
||||||
/* search the hotkey in current hotkey list */
|
// search the hotkey in current hotkey list
|
||||||
for( EDA_HOTKEY** List = CurrentHotkeyList; *List != NULL; List++ )
|
for( EDA_HOTKEY** list = CurrentHotkeyList; *list != NULL; list++ )
|
||||||
{
|
{
|
||||||
EDA_HOTKEY* hk_decr = *List;
|
EDA_HOTKEY* hk_decr = *list;
|
||||||
|
|
||||||
if( hk_decr->m_InfoMsg == fctname )
|
if( hk_decr->m_InfoMsg == fctname )
|
||||||
{
|
{
|
||||||
int code = ReturnKeyCodeFromKeyName( keyname );
|
int code = KeyCodeFromKeyName( keyname );
|
||||||
|
|
||||||
if( code )
|
if( code )
|
||||||
hk_decr->m_KeyCode = code;
|
hk_decr->m_KeyCode = code;
|
||||||
|
@ -681,7 +684,7 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDesc
|
||||||
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
||||||
wxString mask = wxT( "*." ) + ext;
|
wxString mask = wxT( "*." ) + ext;
|
||||||
wxString path = wxGetCwd();
|
wxString path = wxGetCwd();
|
||||||
wxString filename = wxGetApp().GetAppName() + wxT( "." ) + ext;
|
wxString filename = Kiface().Name() + wxT( '.' ) + ext;
|
||||||
|
|
||||||
filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
|
filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
|
||||||
path,
|
path,
|
||||||
|
@ -709,7 +712,7 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescLi
|
||||||
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
||||||
wxString mask = wxT( "*." ) + ext;
|
wxString mask = wxT( "*." ) + ext;
|
||||||
wxString path = wxGetCwd();
|
wxString path = wxGetCwd();
|
||||||
wxString filename = wxGetApp().GetAppName() + wxT( "." ) + ext;
|
wxString filename = Kiface().Name() + wxT( "." ) + ext;
|
||||||
|
|
||||||
filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
|
filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
|
||||||
path,
|
path,
|
||||||
|
@ -736,14 +739,14 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
|
||||||
|
|
||||||
wxMenu* HotkeySubmenu = new wxMenu();
|
wxMenu* HotkeySubmenu = new wxMenu();
|
||||||
|
|
||||||
/* List existing hotkey menu*/
|
// List existing hotkey menu
|
||||||
AddMenuItem( HotkeySubmenu,
|
AddMenuItem( HotkeySubmenu,
|
||||||
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
||||||
_( "&List Current Keys" ),
|
_( "&List Current Keys" ),
|
||||||
_( "Displays the current hotkeys list and corresponding commands" ),
|
_( "Displays the current hotkeys list and corresponding commands" ),
|
||||||
KiBitmap( info_xpm ) );
|
KiBitmap( info_xpm ) );
|
||||||
|
|
||||||
/* Call hotkeys editor*/
|
// Call hotkeys editor
|
||||||
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
|
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
|
||||||
_( "&Edit Hotkeys" ),
|
_( "&Edit Hotkeys" ),
|
||||||
_( "Call the hotkeys editor" ),
|
_( "Call the hotkeys editor" ),
|
||||||
|
@ -751,19 +754,19 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
|
||||||
|
|
||||||
HotkeySubmenu->AppendSeparator();
|
HotkeySubmenu->AppendSeparator();
|
||||||
|
|
||||||
/* create hotkey file to export current hotkeys config */
|
// create hotkey file to export current hotkeys config
|
||||||
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
|
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
|
||||||
_( "E&xport Hotkeys" ),
|
_( "E&xport Hotkeys" ),
|
||||||
_( "Create a hotkey configuration file to export the current hotkeys" ),
|
_( "Create a hotkey configuration file to export the current hotkeys" ),
|
||||||
KiBitmap( save_setup_xpm ) );
|
KiBitmap( save_setup_xpm ) );
|
||||||
|
|
||||||
/* Reload hotkey file */
|
// Reload hotkey file
|
||||||
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
|
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
|
||||||
_( "&Import Hotkeys" ),
|
_( "&Import Hotkeys" ),
|
||||||
_( "Load an existing hotkey configuration file" ),
|
_( "Load an existing hotkey configuration file" ),
|
||||||
KiBitmap( reload_xpm ) );
|
KiBitmap( reload_xpm ) );
|
||||||
|
|
||||||
/* Append HotkeySubmenu to menu */
|
// Append HotkeySubmenu to menu
|
||||||
AddMenuItem( aMenu, HotkeySubmenu,
|
AddMenuItem( aMenu, HotkeySubmenu,
|
||||||
ID_PREFERENCES_HOTKEY_SUBMENU, _( "&Hotkeys" ),
|
ID_PREFERENCES_HOTKEY_SUBMENU, _( "&Hotkeys" ),
|
||||||
_( "Hotkeys configuration and preferences" ),
|
_( "Hotkeys configuration and preferences" ),
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2014 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 <macros.h> // FROM_UTF8()
|
||||||
|
#include <wx/config.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
#include <kiface_i.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <gr_basic.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const wxChar showPageLimitsKey[] = wxT( "ShowPageLimits" );
|
||||||
|
static const wxChar backgroundColorKey[] = wxT( "BackgroundColor" );
|
||||||
|
|
||||||
|
|
||||||
|
/// Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
|
||||||
|
/// A non-member function so it an be moved easily, plus it's nobody's business.
|
||||||
|
static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
|
||||||
|
{
|
||||||
|
SEARCH_STACK bases;
|
||||||
|
|
||||||
|
SystemDirsAppend( &bases );
|
||||||
|
aDst->Clear();
|
||||||
|
|
||||||
|
for( unsigned i = 0; i < bases.GetCount(); ++i )
|
||||||
|
{
|
||||||
|
wxFileName fn( bases[i], wxEmptyString );
|
||||||
|
|
||||||
|
// Add schematic library file path to search path list.
|
||||||
|
// we must add <kicad path>/library and <kicad path>/library/doc
|
||||||
|
if( aId == KIWAY::FACE_SCH )
|
||||||
|
{
|
||||||
|
fn.AppendDir( wxT( "library" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
// Add schematic doc file path (library/doc)to search path list.
|
||||||
|
fn.AppendDir( wxT( "doc" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.RemoveLastDir(); // "../../" up twice, removing library/doc/
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add PCB library file path to search path list.
|
||||||
|
if( aId == KIWAY::FACE_PCB || aId == KIWAY::FACE_CVPCB )
|
||||||
|
{
|
||||||
|
fn.AppendDir( wxT( "modules" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
// Add 3D module library file path to search path list.
|
||||||
|
fn.AppendDir( wxT( "packages3d" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.RemoveLastDir(); // "../../" up twice, remove modules/packages3d
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add KiCad template file path to search path list.
|
||||||
|
fn.AppendDir( wxT( "template" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1 && defined(DEBUG)
|
||||||
|
aDst->Show( "kiway" );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool KIFACE_I::start_common()
|
||||||
|
{
|
||||||
|
m_bm.Init();
|
||||||
|
|
||||||
|
m_bm.m_config->Read( showPageLimitsKey, &g_ShowPageLimits );
|
||||||
|
|
||||||
|
// FIXME OSX Mountain Lion (10.8)
|
||||||
|
// Seems that Read doesn't found anything and ColorFromInt
|
||||||
|
// Asserts - I'm unable to reproduce on 10.7
|
||||||
|
|
||||||
|
int draw_bg_color = BLACK; // Default for all apps but Eeschema
|
||||||
|
|
||||||
|
if( m_id == KIWAY::FACE_SCH )
|
||||||
|
draw_bg_color = WHITE; // Default for Eeschema
|
||||||
|
|
||||||
|
m_bm.m_config->Read( backgroundColorKey, &draw_bg_color );
|
||||||
|
|
||||||
|
g_DrawBgColor = ColorFromInt( draw_bg_color );
|
||||||
|
|
||||||
|
setSearchPaths( &m_bm.m_search, m_id );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIFACE_I::end_common()
|
||||||
|
{
|
||||||
|
m_bm.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString KIFACE_I::GetHelpFile()
|
||||||
|
{
|
||||||
|
wxString fn;
|
||||||
|
wxArrayString subdirs;
|
||||||
|
wxArrayString altsubdirs;
|
||||||
|
|
||||||
|
// FIXME: This is not the ideal way to handle this. Unfortunately, the
|
||||||
|
// CMake install paths seem to be a moving target so this crude
|
||||||
|
// hack solves the problem of install path differences between
|
||||||
|
// Windows and non-Windows platforms.
|
||||||
|
|
||||||
|
// Partially fixed, but must be enhanced
|
||||||
|
|
||||||
|
// Create subdir tree for "standard" linux distributions, when KiCad comes
|
||||||
|
// from a distribution files are in /usr/share/doc/kicad/help and binaries
|
||||||
|
// in /usr/bin or /usr/local/bin
|
||||||
|
subdirs.Add( wxT( "share" ) );
|
||||||
|
subdirs.Add( wxT( "doc" ) );
|
||||||
|
subdirs.Add( wxT( "kicad" ) );
|
||||||
|
subdirs.Add( wxT( "help" ) );
|
||||||
|
|
||||||
|
// Create subdir tree for linux and Windows KiCad pack.
|
||||||
|
// Note the pack form under linux is also useful if a user wants to
|
||||||
|
// install KiCad to a server because there is only one path to mount
|
||||||
|
// or export (something like /usr/local/kicad).
|
||||||
|
// files are in <install dir>/kicad/doc/help
|
||||||
|
// (often /usr/local/kicad/kicad/doc/help)
|
||||||
|
// <install dir>/kicad/ is retrieved from m_BinDir
|
||||||
|
altsubdirs.Add( wxT( "doc" ) );
|
||||||
|
altsubdirs.Add( wxT( "help" ) );
|
||||||
|
|
||||||
|
/* Search for a help file.
|
||||||
|
* we *must* find a help file.
|
||||||
|
* so help is searched in directories in this order:
|
||||||
|
* help/<canonical name> like help/en_GB
|
||||||
|
* help/<short name> like help/en
|
||||||
|
* help/en
|
||||||
|
*/
|
||||||
|
|
||||||
|
wxLocale* i18n = Pgm().GetLocale();
|
||||||
|
|
||||||
|
// Step 1 : Try to find help file in help/<canonical name>
|
||||||
|
subdirs.Add( i18n->GetCanonicalName() );
|
||||||
|
altsubdirs.Add( i18n->GetCanonicalName() );
|
||||||
|
|
||||||
|
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
|
||||||
|
|
||||||
|
if( !fn )
|
||||||
|
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
|
||||||
|
|
||||||
|
// Step 2 : if not found Try to find help file in help/<short name>
|
||||||
|
if( !fn )
|
||||||
|
{
|
||||||
|
subdirs.RemoveAt( subdirs.GetCount() - 1 );
|
||||||
|
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
|
||||||
|
|
||||||
|
// wxLocale::GetName() does not return always the short name
|
||||||
|
subdirs.Add( i18n->GetName().BeforeLast( '_' ) );
|
||||||
|
altsubdirs.Add( i18n->GetName().BeforeLast( '_' ) );
|
||||||
|
|
||||||
|
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
|
||||||
|
|
||||||
|
if( !fn )
|
||||||
|
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3 : if not found Try to find help file in help/en
|
||||||
|
if( !fn )
|
||||||
|
{
|
||||||
|
subdirs.RemoveAt( subdirs.GetCount() - 1 );
|
||||||
|
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
|
||||||
|
subdirs.Add( wxT( "en" ) );
|
||||||
|
altsubdirs.Add( wxT( "en" ) );
|
||||||
|
|
||||||
|
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
|
||||||
|
|
||||||
|
if( !fn )
|
||||||
|
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn;
|
||||||
|
}
|
|
@ -35,10 +35,11 @@ wxDynamicLibrary KIWAY::s_pcb_dso;
|
||||||
|
|
||||||
KIWAY::KIWAY()
|
KIWAY::KIWAY()
|
||||||
{
|
{
|
||||||
memset( &m_dso_players, 0, sizeof( m_dso_players ) );
|
memset( &m_kiface, 0, sizeof( m_kiface ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
const wxString KIWAY::dso_name( FACE_T aFaceId )
|
const wxString KIWAY::dso_name( FACE_T aFaceId )
|
||||||
{
|
{
|
||||||
switch( aFaceId )
|
switch( aFaceId )
|
||||||
|
@ -51,11 +52,12 @@ const wxString KIWAY::dso_name( FACE_T aFaceId )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
PROJECT& KIWAY::Project()
|
PROJECT& KIWAY::Prj() const
|
||||||
{
|
{
|
||||||
return m_project;
|
return *(PROJECT*) &m_project; // strip const-ness, function really is const.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,10 +67,8 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
|
||||||
{
|
{
|
||||||
case FACE_SCH:
|
case FACE_SCH:
|
||||||
case FACE_PCB:
|
case FACE_PCB:
|
||||||
//case FACE_LIB:
|
if( m_kiface[aFaceId] )
|
||||||
//case FACE_MOD:
|
return m_kiface[aFaceId];
|
||||||
if( m_dso_players[aFaceId] )
|
|
||||||
return m_dso_players[aFaceId];
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
|
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
|
||||||
|
@ -86,8 +86,6 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
|
||||||
case FACE_PCB:
|
case FACE_PCB:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//case FACE_LIB:
|
|
||||||
//case FACE_MOD:
|
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
#include <kiway.h>
|
||||||
|
#include <kiway_player.h>
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
#include <typeinfo>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
PROJECT& KIWAY_HOLDER::Prj() const
|
||||||
|
{
|
||||||
|
return Kiway().Prj();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// this is not speed critical, hide it out of line.
|
||||||
|
void KIWAY_HOLDER::SetKiway( wxWindow* aDest, KIWAY* aKiway )
|
||||||
|
{
|
||||||
|
#if defined(DEBUG)
|
||||||
|
// offer a trap point for debugging most any window
|
||||||
|
wxASSERT( aDest );
|
||||||
|
if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
|
||||||
|
{
|
||||||
|
int breakhere=1;
|
||||||
|
(void) breakhere;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
(void) aDest;
|
||||||
|
|
||||||
|
m_kiway = aKiway;
|
||||||
|
}
|
|
@ -50,13 +50,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <kiface_i.h>
|
||||||
#include <drawtxt.h>
|
#include <drawtxt.h>
|
||||||
#include <worksheet.h>
|
#include <worksheet.h>
|
||||||
#include <class_title_block.h>
|
#include <class_title_block.h>
|
||||||
#include <worksheet_shape_builder.h>
|
#include <worksheet_shape_builder.h>
|
||||||
#include <class_worksheet_dataitem.h>
|
#include <class_worksheet_dataitem.h>
|
||||||
|
|
||||||
|
|
||||||
// The layout shape used in the application
|
// The layout shape used in the application
|
||||||
// It is accessible by WORKSHEET_LAYOUT::GetTheInstance()
|
// It is accessible by WORKSHEET_LAYOUT::GetTheInstance()
|
||||||
WORKSHEET_LAYOUT wksTheInstance;
|
WORKSHEET_LAYOUT wksTheInstance;
|
||||||
|
@ -70,21 +71,25 @@ WORKSHEET_LAYOUT::WORKSHEET_LAYOUT()
|
||||||
m_bottomMargin = 10.0; // the bottom page margin in mm
|
m_bottomMargin = 10.0; // the bottom page margin in mm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WORKSHEET_LAYOUT::SetLeftMargin( double aMargin )
|
void WORKSHEET_LAYOUT::SetLeftMargin( double aMargin )
|
||||||
{
|
{
|
||||||
m_leftMargin = aMargin; // the left page margin in mm
|
m_leftMargin = aMargin; // the left page margin in mm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WORKSHEET_LAYOUT::SetRightMargin( double aMargin )
|
void WORKSHEET_LAYOUT::SetRightMargin( double aMargin )
|
||||||
{
|
{
|
||||||
m_rightMargin = aMargin; // the right page margin in mm
|
m_rightMargin = aMargin; // the right page margin in mm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WORKSHEET_LAYOUT::SetTopMargin( double aMargin )
|
void WORKSHEET_LAYOUT::SetTopMargin( double aMargin )
|
||||||
{
|
{
|
||||||
m_topMargin = aMargin; // the top page margin in mm
|
m_topMargin = aMargin; // the top page margin in mm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WORKSHEET_LAYOUT::SetBottomMargin( double aMargin )
|
void WORKSHEET_LAYOUT::SetBottomMargin( double aMargin )
|
||||||
{
|
{
|
||||||
m_bottomMargin = aMargin; // the bottom page margin in mm
|
m_bottomMargin = aMargin; // the bottom page margin in mm
|
||||||
|
@ -98,8 +103,7 @@ void WORKSHEET_LAYOUT::ClearList()
|
||||||
m_list.clear();
|
m_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert an item to the list of items at position aIdx
|
|
||||||
*/
|
|
||||||
void WORKSHEET_LAYOUT::Insert( WORKSHEET_DATAITEM* aItem, unsigned aIdx )
|
void WORKSHEET_LAYOUT::Insert( WORKSHEET_DATAITEM* aItem, unsigned aIdx )
|
||||||
{
|
{
|
||||||
if ( aIdx >= GetCount() )
|
if ( aIdx >= GetCount() )
|
||||||
|
@ -108,8 +112,7 @@ void WORKSHEET_LAYOUT::Insert( WORKSHEET_DATAITEM* aItem, unsigned aIdx )
|
||||||
m_list.insert( m_list.begin() + aIdx, aItem );
|
m_list.insert( m_list.begin() + aIdx, aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the item to the list of items at position aIdx
|
|
||||||
*/
|
|
||||||
bool WORKSHEET_LAYOUT::Remove( unsigned aIdx )
|
bool WORKSHEET_LAYOUT::Remove( unsigned aIdx )
|
||||||
{
|
{
|
||||||
if ( aIdx >= GetCount() )
|
if ( aIdx >= GetCount() )
|
||||||
|
@ -118,8 +121,7 @@ bool WORKSHEET_LAYOUT::Remove( unsigned aIdx )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the item to the list of items at position aIdx
|
|
||||||
*/
|
|
||||||
bool WORKSHEET_LAYOUT::Remove( WORKSHEET_DATAITEM* aItem )
|
bool WORKSHEET_LAYOUT::Remove( WORKSHEET_DATAITEM* aItem )
|
||||||
{
|
{
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
|
@ -135,8 +137,7 @@ bool WORKSHEET_LAYOUT::Remove( WORKSHEET_DATAITEM* aItem )
|
||||||
return Remove( idx );
|
return Remove( idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the index of aItem, or -1 if does not exist
|
|
||||||
*/
|
|
||||||
int WORKSHEET_LAYOUT::GetItemIndex( WORKSHEET_DATAITEM* aItem ) const
|
int WORKSHEET_LAYOUT::GetItemIndex( WORKSHEET_DATAITEM* aItem ) const
|
||||||
{
|
{
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
|
@ -161,17 +162,13 @@ WORKSHEET_DATAITEM* WORKSHEET_LAYOUT::GetItem( unsigned aIdx ) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return a short filename from a full filename:
|
|
||||||
* if the path is the current path,or if the path is the same
|
|
||||||
* as kicad.pro (in template), returns a shortname
|
|
||||||
* else do nothing and returns the full filename
|
|
||||||
*/
|
|
||||||
const wxString WORKSHEET_LAYOUT::MakeShortFileName( const wxString& aFullFileName )
|
const wxString WORKSHEET_LAYOUT::MakeShortFileName( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
wxFileName fn = aFullFileName;
|
wxFileName fn = aFullFileName;
|
||||||
wxString shortFileName = aFullFileName;
|
wxString shortFileName = aFullFileName;
|
||||||
|
wxString fileName = Kiface().KifaceSearch().FindValidPath( fn.GetFullName() );
|
||||||
|
|
||||||
wxString fileName = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
|
||||||
if( !fileName.IsEmpty() )
|
if( !fileName.IsEmpty() )
|
||||||
{
|
{
|
||||||
fn = fileName;
|
fn = fileName;
|
||||||
|
@ -182,19 +179,15 @@ const wxString WORKSHEET_LAYOUT::MakeShortFileName( const wxString& aFullFileNam
|
||||||
return shortFileName;
|
return shortFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a full filename from a short filename,
|
|
||||||
* if the short filename path is void
|
|
||||||
* In this case the path is the same as kicad.pro (in template)
|
|
||||||
* else return the short filename (which have an absolute os relative path
|
|
||||||
*/
|
|
||||||
const wxString WORKSHEET_LAYOUT::MakeFullFileName( const wxString& aShortFileName )
|
const wxString WORKSHEET_LAYOUT::MakeFullFileName( const wxString& aShortFileName )
|
||||||
{
|
{
|
||||||
wxFileName fn = aShortFileName;
|
wxFileName fn = aShortFileName;
|
||||||
wxString fullFileName = aShortFileName;
|
wxString fullFileName = aShortFileName;
|
||||||
|
|
||||||
if( fn.GetPath().IsEmpty() && !fn.GetFullName().IsEmpty() )
|
if( fn.GetPath().IsEmpty() && !fn.GetFullName().IsEmpty() )
|
||||||
{
|
{
|
||||||
wxString name = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
wxString name = Kiface().KifaceSearch().FindValidPath( fn.GetFullName() );
|
||||||
if( !name.IsEmpty() )
|
if( !name.IsEmpty() )
|
||||||
fullFileName = name;
|
fullFileName = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,739 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2011 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file pgm_base.cpp
|
||||||
|
*
|
||||||
|
* @brief For the main application: init functions, and language selection
|
||||||
|
* (locale handling)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <fctsys.h>
|
||||||
|
#include <wx/html/htmlwin.h>
|
||||||
|
#include <wx/fs_zip.h>
|
||||||
|
#include <wx/dir.h>
|
||||||
|
#include <wx/filename.h>
|
||||||
|
#include <wx/snglinst.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
#include <pgm_base.h>
|
||||||
|
#include <wxstruct.h>
|
||||||
|
#include <macros.h>
|
||||||
|
#include <config_params.h>
|
||||||
|
#include <id.h>
|
||||||
|
#include <build_version.h>
|
||||||
|
#include <hotkeys_basic.h>
|
||||||
|
#include <online_help.h>
|
||||||
|
#include <gestfich.h>
|
||||||
|
#include <menus_helpers.h>
|
||||||
|
#include <confirm.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define KICAD_COMMON wxT( "kicad_common" )
|
||||||
|
|
||||||
|
// some key strings used to store parameters in KICAD_COMMON
|
||||||
|
|
||||||
|
const wxChar PGM_BASE::workingDirKey[] = wxT( "WorkingDir" ); // public
|
||||||
|
|
||||||
|
static const wxChar languageCfgKey[] = wxT( "LanguageID" );
|
||||||
|
static const wxChar kicadFpLibPath[] = wxT( "KicadFootprintLibraryPath" );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A small class to handle the list of existing translations.
|
||||||
|
* The locale translation is automatic.
|
||||||
|
* The selection of languages is mainly for maintainer's convenience
|
||||||
|
* To add a support to a new translation:
|
||||||
|
* create a new icon (flag of the country) (see Lang_Fr.xpm as an example)
|
||||||
|
* add a new item to s_Languages[].
|
||||||
|
*/
|
||||||
|
struct LANGUAGE_DESCR
|
||||||
|
{
|
||||||
|
/// wxWidgets locale identifier (See wxWidgets doc)
|
||||||
|
int m_WX_Lang_Identifier;
|
||||||
|
|
||||||
|
/// KiCad identifier used in menu selection (See id.h)
|
||||||
|
int m_KI_Lang_Identifier;
|
||||||
|
|
||||||
|
/// The menu language icons
|
||||||
|
BITMAP_DEF m_Lang_Icon;
|
||||||
|
|
||||||
|
/// Labels used in menus
|
||||||
|
wxString m_Lang_Label;
|
||||||
|
|
||||||
|
/// Set to true if the m_Lang_Label must not be translated
|
||||||
|
bool m_DoNotTranslate;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variable s_Languages
|
||||||
|
* Note: because this list is not created on the fly, wxTranslation
|
||||||
|
* must be called when a language name must be displayed after translation.
|
||||||
|
* Do not change this behavior, because m_Lang_Label is also used as key in config
|
||||||
|
*/
|
||||||
|
static LANGUAGE_DESCR s_Languages[] =
|
||||||
|
{
|
||||||
|
// Default language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_DEFAULT,
|
||||||
|
ID_LANGUAGE_DEFAULT,
|
||||||
|
lang_def_xpm,
|
||||||
|
_( "Default" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// English language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_ENGLISH,
|
||||||
|
ID_LANGUAGE_ENGLISH,
|
||||||
|
lang_en_xpm,
|
||||||
|
wxT( "English" ),
|
||||||
|
true
|
||||||
|
},
|
||||||
|
|
||||||
|
// French language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_FRENCH,
|
||||||
|
ID_LANGUAGE_FRENCH,
|
||||||
|
lang_fr_xpm,
|
||||||
|
_( "French" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Finnish language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_FINNISH,
|
||||||
|
ID_LANGUAGE_FINNISH,
|
||||||
|
lang_fi_xpm,
|
||||||
|
_( "Finnish" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Spanish language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_SPANISH,
|
||||||
|
ID_LANGUAGE_SPANISH,
|
||||||
|
lang_es_xpm,
|
||||||
|
_( "Spanish" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Portuguese language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_PORTUGUESE,
|
||||||
|
ID_LANGUAGE_PORTUGUESE,
|
||||||
|
lang_pt_xpm,
|
||||||
|
_( "Portuguese" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Italian language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_ITALIAN,
|
||||||
|
ID_LANGUAGE_ITALIAN,
|
||||||
|
lang_it_xpm,
|
||||||
|
_( "Italian" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// German language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_GERMAN,
|
||||||
|
ID_LANGUAGE_GERMAN,
|
||||||
|
lang_de_xpm,
|
||||||
|
_( "German" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Greek language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_GREEK,
|
||||||
|
ID_LANGUAGE_GREEK,
|
||||||
|
lang_gr_xpm,
|
||||||
|
_( "Greek" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Slovenian language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_SLOVENIAN,
|
||||||
|
ID_LANGUAGE_SLOVENIAN,
|
||||||
|
lang_sl_xpm,
|
||||||
|
_( "Slovenian" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Hungarian language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_HUNGARIAN,
|
||||||
|
ID_LANGUAGE_HUNGARIAN,
|
||||||
|
lang_hu_xpm,
|
||||||
|
_( "Hungarian" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Polish language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_POLISH,
|
||||||
|
ID_LANGUAGE_POLISH,
|
||||||
|
lang_pl_xpm,
|
||||||
|
_( "Polish" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Czech language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_CZECH,
|
||||||
|
ID_LANGUAGE_CZECH,
|
||||||
|
lang_cs_xpm,
|
||||||
|
_( "Czech" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Russian language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_RUSSIAN,
|
||||||
|
ID_LANGUAGE_RUSSIAN,
|
||||||
|
lang_ru_xpm,
|
||||||
|
_( "Russian" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Korean language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_KOREAN,
|
||||||
|
ID_LANGUAGE_KOREAN,
|
||||||
|
lang_ko_xpm,
|
||||||
|
_( "Korean" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Chinese simplified
|
||||||
|
{
|
||||||
|
wxLANGUAGE_CHINESE_SIMPLIFIED,
|
||||||
|
ID_LANGUAGE_CHINESE_SIMPLIFIED,
|
||||||
|
lang_chinese_xpm,
|
||||||
|
_( "Chinese simplified" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Catalan language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_CATALAN,
|
||||||
|
ID_LANGUAGE_CATALAN,
|
||||||
|
lang_catalan_xpm,
|
||||||
|
_( "Catalan" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Dutch language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_DUTCH,
|
||||||
|
ID_LANGUAGE_DUTCH,
|
||||||
|
lang_nl_xpm,
|
||||||
|
_( "Dutch" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Japanese language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_JAPANESE,
|
||||||
|
ID_LANGUAGE_JAPANESE,
|
||||||
|
lang_jp_xpm,
|
||||||
|
_( "Japanese" )
|
||||||
|
},
|
||||||
|
|
||||||
|
// Bulgarian language
|
||||||
|
{
|
||||||
|
wxLANGUAGE_BULGARIAN,
|
||||||
|
ID_LANGUAGE_BULGARIAN,
|
||||||
|
lang_bg_xpm,
|
||||||
|
_( "Bulgarian" )
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PGM_BASE::PGM_BASE()
|
||||||
|
{
|
||||||
|
m_pgm_checker = NULL;
|
||||||
|
m_file_checker = NULL;
|
||||||
|
m_html_ctrl = NULL;
|
||||||
|
m_locale = NULL;
|
||||||
|
m_common_settings = NULL;
|
||||||
|
|
||||||
|
m_wx_app = NULL;
|
||||||
|
|
||||||
|
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||||
|
|
||||||
|
ForceSystemPdfBrowser( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PGM_BASE::~PGM_BASE()
|
||||||
|
{
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::destroy()
|
||||||
|
{
|
||||||
|
// unlike a normal destructor, this is designed to be called more than once safely:
|
||||||
|
|
||||||
|
delete m_common_settings;
|
||||||
|
m_common_settings = 0;
|
||||||
|
|
||||||
|
delete m_pgm_checker;
|
||||||
|
m_pgm_checker = 0;
|
||||||
|
|
||||||
|
delete m_file_checker;
|
||||||
|
m_file_checker = 0;
|
||||||
|
|
||||||
|
delete m_locale;
|
||||||
|
m_locale = 0;
|
||||||
|
|
||||||
|
delete m_html_ctrl;
|
||||||
|
m_html_ctrl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::SetEditorName( const wxString& aFileName )
|
||||||
|
{
|
||||||
|
m_editor_name = aFileName;
|
||||||
|
wxASSERT( m_common_settings );
|
||||||
|
m_common_settings->Write( wxT( "Editor" ), aFileName );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString& PGM_BASE::GetEditorName()
|
||||||
|
{
|
||||||
|
wxString editorname = m_editor_name;
|
||||||
|
|
||||||
|
if( !editorname )
|
||||||
|
{
|
||||||
|
// Get the preferred editor name from environment variable first.
|
||||||
|
if(!wxGetEnv( wxT( "EDITOR" ), &editorname ))
|
||||||
|
{
|
||||||
|
// If there is no EDITOR variable set, try the desktop default
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
editorname = "/usr/bin/open";
|
||||||
|
#elif __WXX11__
|
||||||
|
editorname = "/usr/bin/xdg-open";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !editorname ) // We must get a preferred editor name
|
||||||
|
{
|
||||||
|
DisplayInfoMessage( NULL,
|
||||||
|
_( "No default editor found, you must choose it" ) );
|
||||||
|
|
||||||
|
wxString mask( wxT( "*" ) );
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
mask += wxT( ".exe" );
|
||||||
|
#endif
|
||||||
|
editorname = EDA_FileSelector( _( "Preferred Editor:" ), wxEmptyString,
|
||||||
|
wxEmptyString, wxEmptyString, mask,
|
||||||
|
NULL, wxFD_OPEN, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !editorname.IsEmpty() )
|
||||||
|
{
|
||||||
|
m_editor_name = editorname;
|
||||||
|
m_common_settings->Write( wxT( "Editor" ), m_editor_name );
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_editor_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PGM_BASE::initPgm()
|
||||||
|
{
|
||||||
|
wxFileName pgm_name( App().argv[0] );
|
||||||
|
|
||||||
|
wxInitAllImageHandlers();
|
||||||
|
|
||||||
|
m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId() );
|
||||||
|
|
||||||
|
if( m_pgm_checker->IsAnotherRunning() )
|
||||||
|
{
|
||||||
|
wxString quiz = wxString::Format(
|
||||||
|
_( "%s is already running, Continue?" ),
|
||||||
|
GetChars( pgm_name.GetName() )
|
||||||
|
);
|
||||||
|
if( !IsOK( NULL, quiz ) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init KiCad environment
|
||||||
|
// the environment variable KICAD (if exists) gives the kicad path:
|
||||||
|
// something like set KICAD=d:\kicad
|
||||||
|
bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_kicad_env );
|
||||||
|
|
||||||
|
if( isDefined ) // ensure m_kicad_env ends by "/"
|
||||||
|
{
|
||||||
|
m_kicad_env.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
|
if( !m_kicad_env.IsEmpty() && m_kicad_env.Last() != '/' )
|
||||||
|
m_kicad_env += UNIX_STRING_DIR_SEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init parameters for configuration
|
||||||
|
App().SetVendorName( wxT( "KiCad" ) );
|
||||||
|
App().SetAppName( pgm_name.GetName().Lower() );
|
||||||
|
|
||||||
|
// Install some image handlers, mainly for help
|
||||||
|
wxImage::AddHandler( new wxPNGHandler );
|
||||||
|
wxImage::AddHandler( new wxGIFHandler );
|
||||||
|
wxImage::AddHandler( new wxJPEGHandler );
|
||||||
|
wxFileSystem::AddHandler( new wxZipFSHandler );
|
||||||
|
|
||||||
|
// Analyze the command line & initialize the binary path
|
||||||
|
setExecutablePath();
|
||||||
|
|
||||||
|
SetLanguagePath();
|
||||||
|
|
||||||
|
// OS specific instantiation of wxConfigBase derivative:
|
||||||
|
m_common_settings = new wxConfig( KICAD_COMMON );
|
||||||
|
|
||||||
|
ReadPdfBrowserInfos(); // needs m_common_settings
|
||||||
|
|
||||||
|
loadCommonSettings();
|
||||||
|
|
||||||
|
SetLanguage( true );
|
||||||
|
|
||||||
|
// Set locale option for separator used in float numbers
|
||||||
|
SetLocaleTo_Default();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::SetHtmlHelpController( wxHtmlHelpController* aController )
|
||||||
|
{
|
||||||
|
delete m_html_ctrl;
|
||||||
|
m_html_ctrl = aController;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::InitOnLineHelp()
|
||||||
|
{
|
||||||
|
wxString fullfilename = FindKicadHelpPath();
|
||||||
|
|
||||||
|
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
|
||||||
|
m_HelpFileName = fullfilename + wxT( ".html" );
|
||||||
|
fullfilename += wxT( "kicad.hhp" );
|
||||||
|
|
||||||
|
if( wxFileExists( fullfilename ) )
|
||||||
|
{
|
||||||
|
m_html_ctrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS |
|
||||||
|
wxHF_PRINT | wxHF_OPEN_FILES
|
||||||
|
/*| wxHF_SEARCH */ );
|
||||||
|
m_html_ctrl->UseConfig( m_common_settings );
|
||||||
|
m_html_ctrl->SetTitleFormat( wxT( "KiCad Help" ) );
|
||||||
|
m_html_ctrl->AddBook( fullfilename );
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
||||||
|
m_html_ctrl = NULL;
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error Help files format not defined
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PGM_BASE::setExecutablePath()
|
||||||
|
{
|
||||||
|
// Apple MacOSx
|
||||||
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
// Derive path from location of the app bundle
|
||||||
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
|
|
||||||
|
if( mainBundle == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CFURLRef urlref = CFBundleCopyBundleURL( mainBundle );
|
||||||
|
|
||||||
|
if( urlref == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle );
|
||||||
|
|
||||||
|
if( str == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char* native_str = NULL;
|
||||||
|
int len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ),
|
||||||
|
kCFStringEncodingUTF8 ) + 1;
|
||||||
|
native_str = new char[len];
|
||||||
|
|
||||||
|
CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );
|
||||||
|
m_bin_dir = FROM_UTF8( native_str );
|
||||||
|
delete[] native_str;
|
||||||
|
|
||||||
|
#else
|
||||||
|
m_bin_dir = wxStandardPaths::Get().GetExecutablePath();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Use unix notation for paths. I am not sure this is a good idea,
|
||||||
|
// but it simplifies compatibility between Windows and Unices.
|
||||||
|
// However it is a potential problem in path handling under Windows.
|
||||||
|
m_bin_dir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
|
// Remove file name form command line:
|
||||||
|
while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() )
|
||||||
|
m_bin_dir.RemoveLast();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::loadCommonSettings()
|
||||||
|
{
|
||||||
|
wxASSERT( m_common_settings );
|
||||||
|
|
||||||
|
m_help_size.x = 500;
|
||||||
|
m_help_size.y = 400;
|
||||||
|
|
||||||
|
wxString languageSel;
|
||||||
|
|
||||||
|
m_common_settings->Read( languageCfgKey, &languageSel );
|
||||||
|
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||||
|
|
||||||
|
// Search for the current selection
|
||||||
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
|
{
|
||||||
|
if( s_Languages[ii].m_Lang_Label == languageSel )
|
||||||
|
{
|
||||||
|
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_editor_name = m_common_settings->Read( wxT( "Editor" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::saveCommonSettings()
|
||||||
|
{
|
||||||
|
// m_common_settings is not initialized until fairly late in the
|
||||||
|
// process startup: initPgm(), so test before using:
|
||||||
|
if( m_common_settings )
|
||||||
|
{
|
||||||
|
m_common_settings->Write( workingDirKey, wxGetCwd() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PGM_BASE::SetLanguage( bool first_time )
|
||||||
|
{
|
||||||
|
bool retv = true;
|
||||||
|
|
||||||
|
// dictionary file name without extend (full name is kicad.mo)
|
||||||
|
wxString dictionaryName( wxT( "kicad" ) );
|
||||||
|
|
||||||
|
delete m_locale;
|
||||||
|
m_locale = new wxLocale;
|
||||||
|
|
||||||
|
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||||
|
if( !m_locale->Init( m_language_id ) )
|
||||||
|
#else
|
||||||
|
if( !m_locale->Init( m_language_id, wxLOCALE_CONV_ENCODING ) )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "This language is not supported by the system." ) );
|
||||||
|
|
||||||
|
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||||
|
delete m_locale;
|
||||||
|
|
||||||
|
m_locale = new wxLocale;
|
||||||
|
m_locale->Init();
|
||||||
|
retv = false;
|
||||||
|
}
|
||||||
|
else if( !first_time )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Search for dictionary %s.mo in %s" ),
|
||||||
|
GetChars( dictionaryName ), GetChars( m_locale->GetName() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// how about a meaningful comment here.
|
||||||
|
if( !first_time )
|
||||||
|
{
|
||||||
|
wxString languageSel;
|
||||||
|
|
||||||
|
// Search for the current selection
|
||||||
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
|
{
|
||||||
|
if( s_Languages[ii].m_WX_Lang_Identifier == m_language_id )
|
||||||
|
{
|
||||||
|
languageSel = s_Languages[ii].m_Lang_Label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_common_settings->Write( languageCfgKey, languageSel );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test if floating point notation is working (bug in cross compilation, using wine)
|
||||||
|
// Make a conversion double <=> string
|
||||||
|
double dtst = 0.5;
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
|
extern bool g_DisableFloatingPointLocalNotation; // See common.cpp
|
||||||
|
|
||||||
|
g_DisableFloatingPointLocalNotation = false;
|
||||||
|
|
||||||
|
msg << dtst;
|
||||||
|
double result;
|
||||||
|
msg.ToDouble( &result );
|
||||||
|
|
||||||
|
if( result != dtst ) // string to double encode/decode does not work! Bug detected
|
||||||
|
{
|
||||||
|
// Disable floating point localization:
|
||||||
|
g_DisableFloatingPointLocalNotation = true;
|
||||||
|
SetLocaleTo_C_standard( );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_locale->IsLoaded( dictionaryName ) )
|
||||||
|
m_locale->AddCatalog( dictionaryName );
|
||||||
|
|
||||||
|
if( !retv )
|
||||||
|
return retv;
|
||||||
|
|
||||||
|
return m_locale->IsOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::SetLanguageIdentifier( int menu_id )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Select language ID %d from %zd possible languages." ),
|
||||||
|
menu_id, DIM( s_Languages ) );
|
||||||
|
|
||||||
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
|
{
|
||||||
|
if( menu_id == s_Languages[ii].m_KI_Lang_Identifier )
|
||||||
|
{
|
||||||
|
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::SetLanguagePath()
|
||||||
|
{
|
||||||
|
SEARCH_STACK guesses;
|
||||||
|
|
||||||
|
SystemDirsAppend( &guesses );
|
||||||
|
|
||||||
|
// Add our internat dir to the wxLocale catalog of paths
|
||||||
|
for( unsigned i = 0; i < guesses.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
wxFileName fn( guesses[i], wxEmptyString );
|
||||||
|
|
||||||
|
// Append path for Windows and unix KiCad package install
|
||||||
|
fn.AppendDir( wxT( "share" ) );
|
||||||
|
fn.AppendDir( wxT( "internat" ) );
|
||||||
|
|
||||||
|
if( fn.IsDirReadable() )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding locale lookup path: " ) + fn.GetPath() );
|
||||||
|
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append path for unix standard install
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
|
fn.AppendDir( wxT( "internat" ) );
|
||||||
|
|
||||||
|
if( fn.IsDirReadable() )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding locale lookup path: " ) + fn.GetPath() );
|
||||||
|
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_BASE::AddMenuLanguageList( wxMenu* MasterMenu )
|
||||||
|
{
|
||||||
|
wxMenu* menu = NULL;
|
||||||
|
wxMenuItem* item = MasterMenu->FindItem( ID_LANGUAGE_CHOICE );
|
||||||
|
|
||||||
|
if( item ) // This menu exists, do nothing
|
||||||
|
return;
|
||||||
|
|
||||||
|
menu = new wxMenu;
|
||||||
|
|
||||||
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
|
{
|
||||||
|
wxString label;
|
||||||
|
|
||||||
|
if( s_Languages[ii].m_DoNotTranslate )
|
||||||
|
label = s_Languages[ii].m_Lang_Label;
|
||||||
|
else
|
||||||
|
label = wxGetTranslation( s_Languages[ii].m_Lang_Label );
|
||||||
|
|
||||||
|
AddMenuItem( menu, s_Languages[ii].m_KI_Lang_Identifier,
|
||||||
|
label, KiBitmap(s_Languages[ii].m_Lang_Icon ),
|
||||||
|
wxITEM_CHECK );
|
||||||
|
}
|
||||||
|
|
||||||
|
AddMenuItem( MasterMenu, menu,
|
||||||
|
ID_LANGUAGE_CHOICE,
|
||||||
|
_( "Language" ),
|
||||||
|
_( "Select application language (only for testing!)" ),
|
||||||
|
KiBitmap( language_xpm ) );
|
||||||
|
|
||||||
|
// Set Check mark on current selected language
|
||||||
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
|
{
|
||||||
|
if( m_language_id == s_Languages[ii].m_WX_Lang_Identifier )
|
||||||
|
menu->Check( s_Languages[ii].m_KI_Lang_Identifier, true );
|
||||||
|
else
|
||||||
|
menu->Check( s_Languages[ii].m_KI_Lang_Identifier, false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PGM_BASE::LockFile( const wxString& aFileName )
|
||||||
|
{
|
||||||
|
// first make absolute and normalize, to avoid that different lock files
|
||||||
|
// for the same file can be created
|
||||||
|
wxFileName fn( aFileName );
|
||||||
|
|
||||||
|
fn.MakeAbsolute();
|
||||||
|
|
||||||
|
// semaphore to protect the edition of the file by more than one instance
|
||||||
|
if( m_file_checker != NULL )
|
||||||
|
{
|
||||||
|
// it means that we had an open file and we are opening a different one
|
||||||
|
delete m_file_checker;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString lockFileName = fn.GetFullPath() + wxT( ".lock" );
|
||||||
|
|
||||||
|
lockFileName.Replace( wxT( "/" ), wxT( "_" ) );
|
||||||
|
|
||||||
|
// We can have filenames coming from Windows, so also convert Windows separator
|
||||||
|
lockFileName.Replace( wxT( "\\" ), wxT( "_" ) );
|
||||||
|
|
||||||
|
m_file_checker = new wxSingleInstanceChecker( lockFileName );
|
||||||
|
|
||||||
|
if( m_file_checker &&
|
||||||
|
m_file_checker->IsAnotherRunning() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,345 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <fctsys.h>
|
||||||
|
#include <macros.h>
|
||||||
|
#include <gr_basic.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
#include <project.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
#include <config_params.h>
|
||||||
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PROJECT::PROJECT()
|
||||||
|
{
|
||||||
|
memset( m_elems, 0, sizeof(m_elems) );
|
||||||
|
}
|
||||||
|
|
||||||
|
PROJECT::~PROJECT()
|
||||||
|
{
|
||||||
|
/* @todo
|
||||||
|
careful here, this may work, but the virtual destructor may not
|
||||||
|
be in the same link image as PROJECT. Won't enable this until
|
||||||
|
we're more stable and destructor is assuredly in same image, i.e.
|
||||||
|
libki.so
|
||||||
|
for( unsigned i = 0; i<DIM(m_elems); ++i )
|
||||||
|
delete m_elems[i];
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PROJECT::SetProjectFullName( const wxString& aFullPathAndName )
|
||||||
|
{
|
||||||
|
m_project_name = aFullPathAndName;
|
||||||
|
|
||||||
|
wxASSERT( m_project_name.IsAbsolute() );
|
||||||
|
#if 0
|
||||||
|
wxASSERT( m_project_name.GetExt() == wxT( ".pro" ) )
|
||||||
|
#else
|
||||||
|
m_project_name.SetExt( wxT( ".pro" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// until multiple projects are in play, set an environment variable for the
|
||||||
|
// the project pointer.
|
||||||
|
{
|
||||||
|
wxString path = m_project_name.GetPath();
|
||||||
|
|
||||||
|
// wxLogDebug( wxT( "Setting env %s to '%s'." ), PROJECT_VAR_NAME, GetChars( path ) );
|
||||||
|
|
||||||
|
wxSetEnv( PROJECT_VAR_NAME, path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString PROJECT::GetProjectFullName() const
|
||||||
|
{
|
||||||
|
return m_project_name.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString PROJECT::FootprintLibTblName() const
|
||||||
|
{
|
||||||
|
wxFileName fn = GetProjectFullName();
|
||||||
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
|
// DBG(printf( "path:'%s' fn:'%s'\n", TO_UTF8(path), TO_UTF8(fn.GetFullPath()) );)
|
||||||
|
|
||||||
|
// if there's no path to the project name, or the name as a whole is bogus or its not
|
||||||
|
// write-able then use a template file.
|
||||||
|
if( !fn.GetDirCount() || !fn.IsOk() || !wxFileName::IsDirWritable( path ) )
|
||||||
|
{
|
||||||
|
// return a template filename now.
|
||||||
|
|
||||||
|
// this next line is likely a problem now, since it relies on an
|
||||||
|
// application title which is no longer constant or known. This next line needs
|
||||||
|
// to be re-thought out.
|
||||||
|
|
||||||
|
fn.AssignDir( wxStandardPaths::Get().GetUserConfigDir() );
|
||||||
|
|
||||||
|
#if defined( __WINDOWS__ )
|
||||||
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
The footprint library table name used when no project file is passed
|
||||||
|
to Pcbnew or CvPcb. This is used temporarily to store the project
|
||||||
|
specific library table until the project file being edited is saved.
|
||||||
|
It is then moved to the file fp-lib-table in the folder where the
|
||||||
|
project file is saved.
|
||||||
|
*/
|
||||||
|
fn.SetName( wxT( "prj-fp-lib-table" ) );
|
||||||
|
}
|
||||||
|
else // normal path.
|
||||||
|
{
|
||||||
|
fn.SetName( wxT( "fp-lib-table" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
fn.ClearExt();
|
||||||
|
|
||||||
|
return fn.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RETAINED_PATH& PROJECT::RPath( RETPATH_T aIndex )
|
||||||
|
{
|
||||||
|
unsigned ndx = unsigned( aIndex );
|
||||||
|
|
||||||
|
if( ndx < DIM( m_rpaths ) )
|
||||||
|
{
|
||||||
|
return m_rpaths[ndx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static RETAINED_PATH no_cookie_for_you;
|
||||||
|
|
||||||
|
wxASSERT( 0 ); // bad index
|
||||||
|
|
||||||
|
return no_cookie_for_you;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PROJECT::_ELEM* PROJECT::Elem( ELEM_T aIndex, _ELEM* aElem )
|
||||||
|
{
|
||||||
|
unsigned ndx = unsigned( aIndex );
|
||||||
|
|
||||||
|
if( ndx < DIM( m_elems ) )
|
||||||
|
{
|
||||||
|
if( aElem )
|
||||||
|
m_elems[ndx] = aElem;
|
||||||
|
|
||||||
|
return m_elems[ndx];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// non-member so it can be moved easily, and kept REALLY private.
|
||||||
|
// Do NOT Clear() in here.
|
||||||
|
static void add_search_paths( SEARCH_STACK* aDst, wxConfigBase* aCfg, int aIndex )
|
||||||
|
{
|
||||||
|
for( int i=1; true; ++i )
|
||||||
|
{
|
||||||
|
wxString key = wxString::Format( wxT( "LibraryPath%d" ), i );
|
||||||
|
wxString upath = aCfg->Read( key, wxEmptyString );
|
||||||
|
|
||||||
|
if( !upath )
|
||||||
|
break;
|
||||||
|
|
||||||
|
aDst->AddPaths( upath, aIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// non-member so it can be moved easily, and kept REALLY private.
|
||||||
|
// Do NOT Clear() in here.
|
||||||
|
static void add_search_paths( SEARCH_STACK* aDst, const SEARCH_STACK& aSrc, int aIndex )
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<aSrc.GetCount(); ++i )
|
||||||
|
aDst->AddPaths( aSrc[i], aIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
bool PROJECT::MaybeLoadProjectSettings( const std::vector<wxString>& aFileSet )
|
||||||
|
{
|
||||||
|
// @todo
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString& aFileName,
|
||||||
|
const wxString& aGroupName, bool aForceUseLocalConfig )
|
||||||
|
{
|
||||||
|
wxConfigBase* cfg = 0;
|
||||||
|
wxFileName fn = aFileName;
|
||||||
|
|
||||||
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
|
||||||
|
// is there an edge transition, a change in m_project_filename?
|
||||||
|
if( m_project_name != fn )
|
||||||
|
{
|
||||||
|
m_sch_search.Clear();
|
||||||
|
|
||||||
|
SetProjectFullName( fn.GetFullPath() );
|
||||||
|
|
||||||
|
// to the empty list, add project dir as first
|
||||||
|
m_sch_search.AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
// append all paths from aSList
|
||||||
|
add_search_paths( &m_sch_search, aSList, -1 );
|
||||||
|
|
||||||
|
// addLibrarySearchPaths( SEARCH_STACK* aSP, wxConfigBase* aCfg )
|
||||||
|
// This is undocumented, but somebody wanted to store !schematic!
|
||||||
|
// library search paths in the .kicad_common file?
|
||||||
|
add_search_paths( &m_sch_search, Pgm().CommonSettings(), -1 );
|
||||||
|
|
||||||
|
#if 1 && defined(DEBUG)
|
||||||
|
m_sch_search.Show( __func__ );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init local config filename
|
||||||
|
if( aForceUseLocalConfig || fn.FileExists() )
|
||||||
|
{
|
||||||
|
wxString cur_pro_fn = fn.GetFullPath();
|
||||||
|
|
||||||
|
cfg = new wxFileConfig( wxEmptyString, wxEmptyString, cur_pro_fn, wxEmptyString );
|
||||||
|
|
||||||
|
cfg->DontCreateOnDemand();
|
||||||
|
|
||||||
|
if( aForceUseLocalConfig )
|
||||||
|
{
|
||||||
|
SetProjectFullName( cur_pro_fn );
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the application version against the version saved in the
|
||||||
|
* project file.
|
||||||
|
*
|
||||||
|
* TODO: Push the version test up the stack so that when one of the
|
||||||
|
* KiCad application version changes, the other applications
|
||||||
|
* settings do not get updated. Practically, this can go away.
|
||||||
|
* It isn't used anywhere as far as I know (WLS).
|
||||||
|
*/
|
||||||
|
|
||||||
|
cfg->SetPath( aGroupName );
|
||||||
|
|
||||||
|
int def_version = 0;
|
||||||
|
int version = cfg->Read( wxT( "version" ), def_version );
|
||||||
|
|
||||||
|
if( version > 0 )
|
||||||
|
{
|
||||||
|
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
SetProjectFullName( cur_pro_fn );
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
else // Version incorrect
|
||||||
|
{
|
||||||
|
delete cfg;
|
||||||
|
cfg = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for the template kicad.pro file by using caller's SEARCH_STACK.
|
||||||
|
|
||||||
|
wxString kicad_pro_template = aSList.FindValidPath( wxT( "kicad.pro" ) );
|
||||||
|
|
||||||
|
if( !kicad_pro_template )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Template file <kicad.pro> not found." ) );
|
||||||
|
|
||||||
|
fn = wxFileName( wxStandardPaths::Get().GetDocumentsDir(),
|
||||||
|
wxT( "kicad" ), ProjectFileExtension );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fn = kicad_pro_template;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg = new wxFileConfig( wxEmptyString, wxEmptyString, wxEmptyString, fn.GetFullPath() );
|
||||||
|
cfg->DontCreateOnDemand();
|
||||||
|
|
||||||
|
SetProjectFullName( fn.GetFullPath() );
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aFileName,
|
||||||
|
const wxString& aGroupName, const PARAM_CFG_ARRAY& aParams )
|
||||||
|
{
|
||||||
|
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, FORCE_LOCAL_CONFIG ) );
|
||||||
|
|
||||||
|
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
|
||||||
|
cfg->Write( wxT( "update" ), DateAndTime() );
|
||||||
|
|
||||||
|
// @todo: pass in aLastClient wxString:
|
||||||
|
cfg->Write( wxT( "last_client" ), Pgm().App().GetAppName() );
|
||||||
|
|
||||||
|
// Save parameters
|
||||||
|
cfg->DeleteGroup( aGroupName ); // Erase all data
|
||||||
|
cfg->Flush();
|
||||||
|
|
||||||
|
cfg->SetPath( aGroupName );
|
||||||
|
cfg->Write( wxT( "version" ), CONFIG_VERSION );
|
||||||
|
|
||||||
|
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
|
||||||
|
wxConfigSaveParams( cfg.get(), aParams, aGroupName );
|
||||||
|
|
||||||
|
cfg->SetPath( UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
|
// cfg is deleted here by std::auto_ptr, that saves the *.pro file to disk
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName,
|
||||||
|
const wxString& aGroupName, const PARAM_CFG_ARRAY& aParams,
|
||||||
|
bool doLoadOnlyIfNew )
|
||||||
|
{
|
||||||
|
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, false ) );
|
||||||
|
|
||||||
|
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
|
||||||
|
wxString timestamp = cfg->Read( wxT( "update" ) );
|
||||||
|
|
||||||
|
if( doLoadOnlyIfNew && timestamp.size() &&
|
||||||
|
timestamp == m_pro_date_and_time )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pro_date_and_time = timestamp;
|
||||||
|
|
||||||
|
wxConfigLoadParams( cfg.get(), aParams, aGroupName );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
|
||||||
|
#include <macros.h>
|
||||||
|
#include <search_stack.h>
|
||||||
|
#include <wx/tokenzr.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
#define PATH_SEPS wxT(";\r\n")
|
||||||
|
#else
|
||||||
|
#define PATH_SEPS wxT(":;\r\n") // unix == linux | mac
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
wxString SEARCH_STACK::FilenameWithRelativePathInSearchList( const wxString& aFullFilename )
|
||||||
|
{
|
||||||
|
/* If the library path is already in the library search paths
|
||||||
|
* list, just add the library name to the list. Otherwise, add
|
||||||
|
* the library name with the full or relative path.
|
||||||
|
* the relative path, when possible is preferable,
|
||||||
|
* because it preserve use of default libraries paths, when the path is a sub path of
|
||||||
|
* these default paths
|
||||||
|
* Note we accept only sub paths,
|
||||||
|
* not relative paths starting by ../ that are not subpaths and are outside kicad libs paths
|
||||||
|
*/
|
||||||
|
wxFileName fn = aFullFilename;
|
||||||
|
wxString filename = aFullFilename;
|
||||||
|
|
||||||
|
unsigned pathlen = fn.GetPath().Len(); // path len, used to find the better (shortest)
|
||||||
|
// subpath within defaults paths
|
||||||
|
|
||||||
|
for( unsigned kk = 0; kk < GetCount(); kk++ )
|
||||||
|
{
|
||||||
|
fn = aFullFilename;
|
||||||
|
|
||||||
|
// Search for the shortest subpath within 'this':
|
||||||
|
if( fn.MakeRelativeTo( (*this)[kk] ) )
|
||||||
|
{
|
||||||
|
if( fn.GetPathWithSep().StartsWith( wxT("..") ) ) // Path outside kicad libs paths
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( pathlen > fn.GetPath().Len() ) // A better (shortest) subpath is found
|
||||||
|
{
|
||||||
|
filename = fn.GetPathWithSep() + fn.GetFullName();
|
||||||
|
pathlen = fn.GetPath().Len();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SEARCH_STACK::RemovePaths( const wxString& aPaths )
|
||||||
|
{
|
||||||
|
wxStringTokenizer tokenizer( aPaths, PATH_SEPS, wxTOKEN_STRTOK );
|
||||||
|
|
||||||
|
while( tokenizer.HasMoreTokens() )
|
||||||
|
{
|
||||||
|
wxString path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
|
if( Index( path, wxFileName::IsCaseSensitive() ) != wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
Remove( path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SEARCH_STACK::AddPaths( const wxString& aPaths, int aIndex )
|
||||||
|
{
|
||||||
|
bool isCS = wxFileName::IsCaseSensitive();
|
||||||
|
wxStringTokenizer tokenizer( aPaths, PATH_SEPS, wxTOKEN_STRTOK );
|
||||||
|
|
||||||
|
// appending all of them, on large or negative aIndex
|
||||||
|
if( unsigned( aIndex ) >= GetCount() )
|
||||||
|
{
|
||||||
|
while( tokenizer.HasMoreTokens() )
|
||||||
|
{
|
||||||
|
wxString path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
|
if( wxFileName::IsDirReadable( path )
|
||||||
|
&& Index( path, isCS ) == wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
Add( path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// inserting all of them:
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while( tokenizer.HasMoreTokens() )
|
||||||
|
{
|
||||||
|
wxString path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
|
if( wxFileName::IsDirReadable( path )
|
||||||
|
&& Index( path, isCS ) == wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
Insert( path, aIndex );
|
||||||
|
aIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString SEARCH_STACK::FindFileInSearchPaths(
|
||||||
|
const wxString& aFilename, const wxArrayString* aSubdirs )
|
||||||
|
{
|
||||||
|
wxPathList paths;
|
||||||
|
|
||||||
|
for( unsigned i = 0; i < GetCount(); ++i )
|
||||||
|
{
|
||||||
|
wxFileName fn( (*this)[i] );
|
||||||
|
|
||||||
|
if( aSubdirs )
|
||||||
|
{
|
||||||
|
for( unsigned j = 0; j < aSubdirs->GetCount(); j++ )
|
||||||
|
fn.AppendDir( (*aSubdirs)[j] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fn.DirExists() )
|
||||||
|
{
|
||||||
|
paths.Add( fn.GetPath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths.FindValidPath( aFilename );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RETAINED_PATH::Clear()
|
||||||
|
{
|
||||||
|
m_retained_path.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString RETAINED_PATH::LastVisitedPath( const SEARCH_STACK& aSStack, const wxString& aSubPathToSearch )
|
||||||
|
{
|
||||||
|
if( !!m_retained_path )
|
||||||
|
return m_retained_path;
|
||||||
|
|
||||||
|
wxString path;
|
||||||
|
|
||||||
|
// Initialize default path to the main default lib path
|
||||||
|
// this is the second path in list (the first is the project path)
|
||||||
|
unsigned pcount = aSStack.GetCount();
|
||||||
|
|
||||||
|
if( pcount )
|
||||||
|
{
|
||||||
|
unsigned ipath = 0;
|
||||||
|
|
||||||
|
if( aSStack[0] == wxGetCwd() )
|
||||||
|
ipath = 1;
|
||||||
|
|
||||||
|
// First choice of path:
|
||||||
|
if( ipath < pcount )
|
||||||
|
path = aSStack[ipath];
|
||||||
|
|
||||||
|
// Search a sub path matching aSubPathToSearch
|
||||||
|
if( !aSubPathToSearch.IsEmpty() )
|
||||||
|
{
|
||||||
|
for( ; ipath < pcount; ipath++ )
|
||||||
|
{
|
||||||
|
if( aSStack[ipath].Contains( aSubPathToSearch ) )
|
||||||
|
{
|
||||||
|
path = aSStack[ipath];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( path.IsEmpty() )
|
||||||
|
path = wxGetCwd();
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RETAINED_PATH::SaveLastVisitedPath( const wxString& aPath )
|
||||||
|
{
|
||||||
|
m_retained_path = aPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
void SEARCH_STACK::Show( const char* aPrefix ) const
|
||||||
|
{
|
||||||
|
printf( "%s SEARCH_STACK:\n", aPrefix );
|
||||||
|
for( unsigned i=0; i<GetCount(); ++i )
|
||||||
|
{
|
||||||
|
printf( " [%2i]:%s\n", i, TO_UTF8( (*this)[i] ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -25,33 +25,30 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
This is a program launcher for a single KIFACE DSO. Initially it will only
|
This is a program launcher for a single KIFACE DSO. It only mimics a KIWAY,
|
||||||
mimic a KIWAY, not actually implement one, since only a single DSO is
|
not actually implements one, since only a single DSO is supported by it.
|
||||||
supported by it.
|
|
||||||
|
It is compiled multiple times, once for each standalone program and as such
|
||||||
|
gets different compiler command line supplied #defines from CMake.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <wx/dynlib.h>
|
#include <wx/dynlib.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <kiway.h>
|
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
#include <wx/snglinst.h>
|
||||||
|
|
||||||
|
#include <kiway.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
#include <kiway_player.h>
|
||||||
|
#include <confirm.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
// The functions we use will cause the program launcher to pull stuff in
|
||||||
* Class PROCESS
|
// during linkage, keep the map file in mind to see what's going into it.
|
||||||
* provides its own OnInit() handler.
|
|
||||||
*/
|
|
||||||
class PROCESS : public wxApp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
bool OnInit();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_APP( PROCESS )
|
|
||||||
|
|
||||||
|
|
||||||
#if !wxCHECK_VERSION( 3, 0, 0 )
|
#if !wxCHECK_VERSION( 3, 0, 0 )
|
||||||
|
@ -107,41 +104,6 @@ static wxString wxJoin(const wxArrayString& arr, const wxChar sep,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// POLICY CHOICE: return the full path of the DSO to load from single_top.
|
|
||||||
static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
|
|
||||||
{
|
|
||||||
// Prefix basename with '_' and change extension to DSO_EXT.
|
|
||||||
|
|
||||||
// POLICY CHOICE: Keep same path, and therefore installer must put the major DSO
|
|
||||||
// in same dir as top process module. Obviously alternatives are possible
|
|
||||||
// and that is why this is a separate function. One alternative would be to use
|
|
||||||
// a portion of CMAKE_INSTALL_PREFIX and navigate to a "lib" dir, but that
|
|
||||||
// would require a recompile any time you chose to install into a different place.
|
|
||||||
|
|
||||||
// It is my decision to treat _eeschema.so and _pcbnew.so as "executables",
|
|
||||||
// not "libraries" in this regard, since most all program functionality lives
|
|
||||||
// in them. They are basically spin-offs from what was once a top process module.
|
|
||||||
// That may not make linux package maintainers happy, but that is not my job.
|
|
||||||
// Get over it. KiCad is not a trivial suite, and multiple platforms come
|
|
||||||
// into play, not merely linux. If it freaks you out, we can use a different
|
|
||||||
// file extension than ".so", but they are not purely libraries, else they
|
|
||||||
// would begin with "lib" in basename. Like I said, get over it, we're serving
|
|
||||||
// too many masters here: python, windows, linux, OSX, multiple versions of wx...
|
|
||||||
|
|
||||||
wxFileName fn( aAbsoluteArgv0 );
|
|
||||||
wxString basename( KIFACE_PREFIX ); // start with special prefix
|
|
||||||
|
|
||||||
basename += fn.GetName(); // add argv[0]'s basename
|
|
||||||
fn.SetName( basename );
|
|
||||||
|
|
||||||
// here a suffix == an extension with a preceding '.',
|
|
||||||
// so skip the preceding '.' to get an extension
|
|
||||||
fn.SetExt( KIFACE_SUFFIX + 1 ); // special extension, + 1 => &KIFACE_SUFFIX[1]
|
|
||||||
|
|
||||||
return fn.GetFullPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
|
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
|
||||||
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
|
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
|
||||||
{
|
{
|
||||||
|
@ -157,13 +119,13 @@ const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPa
|
||||||
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
|
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
|
||||||
void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
||||||
{
|
{
|
||||||
// POLICY CHOICE: Keep same path, so that installer MAY put the
|
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
|
||||||
// "subsidiary shared libraries" in the same directory as the top process module.
|
// "subsidiary DSOs" in the same directory as the kiway top process modules.
|
||||||
// A subsidiary shared library is one that is not a top level DSO, but rather
|
// A subsidiary shared library is one that is not a top level DSO, but rather
|
||||||
// some shared library that a top level DSO needs to even be loaded. It is
|
// some shared library that a top level DSO needs to even be loaded. It is
|
||||||
// a static link to a shared object from a top level DSO.
|
// a static link to a shared object from a top level DSO.
|
||||||
|
|
||||||
// This directory POLICY CHOICE is not the only dir in play, since LIB_ENV_VAR
|
// This directory POLICY CHOICE 2 is not the only dir in play, since LIB_ENV_VAR
|
||||||
// has numerous path options in it, as does DSO searching on linux, windows, and OSX.
|
// has numerous path options in it, as does DSO searching on linux, windows, and OSX.
|
||||||
// See "man ldconfig" on linux. What's being done here is for quick installs
|
// See "man ldconfig" on linux. What's being done here is for quick installs
|
||||||
// into a non-standard place, and especially for Windows users who may not
|
// into a non-standard place, and especially for Windows users who may not
|
||||||
|
@ -186,28 +148,119 @@ void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POLICY CHOICE 1: return the full path of the DSO to load from single_top.
|
||||||
|
static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
|
||||||
|
{
|
||||||
|
// Prefix basename with ${KIFACE_PREFIX} and change extension to ${KIFACE_SUFFIX}
|
||||||
|
|
||||||
// Only a single KIWAY is supported in this single_top top level component,
|
// POLICY CHOICE 1: Keep same path, and therefore installer must put the kiface DSO
|
||||||
// which is dedicated to loading only a single DSO.
|
// in same dir as top process module. Obviously alternatives are possible
|
||||||
static KIWAY standalone;
|
// and that is why this is a separate function. One alternative would be to use
|
||||||
|
// a portion of CMAKE_INSTALL_PREFIX and navigate to a "lib" dir, but that
|
||||||
|
// would require a recompile any time you chose to install into a different place.
|
||||||
|
|
||||||
|
// It is my decision to treat _eeschema.kiface and _pcbnew.kiface as "executables",
|
||||||
|
// not "libraries" in this regard, since most all program functionality lives
|
||||||
|
// in them. They are basically spin-offs from what was once a top process module.
|
||||||
|
// That may not make linux package maintainers happy, but that is not my job.
|
||||||
|
// Get over it. KiCad is not a trivial suite, and multiple platforms come
|
||||||
|
// into play, not merely linux. For starters they will use extension ".kicad",
|
||||||
|
// but later in time morph to ".so". They are not purely libraries, else they
|
||||||
|
// would begin with "lib" in basename. Like I said, get over it, we're serving
|
||||||
|
// too many masters here: python, windows, linux, OSX, multiple versions of wx...
|
||||||
|
|
||||||
|
wxFileName fn( aAbsoluteArgv0 );
|
||||||
|
wxString basename( KIFACE_PREFIX ); // start with special prefix
|
||||||
|
|
||||||
|
basename += fn.GetName(); // add argv[0]'s basename
|
||||||
|
fn.SetName( basename );
|
||||||
|
|
||||||
|
// Here a "suffix" == an extension with a preceding '.',
|
||||||
|
// so skip the preceding '.' to get an extension
|
||||||
|
fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1]
|
||||||
|
|
||||||
|
return fn.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
// Use of this is arbitrary, remember single_top only knows about a single DSO.
|
// Use of this is arbitrary, remember single_top only knows about a single DSO.
|
||||||
// Could have used one from the KIWAY also.
|
// Could have used one from the KIWAY also.
|
||||||
static wxDynamicLibrary dso;
|
static wxDynamicLibrary dso;
|
||||||
|
|
||||||
|
|
||||||
|
// Only a single KIWAY is supported in this single_top top level component,
|
||||||
|
// which is dedicated to loading only a single DSO.
|
||||||
|
static KIWAY kiway;
|
||||||
|
|
||||||
|
|
||||||
|
// implement a PGM_BASE and a wxApp side by side:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct PGM_SINGLE_TOP
|
||||||
|
* implements PGM_BASE with its own OnPgmInit() and OnPgmExit().
|
||||||
|
*/
|
||||||
|
static struct PGM_SINGLE_TOP : public PGM_BASE
|
||||||
|
{
|
||||||
|
bool OnPgmInit( wxApp* aWxApp ); // overload PGM_BASE virtual
|
||||||
|
void OnPgmExit(); // overload PGM_BASE virtual
|
||||||
|
void MacOpenFile( const wxString& aFileName ); // overload PGM_BASE virtual
|
||||||
|
} program;
|
||||||
|
|
||||||
|
|
||||||
|
PGM_BASE& Pgm()
|
||||||
|
{
|
||||||
|
return program;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct APP_SINGLE_TOP
|
||||||
|
* implements a bare naked wxApp (so that we don't become dependent on
|
||||||
|
* functionality in a wxApp derivative that we cannot deliver under wxPython).
|
||||||
|
*/
|
||||||
|
struct APP_SINGLE_TOP : public wxApp
|
||||||
|
{
|
||||||
|
bool OnInit() // overload wxApp virtual
|
||||||
|
{
|
||||||
|
return Pgm().OnPgmInit( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
int OnExit() // overload wxApp virtual
|
||||||
|
{
|
||||||
|
Pgm().OnPgmExit();
|
||||||
|
return wxApp::OnExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function MacOpenFile
|
||||||
|
* is specific to MacOSX (not used under Linux or Windows).
|
||||||
|
* MacOSX requires it for file association.
|
||||||
|
* @see http://wiki.wxwidgets.org/WxMac-specific_topics
|
||||||
|
*/
|
||||||
|
void MacOpenFile( const wxString& aFileName ) // overload wxApp virtual
|
||||||
|
{
|
||||||
|
Pgm().MacOpenFile( aFileName );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_APP( APP_SINGLE_TOP );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function get_kiface_getter
|
* Function get_kiface_getter
|
||||||
* returns a KIFACE_GETTER_FUNC for the current process's main implemation link image.
|
* returns a KIFACE_GETTER_FUNC for the current process's main implementation
|
||||||
|
* link image.
|
||||||
*
|
*
|
||||||
* @param aDSOName is an absolute full path to the DSO to load and find KIFACE_GETTER_FUNC within.
|
* @param aDSOName is an absolute full path to the DSO to load and find
|
||||||
|
* KIFACE_GETTER_FUNC within.
|
||||||
*
|
*
|
||||||
* @return KIFACE_GETTER_FUNC* - a pointer to a function which can be called to get the KIFACE
|
* @return KIFACE_GETTER_FUNC* - a pointer to a function which can be called to
|
||||||
* or NULL if the getter func was not found. If not found, it is possibly not version compatible
|
* get the KIFACE or NULL if the getter func was not found. If not found,
|
||||||
* since the lookup is done by name and the name contains the API version.
|
* it is possibly not version compatible since the lookup is done by name and
|
||||||
|
* the name contains the API version.
|
||||||
*/
|
*/
|
||||||
static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
|
static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
|
||||||
{
|
{
|
||||||
|
#if defined(BUILD_KIWAY_DLL)
|
||||||
void* addr = NULL;
|
void* addr = NULL;
|
||||||
|
|
||||||
if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) )
|
if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) )
|
||||||
|
@ -223,6 +276,11 @@ static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
|
||||||
}
|
}
|
||||||
|
|
||||||
return (KIFACE_GETTER_FUNC*) addr;
|
return (KIFACE_GETTER_FUNC*) addr;
|
||||||
|
|
||||||
|
#else
|
||||||
|
return &KIFACE_GETTER;
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,32 +288,13 @@ static KIFACE* kiface;
|
||||||
static int kiface_version;
|
static int kiface_version;
|
||||||
|
|
||||||
|
|
||||||
bool PROCESS::OnInit()
|
|
||||||
|
bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
||||||
{
|
{
|
||||||
// Choose to use argv command line processing in base class's OnInit().
|
// first thing: set m_wx_app
|
||||||
// That choice is not mandatory, see wx's appbase.cpp OnInit().
|
m_wx_app = aWxApp;
|
||||||
if( !wxApp::OnInit() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
wxStandardPathsBase& paths = wxStandardPaths::Get();
|
wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
|
||||||
|
|
||||||
#if defined(DEBUG)
|
|
||||||
wxString dir = paths.GetLocalizedResourcesDir( wxT( "de" ),
|
|
||||||
wxStandardPaths::ResourceCat_None );
|
|
||||||
|
|
||||||
printf( "LocalizeResourcesDir:'%s'\n", TO_UTF8( dir ) );
|
|
||||||
|
|
||||||
wxString dummy( _( "translate this" ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxString absoluteArgv0 = paths.GetExecutablePath();
|
|
||||||
|
|
||||||
#if 0 && defined(DEBUG)
|
|
||||||
printf( "argv[0]:'%s' absoluteArgv0:'%s'\n",
|
|
||||||
TO_UTF8( wxString( argv[0] ) ),
|
|
||||||
TO_UTF8( absoluteArgv0 )
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !wxIsAbsolutePath( absoluteArgv0 ) )
|
if( !wxIsAbsolutePath( absoluteArgv0 ) )
|
||||||
{
|
{
|
||||||
|
@ -267,6 +306,9 @@ bool PROCESS::OnInit()
|
||||||
// KIFACE has hard dependencies on subsidiary DSOs below it.
|
// KIFACE has hard dependencies on subsidiary DSOs below it.
|
||||||
SetLibEnvVar( absoluteArgv0 );
|
SetLibEnvVar( absoluteArgv0 );
|
||||||
|
|
||||||
|
if( !initPgm() )
|
||||||
|
return false;
|
||||||
|
|
||||||
wxString dname = dso_full_path( absoluteArgv0 );
|
wxString dname = dso_full_path( absoluteArgv0 );
|
||||||
|
|
||||||
// Get the getter.
|
// Get the getter.
|
||||||
|
@ -279,24 +321,147 @@ bool PROCESS::OnInit()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the KIFACE, and give the DSO a single chance to do its
|
// Get the KIFACE.
|
||||||
// "process level" initialization.
|
kiface = getter( &kiface_version, KIFACE_VERSION, this );
|
||||||
kiface = getter( &kiface_version, KIFACE_VERSION, &wxGetApp() );
|
|
||||||
|
|
||||||
// KIFACE_GETTER_FUNC function comment (API) says the non-NULL is uconditional.
|
// KIFACE_GETTER_FUNC function comment (API) says the non-NULL is unconditional.
|
||||||
wxASSERT_MSG( kiface, wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
|
wxASSERT_MSG( kiface, wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
|
||||||
|
|
||||||
// Use KIFACE to create a window that the KIFACE knows about,
|
// Give the DSO a single chance to do its "process level" initialization.
|
||||||
// pass classId=0 for now. KIFACE::CreateWindow() is a virtual
|
// "Process level" specifically means stay away from any projects in there.
|
||||||
// so we don't need to link to it.
|
if( !kiface->OnKifaceStart( this ) )
|
||||||
wxFrame* frame = (wxFrame*) kiface->CreateWindow( 0, &standalone );
|
return false;
|
||||||
|
|
||||||
SetTopWindow( frame );
|
// Use KIFACE to create a top window that the KIFACE knows about.
|
||||||
|
// TOP_FRAME is passed on compiler command line from CMake, and is one of
|
||||||
|
// the types in ID_DRAWFRAME_TYPE.
|
||||||
|
// KIFACE::CreateWindow() is a virtual so we don't need to link to it.
|
||||||
|
// Remember its in the *.kiface DSO.
|
||||||
|
#if 0
|
||||||
|
// this pulls in EDA_DRAW_FRAME type info, which we don't want in single_top
|
||||||
|
KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( kiface->CreateWindow(
|
||||||
|
NULL, TOP_FRAME, &kiway, KFCTL_STANDALONE ) );
|
||||||
|
#else
|
||||||
|
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
|
||||||
|
NULL, TOP_FRAME, &kiway, KFCTL_STANDALONE );
|
||||||
|
#endif
|
||||||
|
|
||||||
frame->Centre();
|
App().SetTopWindow( frame ); // wxApp gets a face.
|
||||||
|
|
||||||
|
// Open project or file specified on the command line:
|
||||||
|
int argc = App().argc;
|
||||||
|
|
||||||
|
if( argc > 1 )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
gerbview handles multiple project data files, i.e. gerber files on
|
||||||
|
cmd line. Others currently do not, they handle only one. For common
|
||||||
|
code simplicity we simply pass all the arguments in however, each
|
||||||
|
program module can do with them what they want, ignore, complain
|
||||||
|
whatever. We don't establish policy here, as this is a multi-purpose
|
||||||
|
launcher.
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::vector<wxString> argSet;
|
||||||
|
|
||||||
|
for( int i=1; i<argc; ++i )
|
||||||
|
{
|
||||||
|
argSet.push_back( App().argv[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// special attention to the first argument: argv[1] (==argSet[0])
|
||||||
|
wxFileName argv1( argSet[0] );
|
||||||
|
|
||||||
|
if( argc == 2 )
|
||||||
|
{
|
||||||
|
#if defined(PGM_DATA_FILE_EXT)
|
||||||
|
// PGM_DATA_FILE_EXT is different for each compile, it may come
|
||||||
|
// from CMake on the compiler command line, often does not.
|
||||||
|
// This facillity is mostly useful only for those program modules
|
||||||
|
// supporting a single argv[1].
|
||||||
|
if( !argv1.GetExt() )
|
||||||
|
argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) );
|
||||||
|
|
||||||
|
argSet[0] = argv1.GetFullPath();
|
||||||
|
#endif
|
||||||
|
if( !Pgm().LockFile( argSet[0] ) )
|
||||||
|
{
|
||||||
|
wxLogSysError( _( "This file is already open." ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @todo: setting CWD is taboo in a multi-project environment, this
|
||||||
|
// will not be possible soon.
|
||||||
|
if( argv1.GetPath().size() ) // path only
|
||||||
|
{
|
||||||
|
// wxSetWorkingDirectory() does not like empty paths
|
||||||
|
wxSetWorkingDirectory( argv1.GetPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the KIWAY_PLAYER::OpenProjectFiles() API function:
|
||||||
|
if( !frame->OpenProjectFiles( argSet ) )
|
||||||
|
{
|
||||||
|
// OpenProjectFiles() API asks that it report failure to the UI.
|
||||||
|
// Nothing further to say here.
|
||||||
|
|
||||||
|
// Fail the process startup if the file could not be opened,
|
||||||
|
// although this is an optional choice, one that can be reversed
|
||||||
|
// also in the KIFACE specific OpenProjectFiles() return value.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The lean single_top program launcher has no access program settings,
|
||||||
|
else it would not be lean. That kind of functionality is in the
|
||||||
|
KIFACE now, but it cannot assume that it is the only KIFACE in memory.
|
||||||
|
So this looks like a dead concept here, or an expensive one in terms
|
||||||
|
of code size.
|
||||||
|
|
||||||
|
wxString dir;
|
||||||
|
|
||||||
|
if( m_pgmSettings->Read( workingDirKey, &dir ) && wxDirExists( dir ) )
|
||||||
|
{
|
||||||
|
wxSetWorkingDirectory( dir );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
frame->Show();
|
frame->Show();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_SINGLE_TOP::OnPgmExit()
|
||||||
|
{
|
||||||
|
if( kiface )
|
||||||
|
kiface->OnKifaceEnd();
|
||||||
|
|
||||||
|
saveCommonSettings();
|
||||||
|
|
||||||
|
// write common settings to disk, and destroy everything in PGM_BASE,
|
||||||
|
// especially wxSingleInstanceCheckerImpl earlier than wxApp and earlier
|
||||||
|
// than static destruction would.
|
||||||
|
PGM_BASE::destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PGM_SINGLE_TOP::MacOpenFile( const wxString& aFileName )
|
||||||
|
{
|
||||||
|
wxFileName filename( aFileName );
|
||||||
|
|
||||||
|
if( filename.FileExists() )
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
// this pulls in EDA_DRAW_FRAME type info, which we don't want in single_top
|
||||||
|
// link image.
|
||||||
|
KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( App().GetTopWindow() );
|
||||||
|
#else
|
||||||
|
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) App().GetTopWindow();
|
||||||
|
#endif
|
||||||
|
if( frame )
|
||||||
|
frame->OpenProjectFiles( std::vector<wxString>( 1, aFileName ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <search_stack.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
|
||||||
|
|
||||||
|
// put your best guesses in here, send the computer on a wild goose chase, its
|
||||||
|
// got nothing else to do.
|
||||||
|
|
||||||
|
void SystemDirsAppend( SEARCH_STACK* aSearchStack )
|
||||||
|
{
|
||||||
|
// No clearing is done here, the most general approach is NOT to assume that
|
||||||
|
// our appends will be the only thing in the stack. This function has no
|
||||||
|
// knowledge of caller's intentions.
|
||||||
|
|
||||||
|
// wxPathList::AddEnvList() is broken, use SEARCH_STACK::AddPaths().
|
||||||
|
// SEARCH_STACK::AddPaths() will verify readability and existence of
|
||||||
|
// each directory before adding.
|
||||||
|
SEARCH_STACK maybe;
|
||||||
|
|
||||||
|
// User environment variable path is the first search path. Chances are
|
||||||
|
// if the user is savvy enough to set an environment variable they know
|
||||||
|
// what they are doing. It should take precedence over anything else.
|
||||||
|
// Otherwise don't set it.
|
||||||
|
maybe.AddPaths( wxGetenv( wxT( "KICAD" ) ) );
|
||||||
|
|
||||||
|
// This is from CMAKE_INSTALL_PREFIX.
|
||||||
|
// Useful when KiCad is installed by `make install`.
|
||||||
|
// Use as second ranked place.
|
||||||
|
maybe.AddPaths( wxT( DEFAULT_INSTALL_PATH ) );
|
||||||
|
|
||||||
|
// Add the directory for the user-dependent, program specific, data files:
|
||||||
|
// Unix: ~/.appname
|
||||||
|
// Windows: C:\Documents and Settings\username\Application Data\appname
|
||||||
|
// Mac: ~/Library/Application Support/appname
|
||||||
|
maybe.AddPaths( wxStandardPaths::Get().GetUserDataDir() );
|
||||||
|
|
||||||
|
{
|
||||||
|
// Should be full path to this program executable.
|
||||||
|
wxString bin_dir = Pgm().GetExecutablePath();
|
||||||
|
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
// bin_dir uses unix path separator. So to parse with wxFileName
|
||||||
|
// use windows separator, especially important for server inclusion:
|
||||||
|
// like: \\myserver\local_path .
|
||||||
|
bin_dir.Replace( wxFileName::GetPathSeparator( wxPATH_UNIX ),
|
||||||
|
wxFileName::GetPathSeparator( wxPATH_WIN ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxFileName bin_fn( bin_dir, wxEmptyString );
|
||||||
|
|
||||||
|
// Dir of the global (not user-specific), application specific, data files.
|
||||||
|
// From wx docs:
|
||||||
|
// Unix: prefix/share/appname
|
||||||
|
// Windows: the directory where the executable file is located
|
||||||
|
// Mac: appname.app/Contents/SharedSupport bundle subdirectory
|
||||||
|
wxString data_dir = wxStandardPaths::Get().GetDataDir();
|
||||||
|
|
||||||
|
if( bin_fn.GetPath() != data_dir )
|
||||||
|
{
|
||||||
|
// add data_dir if it is different from the bin_dir
|
||||||
|
maybe.AddPaths( data_dir );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Up one level relative to binary path with "share" appended below.
|
||||||
|
bin_fn.RemoveLastDir();
|
||||||
|
maybe.AddPaths( bin_fn.GetPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The normal OS program file install paths allow for a binary to be
|
||||||
|
* installed in a different path from the library files. This is
|
||||||
|
* useful for development purposes so the library and documentation
|
||||||
|
* files do not need to be installed separately. If someone can
|
||||||
|
* figure out a way to implement this without #ifdef, please do.
|
||||||
|
*/
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
maybe.AddPaths( wxGetenv( wxT( "PROGRAMFILES" ) ) );
|
||||||
|
#elif __WXMAC__
|
||||||
|
maybe.AddPaths( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) );
|
||||||
|
maybe.AddPaths( wxT( "/Library/Application Support" ) );
|
||||||
|
#else
|
||||||
|
maybe.AddPaths( wxGetenv( wxT( "PATH" ) ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(DEBUG) && 0
|
||||||
|
maybe.Show( "maybe wish list" );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Append 1) kicad, 2) kicad/share, 3) share, and 4) share/kicad to each
|
||||||
|
// possible base path in 'maybe'. Since SEARCH_STACK::AddPaths() will verify
|
||||||
|
// readability and existence of each directory, not all of these will be
|
||||||
|
// actually appended.
|
||||||
|
for( unsigned i = 0; i < maybe.GetCount(); ++i )
|
||||||
|
{
|
||||||
|
wxFileName fn( maybe[i], wxEmptyString );
|
||||||
|
|
||||||
|
if( fn.GetPath().AfterLast( fn.GetPathSeparator() ) == wxT( "bin" ) )
|
||||||
|
{
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
|
||||||
|
if( !fn.GetDirCount() )
|
||||||
|
continue; // at least on linux
|
||||||
|
}
|
||||||
|
|
||||||
|
aSearchStack->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
|
aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/kicad
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "share" ) );
|
||||||
|
aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/kicad/share
|
||||||
|
|
||||||
|
fn.RemoveLastDir(); // ../ clear share
|
||||||
|
fn.RemoveLastDir(); // ../ clear kicad
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "share" ) );
|
||||||
|
aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/share
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
|
aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/share/kicad
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(DEBUG) && 0
|
||||||
|
// final results:
|
||||||
|
aSearchStack->Show( __func__ );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ const wxString ProjectFileExtension( wxT( "pro" ) );
|
||||||
const wxString SchematicFileExtension( wxT( "sch" ) );
|
const wxString SchematicFileExtension( wxT( "sch" ) );
|
||||||
const wxString NetlistFileExtension( wxT( "net" ) );
|
const wxString NetlistFileExtension( wxT( "net" ) );
|
||||||
const wxString ComponentFileExtension( wxT( "cmp" ) );
|
const wxString ComponentFileExtension( wxT( "cmp" ) );
|
||||||
const wxString GerberFileExtension( wxT( "pho" ) );
|
const wxString GerberFileExtension( wxT( ".((gbr|(gb|gt)[alops])|pho)" ) );
|
||||||
|
|
||||||
const wxString LegacyPcbFileExtension( wxT( "brd" ) );
|
const wxString LegacyPcbFileExtension( wxT( "brd" ) );
|
||||||
const wxString KiCadPcbFileExtension( wxT( "kicad_pcb" ) );
|
const wxString KiCadPcbFileExtension( wxT( "kicad_pcb" ) );
|
||||||
|
|
|
@ -31,13 +31,13 @@
|
||||||
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <drawtxt.h>
|
#include <drawtxt.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <worksheet.h>
|
#include <worksheet.h>
|
||||||
#include <class_title_block.h>
|
#include <class_title_block.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
|
@ -170,7 +170,7 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
msg += productName + wxGetApp().GetAppName();
|
msg += productName + Pgm().App().GetAppName();
|
||||||
msg += wxT( " " ) + GetBuildVersion();
|
msg += wxT( " " ) + GetBuildVersion();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( EDA_UNITS_T aUnit, int textSize )
|
||||||
if( textSize > 3000 )
|
if( textSize > 3000 )
|
||||||
textSize = 3000;
|
textSize = 3000;
|
||||||
|
|
||||||
return ReturnStringFromValue( aUnit, textSize );
|
return StringFromValue( aUnit, textSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, EDA_UNITS_T aUni
|
||||||
{
|
{
|
||||||
int textsize;
|
int textsize;
|
||||||
|
|
||||||
textsize = ReturnValueFromString( aUnit, sizeText );
|
textsize = ValueFromString( aUnit, sizeText );
|
||||||
|
|
||||||
// Limit to reasonable size
|
// Limit to reasonable size
|
||||||
if( textsize < 10 )
|
if( textsize < 10 )
|
||||||
|
@ -209,8 +209,8 @@ wxPoint EDA_POSITION_CTRL::GetValue()
|
||||||
{
|
{
|
||||||
wxPoint coord;
|
wxPoint coord;
|
||||||
|
|
||||||
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue() );
|
coord.x = ValueFromString( m_UserUnit, m_FramePosX->GetValue() );
|
||||||
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue() );
|
coord.y = ValueFromString( m_UserUnit, m_FramePosY->GetValue() );
|
||||||
|
|
||||||
return coord;
|
return coord;
|
||||||
}
|
}
|
||||||
|
@ -230,11 +230,11 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
|
||||||
m_Pos_To_Edit.x = x_value;
|
m_Pos_To_Edit.x = x_value;
|
||||||
m_Pos_To_Edit.y = y_value;
|
m_Pos_To_Edit.y = y_value;
|
||||||
|
|
||||||
msg = ReturnStringFromValue( m_UserUnit, m_Pos_To_Edit.x );
|
msg = StringFromValue( m_UserUnit, m_Pos_To_Edit.x );
|
||||||
m_FramePosX->Clear();
|
m_FramePosX->Clear();
|
||||||
m_FramePosX->SetValue( msg );
|
m_FramePosX->SetValue( msg );
|
||||||
|
|
||||||
msg = ReturnStringFromValue( m_UserUnit, m_Pos_To_Edit.y );
|
msg = StringFromValue( m_UserUnit, m_Pos_To_Edit.y );
|
||||||
m_FramePosY->Clear();
|
m_FramePosY->Clear();
|
||||||
m_FramePosY->SetValue( msg );
|
m_FramePosY->SetValue( msg );
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title,
|
||||||
|
|
||||||
BoxSizer->Add( m_Text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
BoxSizer->Add( m_Text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
|
|
||||||
wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value );
|
wxString stringvalue = StringFromValue( m_UserUnit, m_Value );
|
||||||
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
|
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
|
||||||
|
|
||||||
BoxSizer->Add( m_ValueCtrl,
|
BoxSizer->Add( m_ValueCtrl,
|
||||||
|
@ -301,7 +301,7 @@ int EDA_VALUE_CTRL::GetValue()
|
||||||
int coord;
|
int coord;
|
||||||
wxString txtvalue = m_ValueCtrl->GetValue();
|
wxString txtvalue = m_ValueCtrl->GetValue();
|
||||||
|
|
||||||
coord = ReturnValueFromString( m_UserUnit, txtvalue );
|
coord = ValueFromString( m_UserUnit, txtvalue );
|
||||||
return coord;
|
return coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ void EDA_VALUE_CTRL::SetValue( int new_value )
|
||||||
|
|
||||||
m_Value = new_value;
|
m_Value = new_value;
|
||||||
|
|
||||||
buffer = ReturnStringFromValue( m_UserUnit, m_Value );
|
buffer = StringFromValue( m_UserUnit, m_Value );
|
||||||
m_ValueCtrl->SetValue( buffer );
|
m_ValueCtrl->SetValue( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <gal/graphics_abstraction_layer.h>
|
#include <gal/graphics_abstraction_layer.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <class_base_screen.h>
|
#include <class_base_screen.h>
|
||||||
#include <wxstruct.h>
|
#include <draw_frame.h>
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
#include <hotkeys_basic.h>
|
#include <hotkeys_basic.h>
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
add_definitions( -DCVPCB )
|
|
||||||
|
|
||||||
###
|
set( MAKE_LINK_MAPS true )
|
||||||
# Includes
|
|
||||||
###
|
add_definitions( -DCVPCB )
|
||||||
|
|
||||||
include_directories( BEFORE ${INC_BEFORE} )
|
include_directories( BEFORE ${INC_BEFORE} )
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -15,12 +14,13 @@ include_directories(
|
||||||
${INC_AFTER}
|
${INC_AFTER}
|
||||||
)
|
)
|
||||||
|
|
||||||
###
|
|
||||||
# Sources
|
|
||||||
###
|
|
||||||
set( CVPCB_DIALOGS
|
set( CVPCB_DIALOGS
|
||||||
dialogs/dialog_cvpcb_config.cpp
|
|
||||||
dialogs/dialog_cvpcb_config_fbp.cpp
|
# These 2 still use search paths, which don't exist in footprint land.
|
||||||
|
# dialogs/dialog_cvpcb_config.cpp
|
||||||
|
# dialogs/dialog_cvpcb_config_fbp.cpp
|
||||||
|
|
||||||
dialogs/dialog_display_options.cpp
|
dialogs/dialog_display_options.cpp
|
||||||
dialogs/dialog_display_options_base.cpp
|
dialogs/dialog_display_options_base.cpp
|
||||||
../pcbnew/dialogs/dialog_fp_lib_table.cpp
|
../pcbnew/dialogs/dialog_fp_lib_table.cpp
|
||||||
|
@ -40,101 +40,198 @@ set( CVPCB_SRCS
|
||||||
class_footprints_listbox.cpp
|
class_footprints_listbox.cpp
|
||||||
class_library_listbox.cpp
|
class_library_listbox.cpp
|
||||||
cvframe.cpp
|
cvframe.cpp
|
||||||
cvpcb.cpp
|
|
||||||
listboxes.cpp
|
listboxes.cpp
|
||||||
menubar.cpp
|
menubar.cpp
|
||||||
readwrite_dlgs.cpp
|
readwrite_dlgs.cpp
|
||||||
tool_cvpcb.cpp
|
tool_cvpcb.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
###
|
|
||||||
# Windows resource file
|
if( MINGW )
|
||||||
###
|
# CVPCB_RESOURCES variable is set by the macro.
|
||||||
if( WIN32 )
|
mingw_resource_compiler( cvpcb )
|
||||||
if( MINGW )
|
|
||||||
# CVPCB_RESOURCES variable is set by the macro.
|
|
||||||
mingw_resource_compiler( cvpcb )
|
|
||||||
else()
|
|
||||||
set( CVPCB_RESOURCES cvpcb.rc )
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###
|
|
||||||
# Apple resource files
|
|
||||||
###
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns )
|
set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns )
|
||||||
|
|
||||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns"
|
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns" PROPERTIES
|
||||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
MACOSX_PACKAGE_LOCATION Resources
|
||||||
|
)
|
||||||
|
|
||||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns"
|
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns" PROPERTIES
|
||||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
MACOSX_PACKAGE_LOCATION Resources
|
||||||
|
)
|
||||||
|
|
||||||
set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns )
|
set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns )
|
||||||
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb )
|
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###
|
|
||||||
# Create the cvpcb executable
|
|
||||||
###
|
|
||||||
add_executable( cvpcb WIN32 MACOSX_BUNDLE
|
|
||||||
${CVPCB_SRCS}
|
|
||||||
${CVPCB_DIALOGS}
|
|
||||||
${CVPCB_RESOURCES}
|
|
||||||
)
|
|
||||||
|
|
||||||
###
|
if( USE_KIWAY_DLLS )
|
||||||
# Set properties for APPLE on cvpcb target
|
add_executable( cvpcb WIN32 MACOSX_BUNDLE
|
||||||
###
|
../common/single_top.cpp
|
||||||
if( APPLE )
|
../common/pgm_base.cpp
|
||||||
set_target_properties( cvpcb PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
|
${CVPCB_RESOURCES}
|
||||||
|
)
|
||||||
|
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS "TOP_FRAME=CVPCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL"
|
||||||
|
)
|
||||||
|
target_link_libraries( cvpcb
|
||||||
|
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||||
|
# There's way too much crap coming in from common yet.
|
||||||
|
common
|
||||||
|
bitmaps
|
||||||
|
${wxWidgets_LIBRARIES}
|
||||||
|
)
|
||||||
|
if( MAKE_LINK_MAPS )
|
||||||
|
set_target_properties( cvpcb PROPERTIES
|
||||||
|
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=cvpcb.map" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# the main cvpcb program, in DSO form.
|
||||||
|
add_library( cvpcb_kiface MODULE
|
||||||
|
cvpcb.cpp
|
||||||
|
${CVPCB_SRCS}
|
||||||
|
${CVPCB_DIALOGS}
|
||||||
|
# ${CVPCB_RESOURCES}
|
||||||
|
)
|
||||||
|
set_target_properties( cvpcb_kiface PROPERTIES
|
||||||
|
OUTPUT_NAME cvpcb
|
||||||
|
PREFIX ${KIFACE_PREFIX}
|
||||||
|
SUFFIX ${KIFACE_SUFFIX}
|
||||||
|
)
|
||||||
|
target_link_libraries( cvpcb_kiface
|
||||||
|
3d-viewer
|
||||||
|
pcbcommon
|
||||||
|
pcad2kicadpcb
|
||||||
|
common
|
||||||
|
bitmaps
|
||||||
|
polygon
|
||||||
|
gal
|
||||||
|
${wxWidgets_LIBRARIES}
|
||||||
|
${OPENGL_LIBRARIES}
|
||||||
|
${GDI_PLUS_LIBRARIES}
|
||||||
|
${GLEW_LIBRARIES}
|
||||||
|
${CAIRO_LIBRARIES}
|
||||||
|
${PIXMAN_LIBRARY}
|
||||||
|
${OPENMP_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Only for win32 cross compilation using MXE
|
||||||
|
if( WIN32 AND MSYS AND CMAKE_CROSSCOMPILING )
|
||||||
|
target_link_libraries( cvpcb_kiface
|
||||||
|
opengl32
|
||||||
|
glu32
|
||||||
|
pixman-1
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
bz2
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( BUILD_GITHUB_PLUGIN )
|
||||||
|
target_link_libraries( cvpcb_kiface github_plugin )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Must follow github_plugin
|
||||||
|
target_link_libraries( cvpcb_kiface ${Boost_LIBRARIES} )
|
||||||
|
|
||||||
|
if( UNIX AND NOT APPLE )
|
||||||
|
# -lrt must follow Boost
|
||||||
|
target_link_libraries( cvpcb_kiface rt )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
set_target_properties( cvpcb PROPERTIES
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_source_files_properties( cvpcb.cpp PROPERTIES
|
||||||
|
# The KIFACE is in cvpcb.cpp, export it:
|
||||||
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
|
)
|
||||||
|
|
||||||
|
if( MAKE_LINK_MAPS )
|
||||||
|
set_target_properties( cvpcb_kiface PROPERTIES
|
||||||
|
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_cvpcb.kiface.map" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# if building cvpcb, then also build cvpcb_kiface if out of date.
|
||||||
|
add_dependencies( cvpcb cvpcb_kiface )
|
||||||
|
|
||||||
|
# these 2 binaries are a matched set, keep them together:
|
||||||
|
install( TARGETS cvpcb
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
install( TARGETS cvpcb_kiface
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
# copies kiface into the bundle
|
||||||
|
add_custom_target( _cvpcb_kiface_copy ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/cvpcb/_cvpcb.kiface "${CMAKE_BINARY_DIR}/cvpcb/cvpcb.app/Contents/MacOS/"
|
||||||
|
DEPENDS cvpcb_kiface
|
||||||
|
COMMENT "Copying kiface into cvpcb"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
add_executable( cvpcb WIN32 MACOSX_BUNDLE
|
||||||
|
${CVPCB_SRCS}
|
||||||
|
${CVPCB_DIALOGS}
|
||||||
|
${CVPCB_RESOURCES}
|
||||||
|
)
|
||||||
|
target_link_libraries( cvpcb
|
||||||
|
3d-viewer
|
||||||
|
pcbcommon
|
||||||
|
pcad2kicadpcb
|
||||||
|
common
|
||||||
|
bitmaps
|
||||||
|
polygon
|
||||||
|
gal
|
||||||
|
${wxWidgets_LIBRARIES}
|
||||||
|
${OPENGL_LIBRARIES}
|
||||||
|
${GDI_PLUS_LIBRARIES}
|
||||||
|
${GLEW_LIBRARIES}
|
||||||
|
${CAIRO_LIBRARIES}
|
||||||
|
${PIXMAN_LIBRARY}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Only for win32 cross compilation using MXE
|
||||||
|
if( WIN32 AND MSYS AND CMAKE_CROSSCOMPILING )
|
||||||
|
target_link_libraries( cvpcb
|
||||||
|
opengl32
|
||||||
|
glu32
|
||||||
|
pixman-1
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
bz2
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( BUILD_GITHUB_PLUGIN )
|
||||||
|
target_link_libraries( cvpcb github_plugin )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Must follow github_plugin
|
||||||
|
target_link_libraries( cvpcb ${Boost_LIBRARIES} )
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
set_target_properties( cvpcb PROPERTIES
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install( TARGETS cvpcb
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###
|
|
||||||
# Link executable target cvpcb with correct libraries
|
|
||||||
###
|
|
||||||
target_link_libraries( cvpcb
|
|
||||||
3d-viewer
|
|
||||||
pcbcommon
|
|
||||||
pcad2kicadpcb
|
|
||||||
common
|
|
||||||
bitmaps
|
|
||||||
polygon
|
|
||||||
gal
|
|
||||||
${wxWidgets_LIBRARIES}
|
|
||||||
${OPENGL_LIBRARIES}
|
|
||||||
${GDI_PLUS_LIBRARIES}
|
|
||||||
${GLEW_LIBRARIES}
|
|
||||||
${CAIRO_LIBRARIES}
|
|
||||||
${PIXMAN_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Only for win32 cross compilation using MXE
|
|
||||||
if( WIN32 AND MSYS AND CMAKE_CROSSCOMPILING )
|
|
||||||
target_link_libraries(cvpcb
|
|
||||||
opengl32
|
|
||||||
glu32
|
|
||||||
pixman-1
|
|
||||||
fontconfig
|
|
||||||
freetype
|
|
||||||
bz2
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if( BUILD_GITHUB_PLUGIN )
|
|
||||||
target_link_libraries( cvpcb github_plugin )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Must follow github_plugin
|
|
||||||
target_link_libraries( cvpcb ${Boost_LIBRARIES} )
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
# Add cvpcb as install target
|
|
||||||
###
|
|
||||||
install( TARGETS cvpcb
|
|
||||||
DESTINATION ${KICAD_BIN}
|
|
||||||
COMPONENT binary
|
|
||||||
)
|
|
||||||
|
|
|
@ -29,9 +29,10 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <project.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
FILE* file;
|
FILE* file;
|
||||||
size_t ii;
|
size_t ii;
|
||||||
|
SEARCH_STACK& search = Prj().SchSearchS();
|
||||||
|
|
||||||
if( m_netlist.IsEmpty() )
|
if( m_netlist.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
@ -99,17 +101,17 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
|
||||||
if( !fn.HasExt() )
|
if( !fn.HasExt() )
|
||||||
{
|
{
|
||||||
fn.SetExt( FootprintAliasFileExtension );
|
fn.SetExt( FootprintAliasFileExtension );
|
||||||
// above fails if filename have more than one point
|
// above fails if filename has more than one point
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
|
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
|
||||||
}
|
}
|
||||||
tmp = wxGetApp().FindLibraryPath( fn );
|
tmp = search.FindValidPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Footprint alias library file <%s> could not be found in the "
|
msg.Printf( _( "Footprint alias library file '%s' could not be found in the "
|
||||||
"default search paths." ),
|
"default search paths." ),
|
||||||
GetChars( fn.GetFullName() ) );
|
GetChars( fn.GetFullName() ) );
|
||||||
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
|
|
|
@ -27,11 +27,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
#include <fp_lib_table.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <param_config.h>
|
#include <config_params.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <fp_lib_table.h>
|
#include <fp_lib_table.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
@ -46,24 +47,24 @@
|
||||||
#define GROUPEQU wxT("/cvpcb/libraries")
|
#define GROUPEQU wxT("/cvpcb/libraries")
|
||||||
|
|
||||||
|
|
||||||
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters( void )
|
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
|
||||||
{
|
{
|
||||||
if( !m_projectFileParams.empty() )
|
if( !m_projectFileParams.empty() )
|
||||||
return m_projectFileParams;
|
return m_projectFileParams;
|
||||||
|
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUPLIB,
|
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUPLIB, PARAM_COMMAND_ERASE ) );
|
||||||
PARAM_COMMAND_ERASE ) );
|
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
|
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||||
&m_ModuleLibNames,
|
wxT( "LibName" ), &m_ModuleLibNames, GROUPLIB ) );
|
||||||
GROUPLIB ) );
|
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "EquName" ),
|
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||||
&m_AliasLibNames,
|
wxT( "EquName" ), &m_AliasLibNames, GROUPEQU ) );
|
||||||
GROUPEQU ) );
|
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetIExt" ),
|
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
|
||||||
&m_NetlistFileExtension ) );
|
wxT( "NetIExt" ), &m_NetlistFileExtension ) );
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),
|
|
||||||
&m_UserLibraryPath,
|
m_projectFileParams.push_back( new PARAM_CFG_FILENAME(
|
||||||
GROUPLIB ) );
|
wxT( "LibDir" ), &m_UserLibraryPath, GROUPLIB ) );
|
||||||
|
|
||||||
return m_projectFileParams;
|
return m_projectFileParams;
|
||||||
}
|
}
|
||||||
|
@ -71,42 +72,34 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters( void )
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
|
void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
|
||||||
{
|
{
|
||||||
wxFileName fn = aFileName;
|
wxFileName fn( aFileName );
|
||||||
|
PROJECT& prj = Prj();
|
||||||
|
|
||||||
m_ModuleLibNames.Clear();
|
m_ModuleLibNames.Clear();
|
||||||
m_AliasLibNames.Clear();
|
m_AliasLibNames.Clear();
|
||||||
|
|
||||||
if( fn.GetExt() != ProjectFileExtension )
|
fn.SetExt( ProjectFileExtension );
|
||||||
fn.SetExt( ProjectFileExtension );
|
|
||||||
|
|
||||||
wxGetApp().RemoveLibraryPath( m_UserLibraryPath );
|
// was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
||||||
|
prj.ConfigLoad( prj.PcbSearchS(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
||||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
|
||||||
|
|
||||||
if( m_NetlistFileExtension.IsEmpty() )
|
if( m_NetlistFileExtension.IsEmpty() )
|
||||||
m_NetlistFileExtension = wxT( "net" );
|
m_NetlistFileExtension = wxT( "net" );
|
||||||
|
|
||||||
// User library path takes precedent over default library search paths.
|
// empty the table, Load() it again below.
|
||||||
wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 );
|
FootprintLibs()->Clear();
|
||||||
|
|
||||||
delete m_footprintLibTable;
|
/* this is done by ConfigLoad(), and that sets the env var too.
|
||||||
|
prj.SetProjectFullName( fn.GetFullPath() );
|
||||||
|
*/
|
||||||
|
|
||||||
// Attempt to load the project footprint library table if it exists.
|
wxString projectFpLibTableFileName = prj.FootprintLibTblName();
|
||||||
m_footprintLibTable = new FP_LIB_TABLE();
|
|
||||||
|
|
||||||
if( m_DisplayFootprintFrame )
|
|
||||||
m_DisplayFootprintFrame->SetFootprintLibTable( m_footprintLibTable );
|
|
||||||
|
|
||||||
wxFileName projectFpLibTableFileName;
|
|
||||||
|
|
||||||
projectFpLibTableFileName = FP_LIB_TABLE::GetProjectFileName( fn );
|
|
||||||
FP_LIB_TABLE::SetProjectPathEnvVariable( projectFpLibTableFileName );
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_footprintLibTable->Load( projectFpLibTableFileName, m_globalFootprintTable );
|
FootprintLibs()->Load( projectFpLibTableFileName );
|
||||||
}
|
}
|
||||||
catch( IO_ERROR ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
DisplayError( this, ioe.errorText );
|
DisplayError( this, ioe.errorText );
|
||||||
}
|
}
|
||||||
|
@ -136,5 +129,11 @@ void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
|
||||||
if( !IsWritable( fn ) )
|
if( !IsWritable( fn ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
|
// was:
|
||||||
|
// Pgm().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
|
||||||
|
|
||||||
|
PROJECT& prj = Prj();
|
||||||
|
SEARCH_STACK& search = prj.SchSearchS();
|
||||||
|
|
||||||
|
prj.ConfigSave( search, fn.GetFullPath(), GROUP, GetProjectFileParameters() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_drawpanel_gal.h>
|
#include <class_drawpanel_gal.h>
|
||||||
|
@ -70,28 +70,25 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
|
||||||
DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
|
DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" )
|
|
||||||
|
|
||||||
|
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) :
|
||||||
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
|
PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Footprint Viewer" ),
|
||||||
const wxString& title,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
const wxPoint& pos,
|
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
|
||||||
const wxSize& size, long style ) :
|
|
||||||
PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size,
|
|
||||||
style, DISPLAY_FOOTPRINTS_FRAME_NAME )
|
|
||||||
{
|
{
|
||||||
m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME;
|
m_FrameName = FOOTPRINTVIEWER_FRAME_NAME;
|
||||||
m_showAxis = true; // true to draw axis.
|
m_showAxis = true; // true to draw axis.
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
|
|
||||||
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
|
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
|
||||||
SetIcon( icon );
|
SetIcon( icon );
|
||||||
|
|
||||||
SetBoard( new BOARD() );
|
SetBoard( new BOARD() );
|
||||||
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
||||||
|
|
||||||
LoadSettings();
|
LoadSettings( config() );
|
||||||
|
|
||||||
// Initialize grid id to a default value if not found in config or bad:
|
// Initialize grid id to a default value if not found in config or bad:
|
||||||
if( (m_LastGridSizeId <= 0) ||
|
if( (m_LastGridSizeId <= 0) ||
|
||||||
|
@ -148,8 +145,6 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
|
||||||
{
|
{
|
||||||
delete GetScreen();
|
delete GetScreen();
|
||||||
SetScreen( NULL ); // Be sure there is no double deletion
|
SetScreen( NULL ); // Be sure there is no double deletion
|
||||||
|
|
||||||
( (CVPCB_MAINFRAME*) wxGetApp().GetTopWindow() )->m_DisplayFootprintFrame = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,7 +433,7 @@ void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Draw3DFrame = new EDA_3D_FRAME( this, _( "3D Viewer" ), KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
m_Draw3DFrame = new EDA_3D_FRAME( &Kiway(), this, _( "3D Viewer" ), KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
||||||
m_Draw3DFrame->Show( true );
|
m_Draw3DFrame->Show( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +488,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
|
||||||
wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ),
|
wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ),
|
||||||
fpname.c_str(), nickname.c_str() );
|
fpname.c_str(), nickname.c_str() );
|
||||||
|
|
||||||
footprint = m_footprintLibTable->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
|
footprint = FootprintLibs()->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
|
||||||
}
|
}
|
||||||
catch( IO_ERROR ioe )
|
catch( IO_ERROR ioe )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
#include <wxBasePcbFrame.h>
|
#include <wxBasePcbFrame.h>
|
||||||
|
|
||||||
|
// The name (for wxWidgets) of the footprint viewer frame
|
||||||
|
#define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" )
|
||||||
|
|
||||||
class CVPCB_MAINFRAME;
|
class CVPCB_MAINFRAME;
|
||||||
|
|
||||||
|
@ -40,10 +42,7 @@ class CVPCB_MAINFRAME;
|
||||||
class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME
|
class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, const wxString& title,
|
DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent );
|
||||||
const wxPoint& pos, const wxSize& size,
|
|
||||||
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
|
||||||
|
|
||||||
~DISPLAY_FOOTPRINTS_FRAME();
|
~DISPLAY_FOOTPRINTS_FRAME();
|
||||||
|
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
|
@ -207,7 +207,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If the footprint view window is displayed, update the footprint.
|
// If the footprint view window is displayed, update the footprint.
|
||||||
if( GetParent()->m_DisplayFootprintFrame )
|
if( GetParent()->GetFpViewerFrame() )
|
||||||
GetParent()->CreateScreenCmp();
|
GetParent()->CreateScreenCmp();
|
||||||
|
|
||||||
GetParent()->DisplayStatus();
|
GetParent()->DisplayStatus();
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <eda_doc.h>
|
#include <eda_doc.h>
|
||||||
|
@ -104,24 +105,22 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
||||||
|
|
||||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
|
||||||
EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition,
|
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
|
KIWAY_PLAYER( aKiway, aParent, CVPCB_FRAME_TYPE, wxT( "CvPCB" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
||||||
{
|
{
|
||||||
m_FrameName = CVPCB_MAINFRAME_NAME;
|
m_FrameName = CVPCB_MAINFRAME_NAME;
|
||||||
m_ListCmp = NULL;
|
m_ListCmp = NULL;
|
||||||
m_FootprintList = NULL;
|
m_FootprintList = NULL;
|
||||||
m_LibraryList = NULL;
|
m_LibraryList = NULL;
|
||||||
m_DisplayFootprintFrame = NULL;
|
|
||||||
m_mainToolBar = NULL;
|
m_mainToolBar = NULL;
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
m_isEESchemaNetlist = false;
|
m_isEESchemaNetlist = false;
|
||||||
m_KeepCvpcbOpen = false;
|
m_KeepCvpcbOpen = false;
|
||||||
m_undefinedComponentCnt = 0;
|
m_undefinedComponentCnt = 0;
|
||||||
m_skipComponentSelect = false;
|
m_skipComponentSelect = false;
|
||||||
|
m_NetlistFileExtension = wxT( "net" );
|
||||||
m_globalFootprintTable = NULL;
|
|
||||||
m_footprintLibTable = NULL;
|
|
||||||
|
|
||||||
/* Name of the document footprint list
|
/* Name of the document footprint list
|
||||||
* usually located in share/modules/footprints_doc
|
* usually located in share/modules/footprints_doc
|
||||||
|
@ -137,7 +136,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
||||||
|
|
||||||
SetAutoLayout( true );
|
SetAutoLayout( true );
|
||||||
|
|
||||||
LoadSettings();
|
LoadSettings( config() );
|
||||||
|
|
||||||
if( m_FrameSize.x < FRAME_MIN_SIZE_X )
|
if( m_FrameSize.x < FRAME_MIN_SIZE_X )
|
||||||
m_FrameSize.x = FRAME_MIN_SIZE_X;
|
m_FrameSize.x = FRAME_MIN_SIZE_X;
|
||||||
|
@ -194,36 +193,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
||||||
Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
|
Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
if( m_globalFootprintTable == NULL )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_globalFootprintTable = new FP_LIB_TABLE();
|
|
||||||
|
|
||||||
if( !FP_LIB_TABLE::LoadGlobalTable( *m_globalFootprintTable ) )
|
|
||||||
{
|
|
||||||
DisplayInfoMessage( this, wxT( "You have run CvPcb for the first time using the "
|
|
||||||
"new footprint library table method of finding "
|
|
||||||
"footprints. CvPcb has either copied the default "
|
|
||||||
"table or created an empty table in your home "
|
|
||||||
"folder. You must first configure the library "
|
|
||||||
"table to include all footprint libraries not "
|
|
||||||
"included with KiCad. See the \"Footprint Library "
|
|
||||||
"Table\" section of the CvPcb documentation for "
|
|
||||||
"more information." ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( IO_ERROR ioe )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "An error occurred attempting to load the global footprint library "
|
|
||||||
"table:\n\n%s" ), GetChars( ioe.errorText ) );
|
|
||||||
DisplayError( this, msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,28 +202,40 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::LoadSettings()
|
FP_LIB_TABLE* CVPCB_MAINFRAME::FootprintLibs() const
|
||||||
{
|
{
|
||||||
wxASSERT( wxGetApp().GetSettings() != NULL );
|
PROJECT& prj = Prj();
|
||||||
|
FP_LIB_TABLE* tbl = dynamic_cast<FP_LIB_TABLE*>( prj.Elem( PROJECT::FPTBL ) );
|
||||||
|
|
||||||
wxConfig* cfg = wxGetApp().GetSettings();
|
if( !tbl )
|
||||||
|
{
|
||||||
|
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
|
||||||
|
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
||||||
|
// stack this way, all using the same global fallback table.
|
||||||
|
tbl = new FP_LIB_TABLE( &GFootprintTable );
|
||||||
|
prj.Elem( PROJECT::FPTBL, tbl );
|
||||||
|
}
|
||||||
|
|
||||||
EDA_BASE_FRAME::LoadSettings();
|
return tbl;
|
||||||
cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
}
|
||||||
cfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
|
{
|
||||||
|
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||||
|
|
||||||
|
aCfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
||||||
|
aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
||||||
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SaveSettings()
|
void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
wxASSERT( wxGetApp().GetSettings() != NULL );
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
|
||||||
wxConfig* cfg = wxGetApp().GetSettings();
|
aCfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
||||||
|
aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||||
EDA_BASE_FRAME::SaveSettings();
|
|
||||||
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
|
||||||
cfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
|
||||||
|
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
|
@ -267,7 +248,7 @@ void CVPCB_MAINFRAME::SaveSettings()
|
||||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||||
state |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
state |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
||||||
|
|
||||||
cfg->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
aCfg->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,10 +302,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the help frame
|
// Close the help frame
|
||||||
if( wxGetApp().GetHtmlHelpController() )
|
if( Pgm().GetHtmlHelpController() )
|
||||||
{
|
{
|
||||||
if( wxGetApp().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
|
if( Pgm().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
|
||||||
wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true );
|
Pgm().GetHtmlHelpController()->GetFrame()->Close( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_NetlistFileName.IsOk() )
|
if( m_NetlistFileName.IsOk() )
|
||||||
|
@ -333,8 +314,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close module display frame
|
// Close module display frame
|
||||||
if( m_DisplayFootprintFrame )
|
if( GetFpViewerFrame() )
|
||||||
m_DisplayFootprintFrame->Close( true );
|
GetFpViewerFrame()->Close( true );
|
||||||
|
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
|
|
||||||
|
@ -460,9 +441,8 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString oldPath;
|
|
||||||
wxFileName newFileName;
|
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
wxFileName newFileName;
|
||||||
|
|
||||||
if( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
if( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
||||||
{
|
{
|
||||||
|
@ -483,70 +463,83 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
||||||
if( newFileName == m_NetlistFileName )
|
if( newFileName == m_NetlistFileName )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_NetlistFileName.DirExists() )
|
OpenProjectFiles( std::vector<wxString>( 1, newFileName.GetFullPath() ) );
|
||||||
oldPath = m_NetlistFileName.GetPath();
|
}
|
||||||
|
|
||||||
/* Update the library search path list. */
|
|
||||||
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
|
||||||
wxGetApp().GetLibraryPathList().Remove( oldPath );
|
|
||||||
|
|
||||||
wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
|
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||||
m_NetlistFileName = newFileName;
|
{
|
||||||
ReadNetListAndLinkFiles();
|
if( aFileSet.size() == 1 )
|
||||||
|
{
|
||||||
|
m_NetlistFileName = aFileSet[0];
|
||||||
|
ReadNetListAndLinkFiles();
|
||||||
|
|
||||||
// OSX need it since some objects are "rebuild" just make aware AUI
|
UpdateTitle();
|
||||||
// Fixes #1258081
|
|
||||||
m_auimgr.Update();
|
// OSX need it since some objects are "rebuild" just make aware AUI
|
||||||
|
// Fixes #1258081
|
||||||
|
m_auimgr.Update();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::ConfigCvpcb( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::ConfigCvpcb( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DIALOG_CVPCB_CONFIG ConfigFrame( this );
|
/* This is showing FOOTPRINT search paths, which are obsoleted.
|
||||||
|
I am removing this for the time being, since cvpcb will soon be part of pcbnew.
|
||||||
|
|
||||||
ConfigFrame.ShowModal();
|
DIALOG_CVPCB_CONFIG dlg( this );
|
||||||
|
|
||||||
|
dlg.ShowModal();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
bool tableChanged = false;
|
bool tableChanged = false;
|
||||||
int r = InvokePcbLibTableEditor( this, m_globalFootprintTable, m_footprintLibTable );
|
int r = InvokePcbLibTableEditor( this, &GFootprintTable, FootprintLibs() );
|
||||||
|
|
||||||
if( r & 1 )
|
if( r & 1 )
|
||||||
{
|
{
|
||||||
|
wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() );
|
GFootprintTable.Save( fileName );
|
||||||
m_globalFootprintTable->Format( &sf, 0 );
|
|
||||||
tableChanged = true;
|
tableChanged = true;
|
||||||
}
|
}
|
||||||
catch( IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxString::Format( _(
|
||||||
msg.Printf( _( "Error occurred saving the global footprint library "
|
"Error occurred saving the global footprint library table:\n'%s'\n%s" ),
|
||||||
"table:\n\n%s" ), ioe.errorText.GetData() );
|
GetChars( fileName ),
|
||||||
|
GetChars( ioe.errorText )
|
||||||
|
);
|
||||||
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( r & 2 )
|
if( r & 2 )
|
||||||
{
|
{
|
||||||
wxFileName fn = m_NetlistFileName;
|
wxString fileName = Prj().FootprintLibTblName();
|
||||||
fn.SetName( FP_LIB_TABLE::GetFileName() );
|
|
||||||
fn.SetExt( wxEmptyString );
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
FootprintLibs()->Save( fileName );
|
||||||
m_footprintLibTable->Format( &sf, 0 );
|
|
||||||
tableChanged = true;
|
tableChanged = true;
|
||||||
}
|
}
|
||||||
catch( IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxString::Format( _(
|
||||||
msg.Printf( _( "Error occurred saving the global footprint library "
|
"Error occurred saving the project footprint library table:\n'%s'\n%s" ),
|
||||||
"table:\n\n%s" ), ioe.errorText.GetData() );
|
GetChars( fileName ),
|
||||||
|
GetChars( ioe.errorText )
|
||||||
|
);
|
||||||
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +547,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
||||||
if( tableChanged )
|
if( tableChanged )
|
||||||
{
|
{
|
||||||
BuildLIBRARY_LISTBOX();
|
BuildLIBRARY_LISTBOX();
|
||||||
m_footprints.ReadFootprintFiles( m_footprintLibTable );
|
m_footprints.ReadFootprintFiles( FootprintLibs() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +561,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
|
||||||
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
CreateScreenCmp();
|
CreateScreenCmp();
|
||||||
m_DisplayFootprintFrame->RedrawScreen( wxPoint( 0, 0 ), false );
|
GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -580,7 +573,7 @@ void CVPCB_MAINFRAME::SetLanguage( wxCommandEvent& event )
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
GetAssociatedDocument( this, m_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
|
GetAssociatedDocument( this, m_DocModulesFileName, &Kiface().KifaceSearch() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -607,7 +600,9 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter );
|
m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter );
|
||||||
|
|
||||||
// Tell AuiMgr that objects are changed !
|
// Tell AuiMgr that objects are changed !
|
||||||
m_auimgr.Update();
|
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
|
||||||
|
// (could be not the case when starting CvPcb
|
||||||
|
m_auimgr.Update();
|
||||||
|
|
||||||
if( component == NULL )
|
if( component == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -646,7 +641,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
if ( ii >= 0 )
|
if ( ii >= 0 )
|
||||||
m_FootprintList->SetSelection( ii, false );
|
m_FootprintList->SetSelection( ii, false );
|
||||||
|
|
||||||
if( m_DisplayFootprintFrame )
|
if( GetFpViewerFrame() )
|
||||||
{
|
{
|
||||||
CreateScreenCmp();
|
CreateScreenCmp();
|
||||||
}
|
}
|
||||||
|
@ -755,16 +750,17 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
|
|
||||||
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||||
{
|
{
|
||||||
|
FP_LIB_TABLE* fptbl = FootprintLibs();
|
||||||
|
|
||||||
// Check if there are footprint libraries in the footprint library table.
|
// Check if there are footprint libraries in the footprint library table.
|
||||||
if( m_footprintLibTable == NULL || !m_footprintLibTable->GetLogicalLibs().size() )
|
if( !fptbl || !fptbl->GetLogicalLibs().size() )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
|
wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
|
||||||
"library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
|
"library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_footprintLibTable != NULL )
|
m_footprints.ReadFootprintFiles( fptbl );
|
||||||
m_footprints.ReadFootprintFiles( m_footprintLibTable );
|
|
||||||
|
|
||||||
if( m_footprints.GetErrorCount() )
|
if( m_footprints.GetErrorCount() )
|
||||||
{
|
{
|
||||||
|
@ -777,20 +773,18 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::UpdateTitle()
|
void CVPCB_MAINFRAME::UpdateTitle()
|
||||||
{
|
{
|
||||||
wxString title;
|
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
|
||||||
|
|
||||||
if( m_NetlistFileName.IsOk() && m_NetlistFileName.FileExists() )
|
if( m_NetlistFileName.IsOk() && m_NetlistFileName.FileExists() )
|
||||||
{
|
{
|
||||||
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
title += m_NetlistFileName.GetFullPath();
|
||||||
wxT( " " ) + m_NetlistFileName.GetFullPath();
|
|
||||||
|
|
||||||
if( !m_NetlistFileName.IsFileWritable() )
|
if( !m_NetlistFileName.IsFileWritable() )
|
||||||
title += _( " [Read Only]" );
|
title += _( " [Read Only]" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
title += _( "[no file]" );
|
||||||
wxT( " " ) + _( " [no file]" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
|
@ -875,7 +869,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
|
||||||
|
|
||||||
|
|
||||||
// File header.
|
// File header.
|
||||||
static char HeaderLinkFile[] = { "Cmp-Mod V01" };
|
static char headerLinkFile[] = "Cmp-Mod V01";
|
||||||
|
|
||||||
|
|
||||||
bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
||||||
|
@ -883,7 +877,7 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
||||||
COMPONENT* component;
|
COMPONENT* component;
|
||||||
FILE* outputFile;
|
FILE* outputFile;
|
||||||
wxFileName fn( aFullFileName );
|
wxFileName fn( aFullFileName );
|
||||||
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
|
||||||
|
|
||||||
outputFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
outputFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||||
|
|
||||||
|
@ -903,8 +897,8 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
||||||
* IdModule = BUS_PC;
|
* IdModule = BUS_PC;
|
||||||
* EndCmp
|
* EndCmp
|
||||||
*/
|
*/
|
||||||
retval |= fprintf( outputFile, "%s", HeaderLinkFile );
|
retval |= fprintf( outputFile, "%s", headerLinkFile );
|
||||||
retval |= fprintf( outputFile, " Created by %s", TO_UTF8( Title ) );
|
retval |= fprintf( outputFile, " Created by %s", TO_UTF8( title ) );
|
||||||
retval |= fprintf( outputFile, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
retval |= fprintf( outputFile, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
||||||
|
@ -926,21 +920,17 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::CreateScreenCmp()
|
void CVPCB_MAINFRAME::CreateScreenCmp()
|
||||||
{
|
{
|
||||||
if( m_DisplayFootprintFrame == NULL )
|
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame();
|
||||||
|
|
||||||
|
if( !fpframe )
|
||||||
{
|
{
|
||||||
m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
|
fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
|
||||||
wxPoint( 0, 0 ),
|
fpframe->Show( true );
|
||||||
wxSize( 600, 400 ),
|
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE );
|
|
||||||
|
|
||||||
m_DisplayFootprintFrame->SetFootprintLibTable( m_footprintLibTable );
|
|
||||||
|
|
||||||
m_DisplayFootprintFrame->Show( true );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_DisplayFootprintFrame->IsIconized() )
|
if( fpframe->IsIconized() )
|
||||||
m_DisplayFootprintFrame->Iconize( false );
|
fpframe->Iconize( false );
|
||||||
|
|
||||||
// The display footprint window might be buried under some other
|
// The display footprint window might be buried under some other
|
||||||
// windows, so CreateScreenCmp() on an existing window would not
|
// windows, so CreateScreenCmp() on an existing window would not
|
||||||
|
@ -948,11 +938,11 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
|
||||||
// So we want to put it to front, second after our CVPCB_MAINFRAME.
|
// So we want to put it to front, second after our CVPCB_MAINFRAME.
|
||||||
// We do this by a little dance of bringing it to front then the main
|
// We do this by a little dance of bringing it to front then the main
|
||||||
// frame back.
|
// frame back.
|
||||||
m_DisplayFootprintFrame->Raise(); // Make sure that is visible.
|
fpframe->Raise(); // Make sure that is visible.
|
||||||
Raise(); // .. but still we want the focus.
|
Raise(); // .. but still we want the focus.
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DisplayFootprintFrame->InitDisplay();
|
fpframe->InitDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1039,11 +1029,11 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
|
||||||
wxFONTWEIGHT_NORMAL ) );
|
wxFONTWEIGHT_NORMAL ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_footprintLibTable )
|
if( FootprintLibs() )
|
||||||
{
|
{
|
||||||
wxArrayString libNames;
|
wxArrayString libNames;
|
||||||
|
|
||||||
std::vector< wxString > libNickNames = m_footprintLibTable->GetLogicalLibs();
|
std::vector< wxString > libNickNames = FootprintLibs()->GetLogicalLibs();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
|
for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
|
||||||
libNames.Add( libNickNames[ii] );
|
libNames.Add( libNickNames[ii] );
|
||||||
|
@ -1062,3 +1052,10 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame()
|
||||||
|
{
|
||||||
|
// returns the Footprint Viewer frame, if exists, or NULL
|
||||||
|
return (DISPLAY_FOOTPRINTS_FRAME*) wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
|
||||||
|
}
|
||||||
|
|
286
cvpcb/cvpcb.cpp
286
cvpcb/cvpcb.cpp
|
@ -27,13 +27,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
|
#include <macros.h>
|
||||||
|
#include <fp_lib_table.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <kiface_i.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <zones.h>
|
#include <zones.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
|
@ -57,11 +59,13 @@ const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.eq
|
||||||
const wxString titleLibLoadError( _( "Library Load Error" ) );
|
const wxString titleLibLoadError( _( "Library Load Error" ) );
|
||||||
|
|
||||||
|
|
||||||
|
#if 0 // add this logic to OpenProjectFiles()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MacOSX: Needed for file association
|
* MacOSX: Needed for file association
|
||||||
* http://wiki.wxwidgets.org/WxMac-specific_topics
|
* http://wiki.wxwidgets.org/WxMac-specific_topics
|
||||||
*/
|
*/
|
||||||
void EDA_APP::MacOpenFile( const wxString& aFileName )
|
void PGM_BASE::MacOpenFile( const wxString& aFileName )
|
||||||
{
|
{
|
||||||
wxFileName filename = aFileName;
|
wxFileName filename = aFileName;
|
||||||
wxString oldPath;
|
wxString oldPath;
|
||||||
|
@ -75,76 +79,258 @@ void EDA_APP::MacOpenFile( const wxString& aFileName )
|
||||||
oldPath = frame->m_NetlistFileName.GetPath();
|
oldPath = frame->m_NetlistFileName.GetPath();
|
||||||
|
|
||||||
// Update the library search path list.
|
// Update the library search path list.
|
||||||
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
if( Pgm().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
||||||
wxGetApp().GetLibraryPathList().Remove( oldPath );
|
Pgm().GetLibraryPathList().Remove( oldPath );
|
||||||
|
|
||||||
wxGetApp().GetLibraryPathList().Insert( filename.GetPath(), 0 );
|
Pgm().GetLibraryPathList().Insert( filename.GetPath(), 0 );
|
||||||
|
|
||||||
frame->m_NetlistFileName = filename;
|
frame->m_NetlistFileName = filename;
|
||||||
frame->ReadNetListAndLinkFiles();
|
frame->ReadNetListAndLinkFiles();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Create a new application object
|
namespace CV {
|
||||||
IMPLEMENT_APP( EDA_APP )
|
|
||||||
|
|
||||||
|
static struct IFACE : public KIFACE_I
|
||||||
/************************************/
|
|
||||||
/* Called to initialize the program */
|
|
||||||
/************************************/
|
|
||||||
|
|
||||||
bool EDA_APP::OnInit()
|
|
||||||
{
|
{
|
||||||
wxFileName filename;
|
// Of course all are virtual overloads, implementations of the KIFACE.
|
||||||
wxString message;
|
|
||||||
CVPCB_MAINFRAME* frame = NULL;
|
|
||||||
|
|
||||||
InitEDA_Appl( wxT( "CvPcb" ), APP_CVPCB_T );
|
IFACE( const char* aName, KIWAY::FACE_T aType ) :
|
||||||
|
KIFACE_I( aName, aType )
|
||||||
|
{}
|
||||||
|
|
||||||
SetFootprintLibTablePath();
|
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||||
|
|
||||||
|
void OnKifaceEnd();
|
||||||
|
|
||||||
|
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
|
||||||
|
{
|
||||||
|
switch( aClassId )
|
||||||
|
{
|
||||||
|
case CVPCB_FRAME_TYPE:
|
||||||
|
{
|
||||||
|
CVPCB_MAINFRAME* frame = new CVPCB_MAINFRAME( aKiway, aParent );
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IfaceOrAddress
|
||||||
|
* return a pointer to the requested object. The safest way to use this
|
||||||
|
* is to retrieve a pointer to a static instance of an interface, similar to
|
||||||
|
* how the KIFACE interface is exported. But if you know what you are doing
|
||||||
|
* use it to retrieve anything you want.
|
||||||
|
*
|
||||||
|
* @param aDataId identifies which object you want the address of.
|
||||||
|
*
|
||||||
|
* @return void* - and must be cast into the know type.
|
||||||
|
*/
|
||||||
|
void* IfaceOrAddress( int aDataId )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
} kiface( "cvpcb", KIWAY::FACE_CVPCB );
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
using namespace CV;
|
||||||
|
|
||||||
|
|
||||||
|
static PGM_BASE* process;
|
||||||
|
|
||||||
|
|
||||||
|
KIFACE_I& Kiface() { return kiface; }
|
||||||
|
|
||||||
|
|
||||||
|
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
||||||
|
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
||||||
|
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
||||||
|
{
|
||||||
|
process = (PGM_BASE*) aProgram;
|
||||||
|
return &kiface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PGM_BASE& Pgm()
|
||||||
|
{
|
||||||
|
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
||||||
|
return *process;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function set3DShapesPath
|
||||||
|
* attempts to set the environment variable given by aKiSys3Dmod to a valid path.
|
||||||
|
* (typically "KISYS3DMOD" )
|
||||||
|
* If the environment variable is already set,
|
||||||
|
* then it left as is to respect the wishes of the user.
|
||||||
|
*
|
||||||
|
* The path is determined by attempting to find the path modules/packages3d
|
||||||
|
* files in kicad tree.
|
||||||
|
* This may or may not be the best path but it provides the best solution for
|
||||||
|
* backwards compatibility with the previous 3D shapes search path implementation.
|
||||||
|
*
|
||||||
|
* @note This must be called after #SetBinDir() is called at least on Windows.
|
||||||
|
* Otherwise, the kicad path is not known (Windows specific)
|
||||||
|
*
|
||||||
|
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
|
||||||
|
* @return false if the aKiSys3Dmod path is not valid.
|
||||||
|
*/
|
||||||
|
static bool set3DShapesPath( const wxString& aKiSys3Dmod )
|
||||||
|
{
|
||||||
|
wxString path;
|
||||||
|
|
||||||
|
// Set the KISYS3DMOD environment variable for the current process,
|
||||||
|
// if it is not already defined in the user's environment and valid.
|
||||||
|
if( wxGetEnv( aKiSys3Dmod, &path ) && wxFileName::DirExists( path ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Attempt to determine where the 3D shape libraries were installed using the
|
||||||
|
// legacy path:
|
||||||
|
// on Unix: /usr/local/kicad/share/modules/packages3d
|
||||||
|
// or /usr/share/kicad/modules/packages3d
|
||||||
|
// On Windows: bin../share/modules/packages3d
|
||||||
|
wxString relpath( wxT( "modules/packages3d" ) );
|
||||||
|
|
||||||
|
// Apple MacOSx
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
path = wxT("/Library/Application Support/kicad/modules/packages3d/");
|
||||||
|
|
||||||
|
if( wxFileName::DirExists( path ) )
|
||||||
|
{
|
||||||
|
wxSetEnv( aKiSys3Dmod, path );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
path = wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT("/Library/Application Support/kicad/modules/packages3d/");
|
||||||
|
|
||||||
|
if( wxFileName::DirExists( path ) )
|
||||||
|
{
|
||||||
|
wxSetEnv( aKiSys3Dmod, path );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__UNIX__) // Linux and non-Apple Unix
|
||||||
|
// Try the home directory:
|
||||||
|
path.Empty();
|
||||||
|
wxGetEnv( wxT("HOME"), &path );
|
||||||
|
path += wxT("/kicad/share/") + relpath;
|
||||||
|
|
||||||
|
if( wxFileName::DirExists( path ) )
|
||||||
|
{
|
||||||
|
wxSetEnv( aKiSys3Dmod, path );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try the standard install path:
|
||||||
|
path = wxT("/usr/local/kicad/share/") + relpath;
|
||||||
|
|
||||||
|
if( wxFileName::DirExists( path ) )
|
||||||
|
{
|
||||||
|
wxSetEnv( aKiSys3Dmod, path );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try the official distrib standard install path:
|
||||||
|
path = wxT("/usr/share/kicad/") + relpath;
|
||||||
|
|
||||||
|
if( wxFileName::DirExists( path ) )
|
||||||
|
{
|
||||||
|
wxSetEnv( aKiSys3Dmod, path );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // Windows
|
||||||
|
// On Windows, the install path is given by the path of executables
|
||||||
|
wxFileName fn;
|
||||||
|
fn.AssignDir( Pgm().GetExecutablePath() );
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
path = fn.GetPathWithSep() + wxT("share/") + relpath;
|
||||||
|
|
||||||
|
if( wxFileName::DirExists( path ) )
|
||||||
|
{
|
||||||
|
wxSetEnv( aKiSys3Dmod, path );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//!!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it.
|
||||||
|
|
||||||
|
FP_LIB_TABLE GFootprintTable;
|
||||||
|
|
||||||
|
|
||||||
|
// A short lived implementation. cvpcb will get combine into pcbnew shortly, so
|
||||||
|
// we skip setting KISYSMOD here for now. User should set the environment
|
||||||
|
// variable.
|
||||||
|
|
||||||
|
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||||
|
{
|
||||||
|
// This is process level, not project level, initialization of the DSO.
|
||||||
|
|
||||||
|
// Do nothing in here pertinent to a project!
|
||||||
|
|
||||||
|
start_common();
|
||||||
|
|
||||||
// Set 3D shape path from environment variable KISYS3DMOD
|
// Set 3D shape path from environment variable KISYS3DMOD
|
||||||
Set3DShapesPath( wxT(KISYS3DMOD) );
|
set3DShapesPath( wxT("KISYS3DMOD") );
|
||||||
|
|
||||||
if( m_Checker && m_Checker->IsAnotherRunning() )
|
/* Now that there are no *.mod files in the standard library, this function
|
||||||
{
|
has no utility. User should simply set the variable manually.
|
||||||
if( !IsOK( NULL, _( "CvPcb is already running, Continue?" ) ) )
|
Looking for *.mod files which do not exist is fruitless.
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( argc > 1 )
|
// SetFootprintLibTablePath();
|
||||||
{
|
*/
|
||||||
filename = argv[1];
|
|
||||||
wxSetWorkingDirectory( filename.GetPath() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// read current setup and reopen last directory if no filename to open in command line
|
|
||||||
bool reopenLastUsedDirectory = argc == 1;
|
|
||||||
GetSettings( reopenLastUsedDirectory );
|
|
||||||
|
|
||||||
g_DrawBgColor = BLACK;
|
g_DrawBgColor = BLACK;
|
||||||
|
|
||||||
wxString Title = GetTitle() + wxT( " " ) + GetBuildVersion();
|
try
|
||||||
frame = new CVPCB_MAINFRAME( Title );
|
|
||||||
|
|
||||||
// Show the frame
|
|
||||||
SetTopWindow( frame );
|
|
||||||
frame->Show( true );
|
|
||||||
frame->m_NetlistFileExtension = wxT( "net" );
|
|
||||||
|
|
||||||
if( filename.IsOk() && filename.FileExists() )
|
|
||||||
{
|
{
|
||||||
frame->m_NetlistFileName = filename;
|
// The global table is not related to a specific project. All projects
|
||||||
frame->LoadProjectFile( filename.GetFullPath() );
|
// will use the same global table. So the KIFACE::OnKifaceStart() contract
|
||||||
|
// of avoiding anything project specific is not violated here.
|
||||||
|
|
||||||
if( frame->ReadNetListAndLinkFiles() )
|
if( !FP_LIB_TABLE::LoadGlobalTable( GFootprintTable ) )
|
||||||
{
|
{
|
||||||
frame->m_NetlistFileExtension = filename.GetExt();
|
DisplayInfoMessage( NULL, wxT(
|
||||||
return true;
|
"You have run CvPcb for the first time using the "
|
||||||
|
"new footprint library table method for finding "
|
||||||
|
"footprints. CvPcb has either copied the default "
|
||||||
|
"table or created an empty table in your home "
|
||||||
|
"folder. You must first configure the library "
|
||||||
|
"table to include all footprint libraries not "
|
||||||
|
"included with KiCad. See the \"Footprint Library "
|
||||||
|
"Table\" section of the CvPcb documentation for "
|
||||||
|
"more information." ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch( const IO_ERROR& ioe )
|
||||||
frame->UpdateTitle();
|
{
|
||||||
|
wxString msg = wxString::Format( _(
|
||||||
|
"An error occurred attempting to load the global footprint library "
|
||||||
|
"table:\n\n%s" ),
|
||||||
|
GetChars( ioe.errorText )
|
||||||
|
);
|
||||||
|
DisplayError( NULL, msg );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IFACE::OnKifaceEnd()
|
||||||
|
{
|
||||||
|
end_common();
|
||||||
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <footprint_info.h>
|
#include <footprint_info.h>
|
||||||
|
|
||||||
#include <wxBasePcbFrame.h>
|
#include <wxBasePcbFrame.h>
|
||||||
#include <param_config.h>
|
#include <config_params.h>
|
||||||
|
|
||||||
|
|
||||||
/* Forward declarations of all top-level window classes. */
|
/* Forward declarations of all top-level window classes. */
|
||||||
|
@ -47,28 +47,22 @@ class DISPLAY_FOOTPRINTS_FRAME;
|
||||||
class COMPONENT;
|
class COMPONENT;
|
||||||
class FP_LIB_TABLE;
|
class FP_LIB_TABLE;
|
||||||
|
|
||||||
|
namespace CV { struct IFACE; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CvPcb application main window.
|
* The CvPcb application main window.
|
||||||
*/
|
*/
|
||||||
class CVPCB_MAINFRAME : public EDA_BASE_FRAME
|
class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
||||||
{
|
{
|
||||||
|
friend struct CV::IFACE;
|
||||||
|
|
||||||
wxArrayString m_footprintListEntries;
|
wxArrayString m_footprintListEntries;
|
||||||
|
|
||||||
/// The global footprint library table.
|
|
||||||
FP_LIB_TABLE* m_globalFootprintTable;
|
|
||||||
|
|
||||||
/// The project footprint library table. This is a combination of the project
|
|
||||||
/// footprint library table and the global footprint table. This is the one to
|
|
||||||
/// use when finding a #MODULE.
|
|
||||||
FP_LIB_TABLE* m_footprintLibTable;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool m_KeepCvpcbOpen;
|
bool m_KeepCvpcbOpen;
|
||||||
FOOTPRINTS_LISTBOX* m_FootprintList;
|
FOOTPRINTS_LISTBOX* m_FootprintList;
|
||||||
LIBRARY_LISTBOX* m_LibraryList;
|
LIBRARY_LISTBOX* m_LibraryList;
|
||||||
COMPONENTS_LISTBOX* m_ListCmp;
|
COMPONENTS_LISTBOX* m_ListCmp;
|
||||||
DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame;
|
|
||||||
wxAuiToolBar* m_mainToolBar;
|
wxAuiToolBar* m_mainToolBar;
|
||||||
wxFileName m_NetlistFileName;
|
wxFileName m_NetlistFileName;
|
||||||
wxArrayString m_ModuleLibNames;
|
wxArrayString m_ModuleLibNames;
|
||||||
|
@ -87,10 +81,24 @@ protected:
|
||||||
// (in automatic selection/deletion of associations)
|
// (in automatic selection/deletion of associations)
|
||||||
PARAM_CFG_ARRAY m_projectFileParams;
|
PARAM_CFG_ARRAY m_projectFileParams;
|
||||||
|
|
||||||
|
CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
|
||||||
~CVPCB_MAINFRAME();
|
~CVPCB_MAINFRAME();
|
||||||
|
|
||||||
|
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ); // overload KIWAY_PLAYER
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function FootprintLibs
|
||||||
|
* @return the project #FP_LIB_TABLE.
|
||||||
|
*/
|
||||||
|
FP_LIB_TABLE* FootprintLibs() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a pointer on the Footprint Viewer frame, if exists, or NULL
|
||||||
|
*/
|
||||||
|
DISPLAY_FOOTPRINTS_FRAME* GetFpViewerFrame();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnSelectComponent
|
* Function OnSelectComponent
|
||||||
* Called when clicking on a component in component list window
|
* Called when clicking on a component in component list window
|
||||||
|
@ -226,23 +234,9 @@ public:
|
||||||
*/
|
*/
|
||||||
void LoadProjectFile( const wxString& aFileName );
|
void LoadProjectFile( const wxString& aFileName );
|
||||||
|
|
||||||
/**
|
void LoadSettings( wxConfigBase* aCfg ); // override virtual
|
||||||
* Function LoadSettings
|
|
||||||
* loads the CvPcb main frame specific configuration settings.
|
|
||||||
*
|
|
||||||
* Don't forget to call this base method from any derived classes or the
|
|
||||||
* settings will not get loaded.
|
|
||||||
*/
|
|
||||||
virtual void LoadSettings();
|
|
||||||
|
|
||||||
/**
|
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||||
* Function SaveSettings
|
|
||||||
* save the CvPcb frame specific configuration settings.
|
|
||||||
*
|
|
||||||
* Don't forget to call this base method from any derived classes or the
|
|
||||||
* settings will not get saved.
|
|
||||||
*/
|
|
||||||
virtual void SaveSettings();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DisplayStatus
|
* Function DisplayStatus
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
@ -43,18 +43,19 @@
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
|
|
||||||
DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) :
|
DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* aParent ) :
|
||||||
DIALOG_CVPCB_CONFIG_FBP( parent )
|
DIALOG_CVPCB_CONFIG_FBP( aParent )
|
||||||
{
|
{
|
||||||
wxString title;
|
wxString title;
|
||||||
wxFileName fn = parent->m_NetlistFileName;
|
wxFileName fn = aParent->m_NetlistFileName;
|
||||||
|
|
||||||
fn.SetExt( ProjectFileExtension );
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
|
||||||
m_Parent = parent;
|
m_Parent = aParent;
|
||||||
m_Config = wxGetApp().GetCommonSettings();
|
m_Config = Pgm().CommonSettings();
|
||||||
|
|
||||||
Init( );
|
Init( );
|
||||||
title.Format( _( "Project file: <%s>" ), GetChars( fn.GetFullPath() ) );
|
title.Format( _( "Project file: '%s'" ), GetChars( fn.GetFullPath() ) );
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
|
|
||||||
if( GetSizer() )
|
if( GetSizer() )
|
||||||
|
@ -93,7 +94,7 @@ void DIALOG_CVPCB_CONFIG::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display actual libraries paths:
|
// Display actual libraries paths:
|
||||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
wxPathList libpaths = Pgm().GetLibraryPathList();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -112,9 +113,9 @@ void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
|
||||||
if( m_LibPathChanged )
|
if( m_LibPathChanged )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
|
||||||
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString( ii ) );
|
Pgm().RemoveLibraryPath( m_listUserPaths->GetString( ii ) );
|
||||||
|
|
||||||
wxGetApp().InsertLibraryPath( m_Parent->m_UserLibraryPath, 1 );
|
Pgm().InsertLibraryPath( m_Parent->m_UserLibraryPath, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
EndModal( wxID_CANCEL );
|
EndModal( wxID_CANCEL );
|
||||||
|
@ -295,7 +296,8 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
insert = true;
|
insert = true;
|
||||||
|
|
||||||
wildcard = FootprintAliasFileWildcard;
|
wildcard = FootprintAliasFileWildcard;
|
||||||
wxListBox * list = m_ListEquiv;
|
|
||||||
|
wxListBox* list = m_ListEquiv;
|
||||||
|
|
||||||
if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) )
|
if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) )
|
||||||
{
|
{
|
||||||
|
@ -317,7 +319,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
|
libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
|
||||||
|
|
||||||
if( libpath.IsEmpty() )
|
if( libpath.IsEmpty() )
|
||||||
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
|
libpath = Pgm().LastVisitedLibraryPath();
|
||||||
|
|
||||||
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
|
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
|
||||||
wxEmptyString, wildcard,
|
wxEmptyString, wildcard,
|
||||||
|
@ -334,7 +336,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
fn = Filenames[jj];
|
fn = Filenames[jj];
|
||||||
|
|
||||||
if( jj == 0 )
|
if( jj == 0 )
|
||||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
Pgm().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||||
|
|
||||||
/* If the library path is already in the library search paths
|
/* If the library path is already in the library search paths
|
||||||
* list, just add the library name to the list. Otherwise, add
|
* list, just add the library name to the list. Otherwise, add
|
||||||
|
@ -343,7 +345,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
* because it preserve use of default libraries paths, when the path
|
* because it preserve use of default libraries paths, when the path
|
||||||
* is a sub path of these default paths
|
* is a sub path of these default paths
|
||||||
*/
|
*/
|
||||||
libfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fn.GetFullPath() );
|
libfilename = Pgm().FilenameWithRelativePathInSearchList( fn.GetFullPath() );
|
||||||
|
|
||||||
// Remove extension:
|
// Remove extension:
|
||||||
fn = libfilename;
|
fn = libfilename;
|
||||||
|
@ -372,7 +374,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
|
|
||||||
void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString path = wxGetApp().ReturnLastVisitedLibraryPath();
|
wxString path = Pgm().LastVisitedLibraryPath();
|
||||||
|
|
||||||
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
|
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
|
||||||
path,
|
path,
|
||||||
|
@ -416,10 +418,10 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||||
|
|
||||||
m_listUserPaths->Insert( path, ipos );
|
m_listUserPaths->Insert( path, ipos );
|
||||||
m_LibPathChanged = true;
|
m_LibPathChanged = true;
|
||||||
wxGetApp().InsertLibraryPath( path, ipos + 1 );
|
Pgm().InsertLibraryPath( path, ipos + 1 );
|
||||||
|
|
||||||
// Display actual libraries paths:
|
// Display actual libraries paths:
|
||||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
wxPathList libpaths = Pgm().GetLibraryPathList();
|
||||||
m_DefaultLibraryPathslistBox->Clear();
|
m_DefaultLibraryPathslistBox->Clear();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||||
|
@ -432,7 +434,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||||
DisplayError( this, _( "Path already in use" ) );
|
DisplayError( this, _( "Path already in use" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().SaveLastVisitedLibraryPath( path );
|
Pgm().SaveLastVisitedLibraryPath( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,13 +447,13 @@ void DIALOG_CVPCB_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
|
||||||
|
|
||||||
if( ii >= 0 )
|
if( ii >= 0 )
|
||||||
{
|
{
|
||||||
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
|
Pgm().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
|
||||||
m_listUserPaths->Delete( ii );
|
m_listUserPaths->Delete( ii );
|
||||||
m_LibPathChanged = true;
|
m_LibPathChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display actual libraries paths:
|
// Display actual libraries paths:
|
||||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
wxPathList libpaths = Pgm().GetLibraryPathList();
|
||||||
m_DefaultLibraryPathslistBox->Clear();
|
m_DefaultLibraryPathslistBox->Clear();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||||
|
@ -466,7 +468,7 @@ void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
wxString docpath, filename;
|
wxString docpath, filename;
|
||||||
|
|
||||||
docpath = wxGetApp().ReturnLastVisitedLibraryPath( wxT( "doc" ) );
|
docpath = Pgm().LastVisitedLibraryPath( wxT( "doc" ) );
|
||||||
|
|
||||||
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
|
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
|
||||||
wxEmptyString, PdfFileWildcard,
|
wxEmptyString, PdfFileWildcard,
|
||||||
|
@ -485,8 +487,8 @@ void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
|
||||||
* a sub path of these default paths
|
* a sub path of these default paths
|
||||||
*/
|
*/
|
||||||
wxFileName fn = FullFileName;
|
wxFileName fn = FullFileName;
|
||||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
Pgm().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||||
|
|
||||||
filename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( FullFileName );
|
filename = Pgm().FilenameWithRelativePathInSearchList( FullFileName );
|
||||||
m_TextHelpModulesFileName->SetValue( filename );
|
m_TextHelpModulesFileName->SetValue( filename );
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,9 @@ class DIALOG_CVPCB_CONFIG : public DIALOG_CVPCB_CONFIG_FBP
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CVPCB_MAINFRAME* m_Parent;
|
CVPCB_MAINFRAME* m_Parent;
|
||||||
wxConfig * m_Config;
|
wxConfigBase* m_Config;
|
||||||
wxString m_UserLibDirBufferImg;
|
wxString m_UserLibDirBufferImg;
|
||||||
|
|
||||||
bool m_LibListChanged;
|
bool m_LibListChanged;
|
||||||
bool m_LibPathChanged;
|
bool m_LibPathChanged;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
* @brief (Re)Create the menubar for CvPcb
|
* @brief (Re)Create the menubar for CvPcb
|
||||||
*/
|
*/
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
|
#include <kiface_i.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
|
@ -74,11 +75,13 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
// Add this menu to list menu managed by m_fileHistory
|
// Add this menu to list menu managed by m_fileHistory
|
||||||
// (the file history will be updated when adding/removing files in history
|
// (the file history will be updated when adding/removing files in history
|
||||||
if( openRecentMenu )
|
if( openRecentMenu )
|
||||||
wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu );
|
Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
|
||||||
|
|
||||||
openRecentMenu = new wxMenu();
|
openRecentMenu = new wxMenu();
|
||||||
wxGetApp().GetFileHistory().UseMenu( openRecentMenu );
|
|
||||||
wxGetApp().GetFileHistory().AddFilesToMenu();
|
Kiface().GetFileHistory().UseMenu( openRecentMenu );
|
||||||
|
Kiface().GetFileHistory().AddFilesToMenu();
|
||||||
|
|
||||||
AddMenuItem( filesMenu, openRecentMenu, -1,
|
AddMenuItem( filesMenu, openRecentMenu, -1,
|
||||||
_( "Open &Recent" ),
|
_( "Open &Recent" ),
|
||||||
_( "Open recent netlist" ),
|
_( "Open recent netlist" ),
|
||||||
|
@ -115,7 +118,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||||
KiBitmap( library_table_xpm ) );
|
KiBitmap( library_table_xpm ) );
|
||||||
|
|
||||||
// Language submenu
|
// Language submenu
|
||||||
wxGetApp().AddMenuLanguageList( preferencesMenu );
|
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||||
|
|
||||||
// Keep open on save
|
// Keep open on save
|
||||||
item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||||
|
|
|
@ -119,6 +119,49 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function missingLegacyLibs
|
||||||
|
* tests the list of \a aLibNames by URI to determine if any of them are missing from
|
||||||
|
* the #FP_LIB_TABLE.
|
||||||
|
*
|
||||||
|
* @note The missing legacy footprint library test is performed by using old library
|
||||||
|
* file path lookup method. If the library is found, it is compared against all
|
||||||
|
* of the URIs in the table rather than the nickname. This was done because the
|
||||||
|
* user could change the nicknames from the default table. Using the full path
|
||||||
|
* is more reliable.
|
||||||
|
*
|
||||||
|
* @param aLibNames is the list of legacy library names.
|
||||||
|
* @param aErrorMsg is a pointer to a wxString object to store the URIs of any missing
|
||||||
|
* legacy library paths. Can be NULL.
|
||||||
|
* @return true if there are missing legacy libraries. Otherwise false.
|
||||||
|
*/
|
||||||
|
static bool missingLegacyLibs( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack,
|
||||||
|
const wxArrayString& aLibNames, wxString* aErrorMsg )
|
||||||
|
{
|
||||||
|
bool retv = false;
|
||||||
|
|
||||||
|
for( unsigned i = 0; i < aLibNames.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
wxFileName fn( wxEmptyString, aLibNames[i], LegacyFootprintLibPathExtension );
|
||||||
|
|
||||||
|
wxString legacyLibPath = aSStack.FindValidPath( fn );
|
||||||
|
|
||||||
|
if( legacyLibPath.IsEmpty() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( aTbl->FindRowByURI( legacyLibPath ) == 0 )
|
||||||
|
{
|
||||||
|
retv = true;
|
||||||
|
|
||||||
|
if( aErrorMsg )
|
||||||
|
*aErrorMsg += wxT( "\"" ) + legacyLibPath + wxT( "\"\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
||||||
{
|
{
|
||||||
COMPONENT* component;
|
COMPONENT* component;
|
||||||
|
@ -164,7 +207,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
||||||
// Check if footprint links were generated before the footprint library table was implemented.
|
// Check if footprint links were generated before the footprint library table was implemented.
|
||||||
if( isLegacy )
|
if( isLegacy )
|
||||||
{
|
{
|
||||||
if( m_footprintLibTable->MissingLegacyLibs( m_ModuleLibNames, &missingLibs ) )
|
if( missingLegacyLibs( FootprintLibs(), Prj().PcbSearchS(), m_ModuleLibNames, &missingLibs ) )
|
||||||
{
|
{
|
||||||
msg = wxT( "The following legacy libraries are defined in the project file "
|
msg = wxT( "The following legacy libraries are defined in the project file "
|
||||||
"were not found in the footprint library table:\n\n" ) + missingLibs;
|
"were not found in the footprint library table:\n\n" ) + missingLibs;
|
||||||
|
@ -188,7 +231,9 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
||||||
msg.Clear();
|
msg.Clear();
|
||||||
WX_STRING_REPORTER reporter( &msg );
|
WX_STRING_REPORTER reporter( &msg );
|
||||||
|
|
||||||
if( !m_footprintLibTable->ConvertFromLegacy( m_netlist, m_ModuleLibNames, &reporter ) )
|
SEARCH_STACK& search = Prj().SchSearchS();
|
||||||
|
|
||||||
|
if( !FootprintLibs()->ConvertFromLegacy( search, m_netlist, m_ModuleLibNames, &reporter ) )
|
||||||
{
|
{
|
||||||
HTML_MESSAGE_BOX dlg( this, wxEmptyString );
|
HTML_MESSAGE_BOX dlg( this, wxEmptyString );
|
||||||
|
|
||||||
|
@ -270,27 +315,27 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
|
||||||
fn.SetExt( ComponentFileExtension );
|
fn.SetExt( ComponentFileExtension );
|
||||||
|
|
||||||
// Save the project specific footprint library table.
|
// Save the project specific footprint library table.
|
||||||
if( !m_footprintLibTable->IsEmpty( false ) )
|
if( !FootprintLibs()->IsEmpty( false ) )
|
||||||
{
|
{
|
||||||
wxFileName fpLibFileName = fn;
|
wxString fp_lib_tbl = Prj().FootprintLibTblName();
|
||||||
fpLibFileName.ClearExt();
|
|
||||||
fpLibFileName.SetName( FP_LIB_TABLE::GetFileName() );
|
|
||||||
|
|
||||||
if( fpLibFileName.FileExists()
|
if( wxFileName::FileExists( fp_lib_tbl )
|
||||||
&& IsOK( this, _( "A footprint library table already exists in this path.\n\nDo "
|
&& IsOK( this, _( "A footprint library table already exists in this path.\n\nDo "
|
||||||
"you want to overwrite it?" ) ) )
|
"you want to overwrite it?" ) ) )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_footprintLibTable->Save( fpLibFileName );
|
FootprintLibs()->Save( fp_lib_tbl );
|
||||||
}
|
}
|
||||||
catch( IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
wxString msg = wxString::Format( _(
|
||||||
wxString::Format( _( "An error occurred attempting to save the "
|
"An error occurred attempting to save the "
|
||||||
"footprint library table <%s>\n\n%s" ),
|
"footprint library table '%s'\n\n%s" ),
|
||||||
GetChars( fpLibFileName.GetFullPath() ),
|
GetChars( fp_lib_tbl ),
|
||||||
GetChars( ioe.errorText ) ) );
|
GetChars( ioe.errorText )
|
||||||
|
);
|
||||||
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <kiface_i.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||||
{
|
{
|
||||||
wxConfig* config = wxGetApp().GetSettings();
|
wxConfigBase* config = Kiface().KifaceSettings();
|
||||||
|
|
||||||
if( m_mainToolBar != NULL )
|
if( m_mainToolBar != NULL )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set( MAKE_LINK_MAPS false )
|
set( MAKE_LINK_MAPS true )
|
||||||
|
|
||||||
add_definitions( -DEESCHEMA )
|
add_definitions( -DEESCHEMA )
|
||||||
|
|
||||||
|
@ -194,11 +194,11 @@ endif()
|
||||||
# auto-generate cmp_library_lexer.h and cmp_library_keywords.cpp for the component
|
# auto-generate cmp_library_lexer.h and cmp_library_keywords.cpp for the component
|
||||||
# library format.
|
# library format.
|
||||||
make_lexer(
|
make_lexer(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.keywords
|
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.keywords
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_lexer.h
|
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_lexer.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.cpp
|
||||||
TLIB_T
|
TLIB_T
|
||||||
)
|
)
|
||||||
|
|
||||||
make_lexer(
|
make_lexer(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames.keywords
|
${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames.keywords
|
||||||
|
@ -238,21 +238,35 @@ set_source_files_properties( dialogs/dialog_bom.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# not ready for even building yet:
|
|
||||||
if( USE_KIWAY_DLLS )
|
if( USE_KIWAY_DLLS )
|
||||||
|
|
||||||
add_executable( eeschema WIN32 MACOSX_BUNDLE
|
add_executable( eeschema WIN32 MACOSX_BUNDLE
|
||||||
../common/single_top.cpp
|
../common/single_top.cpp
|
||||||
|
../common/pgm_base.cpp
|
||||||
|
${EESCHEMA_RESOURCES}
|
||||||
|
)
|
||||||
|
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS "TOP_FRAME=SCHEMATIC_FRAME_TYPE;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||||
)
|
)
|
||||||
target_link_libraries( eeschema
|
target_link_libraries( eeschema
|
||||||
|
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||||
|
# There's way too much crap coming in from common yet.
|
||||||
common
|
common
|
||||||
|
bitmaps
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# the DSO (KIFACE) housing the main eeschema code:
|
||||||
add_library( eeschema_kiface MODULE
|
add_library( eeschema_kiface MODULE
|
||||||
${EESCHEMA_SRCS}
|
${EESCHEMA_SRCS}
|
||||||
${EESCHEMA_COMMON_SRCS}
|
${EESCHEMA_COMMON_SRCS}
|
||||||
${EESCHEMA_RESOURCES}
|
# ${EESCHEMA_RESOURCES}
|
||||||
|
)
|
||||||
|
target_link_libraries( eeschema_kiface
|
||||||
|
common
|
||||||
|
bitmaps
|
||||||
|
polygon
|
||||||
|
${wxWidgets_LIBRARIES}
|
||||||
|
${GDI_PLUS_LIBRARIES}
|
||||||
)
|
)
|
||||||
set_target_properties( eeschema_kiface PROPERTIES
|
set_target_properties( eeschema_kiface PROPERTIES
|
||||||
# Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
|
# Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
|
||||||
|
@ -262,6 +276,14 @@ if( USE_KIWAY_DLLS )
|
||||||
SUFFIX ${KIFACE_SUFFIX}
|
SUFFIX ${KIFACE_SUFFIX}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The KIFACE is in eeschema.cpp, export it:
|
||||||
|
set_source_files_properties( eeschema.cpp PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
|
)
|
||||||
|
|
||||||
|
# if building eeschema, then also build eeschema_kiface if out of date.
|
||||||
|
add_dependencies( eeschema eeschema_kiface )
|
||||||
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
set_target_properties( eeschema_kiface PROPERTIES
|
set_target_properties( eeschema_kiface PROPERTIES
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||||
|
@ -269,31 +291,55 @@ if( USE_KIWAY_DLLS )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
if( MAKE_LINK_MAPS )
|
||||||
# generate a link map with cross reference
|
# generate link map with cross reference
|
||||||
set_target_properties( eeschema_kiface PROPERTIES
|
set_target_properties( eeschema_kiface PROPERTIES
|
||||||
LINK_FLAGS "-Wl,-cref -Wl,-Map=${KIFACE_PRE}eeschema.${KIFACE_EXT}.map"
|
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=${KIFACE_PREFIX}eeschema${KIFACE_SUFFIX}.map"
|
||||||
|
)
|
||||||
|
set_target_properties( eeschema PROPERTIES
|
||||||
|
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=eeschema.map"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries( eeschema_kiface
|
# these 2 binaries are a matched set, keep them together:
|
||||||
|
install( TARGETS eeschema
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
install( TARGETS eeschema_kiface
|
||||||
|
# actual filename subject to change at milestone C)
|
||||||
|
# modular-kicad blueprint.
|
||||||
|
DESTINATION ${KICAD_BIN}
|
||||||
|
COMPONENT binary
|
||||||
|
)
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
# copies kiface into the bundle
|
||||||
|
add_custom_target( _eeschema_kiface_copy ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/eeschema/_eeschema.kiface "${CMAKE_BINARY_DIR}/eeschema/eeschema.app/Contents/MacOS/"
|
||||||
|
DEPENDS eeschema_kiface
|
||||||
|
COMMENT "Copying kiface into eeschema"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
add_executable( eeschema WIN32 MACOSX_BUNDLE
|
||||||
|
../common/single_top.cpp
|
||||||
|
${EESCHEMA_SRCS}
|
||||||
|
${EESCHEMA_COMMON_SRCS}
|
||||||
|
${EESCHEMA_RESOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries( eeschema
|
||||||
common
|
common
|
||||||
|
# lib_kicad
|
||||||
bitmaps
|
bitmaps
|
||||||
polygon
|
polygon
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
${GDI_PLUS_LIBRARIES}
|
${GDI_PLUS_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Note that this filename is subject to change at milestone C) of
|
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||||
# modular-kicad blueprint.
|
COMPILE_DEFINITIONS "TOP_FRAME=SCHEMATIC_FRAME_TYPE;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||||
install( TARGETS eeschema_kiface
|
|
||||||
DESTINATION ${KICAD_BIN}
|
|
||||||
COMPONENT binary
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_executable( eeschema WIN32 MACOSX_BUNDLE
|
|
||||||
${EESCHEMA_SRCS}
|
|
||||||
${EESCHEMA_COMMON_SRCS}
|
|
||||||
${EESCHEMA_RESOURCES}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
|
@ -302,19 +348,12 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries( eeschema
|
install( TARGETS eeschema
|
||||||
common
|
DESTINATION ${KICAD_BIN}
|
||||||
bitmaps
|
COMPONENT binary
|
||||||
polygon
|
|
||||||
${wxWidgets_LIBRARIES}
|
|
||||||
${GDI_PLUS_LIBRARIES}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
install( TARGETS eeschema
|
|
||||||
DESTINATION ${KICAD_BIN}
|
|
||||||
COMPONENT binary
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory( plugins )
|
add_subdirectory( plugins )
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <kiface_i.h>
|
||||||
#include <wxEeschemaStruct.h>
|
#include <wxEeschemaStruct.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
@ -145,8 +145,8 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxString filename = dlg.GetPath();
|
wxString filename = dlg.GetPath();
|
||||||
wxString title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
wxString title = wxT( "Eeschema " ) + GetBuildVersion() + wxT( ' ' ) + filename;
|
||||||
title += wxT( " " ) + filename;
|
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
|
|
||||||
int response = wxMessageBox( _( "Do you want to force all the footprint fields visibility?" ),
|
int response = wxMessageBox( _( "Do you want to force all the footprint fields visibility?" ),
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <appl_wxstruct.h>
|
#include <pgm_base.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
@ -64,7 +64,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aPosition, bool aErase );
|
const wxPoint& aPosition, bool aErase );
|
||||||
|
|
||||||
|
|
||||||
int SCH_EDIT_FRAME::ReturnBlockCommand( int key )
|
int SCH_EDIT_FRAME::BlockCommand( int key )
|
||||||
{
|
{
|
||||||
int cmd = BLOCK_IDLE;
|
int cmd = BLOCK_IDLE;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
||||||
bool aErase );
|
bool aErase );
|
||||||
|
|
||||||
|
|
||||||
int LIB_EDIT_FRAME::ReturnBlockCommand( int key )
|
int LIB_EDIT_FRAME::BlockCommand( int key )
|
||||||
{
|
{
|
||||||
int cmd = BLOCK_IDLE;
|
int cmd = BLOCK_IDLE;
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ wxString LIB_COMPONENT::GetLibraryName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString LIB_COMPONENT::ReturnSubReference( int aUnit, bool aAddSeparator )
|
wxString LIB_COMPONENT::SubReference( int aUnit, bool aAddSeparator )
|
||||||
{
|
{
|
||||||
wxString subRef;
|
wxString subRef;
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ LIB_PIN* LIB_COMPONENT::GetPin( const wxString& aNumber, int aUnit, int aConvert
|
||||||
{
|
{
|
||||||
wxASSERT( pinList[i]->Type() == LIB_PIN_T );
|
wxASSERT( pinList[i]->Type() == LIB_PIN_T );
|
||||||
|
|
||||||
pinList[i]->ReturnPinStringNum( pNumber );
|
pinList[i]->PinStringNum( pNumber );
|
||||||
|
|
||||||
if( aNumber == pNumber )
|
if( aNumber == pNumber )
|
||||||
return pinList[i];
|
return pinList[i];
|
||||||
|
|
|
@ -664,7 +664,7 @@ public:
|
||||||
bool IsMulti() { return m_unitCount > 1; }
|
bool IsMulti() { return m_unitCount > 1; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnSubReference
|
* Function SubReference
|
||||||
* @return the sub reference for component having multiple parts per package.
|
* @return the sub reference for component having multiple parts per package.
|
||||||
* The sub reference identify the part (or unit)
|
* The sub reference identify the part (or unit)
|
||||||
* @param aUnit = the part identifier ( 1 to max count)
|
* @param aUnit = the part identifier ( 1 to max count)
|
||||||
|
@ -672,7 +672,7 @@ public:
|
||||||
* by the separator symbol (if any)
|
* by the separator symbol (if any)
|
||||||
* Note: this is a static function.
|
* Note: this is a static function.
|
||||||
*/
|
*/
|
||||||
static wxString ReturnSubReference( int aUnit, bool aAddSeparator = true );
|
static wxString SubReference( int aUnit, bool aAddSeparator = true );
|
||||||
|
|
||||||
// Accessors to sub ref parameters
|
// Accessors to sub ref parameters
|
||||||
static int GetSubpartIdSeparator() { return m_subpartIdSeparator; }
|
static int GetSubpartIdSeparator() { return m_subpartIdSeparator; }
|
||||||
|
|
|
@ -259,7 +259,7 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
|
||||||
i = busNumber.Find( '[' );
|
i = busNumber.Find( '[' );
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
while( busNumber[i] != '.' && i < busNumber.Len() )
|
while( i < busNumber.Len() && busNumber[i] != '.' )
|
||||||
{
|
{
|
||||||
tmp.Append( busNumber[i] );
|
tmp.Append( busNumber[i] );
|
||||||
i++;
|
i++;
|
||||||
|
@ -267,12 +267,12 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
|
||||||
|
|
||||||
tmp.ToLong( &begin );
|
tmp.ToLong( &begin );
|
||||||
|
|
||||||
while( busNumber[i] == '.' && i < busNumber.Len() )
|
while( i < busNumber.Len() && busNumber[i] == '.' )
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
tmp.Empty();
|
tmp.Empty();
|
||||||
|
|
||||||
while( busNumber[i] != ']' && i < busNumber.Len() )
|
while( i < busNumber.Len() && busNumber[i] != ']' )
|
||||||
{
|
{
|
||||||
tmp.Append( busNumber[i] );
|
tmp.Append( busNumber[i] );
|
||||||
i++;
|
i++;
|
||||||
|
@ -353,7 +353,7 @@ wxString NETLIST_OBJECT::GetShortNetName() const
|
||||||
netName = wxT("Net-(");
|
netName = wxT("Net-(");
|
||||||
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
|
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
|
||||||
netName << wxT("-Pad")
|
netName << wxT("-Pad")
|
||||||
<< LIB_PIN::ReturnPinStringNum( m_netNameCandidate->m_PinNum )
|
<< LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum )
|
||||||
<< wxT(")");
|
<< wxT(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
#include <lib_pin.h> // LIB_PIN::ReturnPinStringNum( m_PinNum )
|
#include <lib_pin.h> // LIB_PIN::PinStringNum( m_PinNum )
|
||||||
|
|
||||||
class NETLIST_OBJECT_LIST;
|
class NETLIST_OBJECT_LIST;
|
||||||
class SCH_COMPONENT;
|
class SCH_COMPONENT;
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
wxString GetPinNumText()
|
wxString GetPinNumText()
|
||||||
{
|
{
|
||||||
// hide the ugliness in here, but do it inline.
|
// hide the ugliness in here, but do it inline.
|
||||||
return LIB_PIN::ReturnPinStringNum( m_PinNum );
|
return LIB_PIN::PinStringNum( m_PinNum );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For Pins (NET_PINS):
|
/** For Pins (NET_PINS):
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue