Upstream merge.
This commit is contained in:
commit
23392ce8c9
|
@ -45,16 +45,11 @@
|
|||
#include <info3d_visu.h>
|
||||
#include <trackball.h>
|
||||
|
||||
// Exported function:
|
||||
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||
|
||||
|
||||
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
|
||||
void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
|
||||
{
|
||||
unsigned ii;
|
||||
|
||||
/* 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].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;
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
wxString text;
|
||||
|
|
|
@ -78,7 +78,11 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
|
|||
wxFULL_REPAINT_ON_RESIZE )
|
||||
{
|
||||
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.
|
||||
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 )
|
||||
glDeleteLists( m_gllist, 1 );
|
||||
if( aGlList )
|
||||
{
|
||||
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 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
|
||||
{
|
||||
private:
|
||||
bool m_init;
|
||||
GLuint m_gllist;
|
||||
GLuint m_glLists[GL_ID_END]; // GL lists
|
||||
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_ZTop; // position of the front layer
|
||||
|
||||
|
@ -67,7 +82,15 @@ public:
|
|||
|
||||
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:
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
|
@ -81,7 +104,6 @@ public:
|
|||
void OnEnterWindow( wxMouseEvent& event );
|
||||
|
||||
// Display functions
|
||||
GLuint DisplayCubeforTest(); // Just a test function
|
||||
void SetView3D( int keycode );
|
||||
void DisplayStatus();
|
||||
void Redraw();
|
||||
|
@ -92,7 +114,7 @@ public:
|
|||
* Prepares the parameters of the OpenGL draw list
|
||||
* creates the OpenGL draw list items (board, grid ...
|
||||
*/
|
||||
GLuint CreateDrawGL_List();
|
||||
void CreateDrawGL_List();
|
||||
void InitGL();
|
||||
void SetLights();
|
||||
void SetOffset(double aPosX, double aPosY)
|
||||
|
@ -104,11 +126,40 @@ public:
|
|||
/**
|
||||
* Function BuildBoard3DView
|
||||
* 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 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 Draw3DPadHole( D_PAD * aPad );
|
||||
|
||||
|
|
|
@ -41,9 +41,14 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
|||
m_Name = name;
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
|
||||
m_DiffuseColor.y * m_AmbientIntensity,
|
||||
|
@ -56,6 +61,20 @@ void S3D_MATERIAL::SetMaterial()
|
|||
#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 )
|
||||
{
|
||||
|
@ -79,6 +98,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
|
|||
EDA_ITEM( aParent, NOT_USED )
|
||||
{
|
||||
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
||||
m_lastTransparency = 0.0;
|
||||
m_3D_Drawings = NULL;
|
||||
m_Materials = NULL;
|
||||
m_ShapeType = FILE3D_NONE;
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
// Imported function:
|
||||
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 );
|
||||
|
||||
|
@ -76,7 +77,7 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
|
|||
{
|
||||
if( aPad->GetShape() == PAD_CIRCLE ) // Draw a ring
|
||||
{
|
||||
TransformRingToPolygon( aCornerBuffer, aPad->ReturnShapePos(),
|
||||
TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(),
|
||||
aPad->GetSize().x / 2, aCircleToSegmentsCount, aWidth );
|
||||
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[2], 0.0, 0.0, 1.0 );
|
||||
|
||||
if( m_gllist )
|
||||
glCallList( m_gllist );
|
||||
else
|
||||
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -198,8 +236,7 @@ static inline void SetGLTechLayersColor( LAYER_NUM aLayer )
|
|||
|
||||
void EDA_3D_CANVAS::BuildBoard3DView()
|
||||
{
|
||||
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
|
||||
BOARD* pcb = pcbframe->GetBoard();
|
||||
BOARD* pcb = GetBoard();
|
||||
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
||||
|
||||
// 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() )
|
||||
{
|
||||
if( !item->IsOnLayer( layer ) )
|
||||
|
@ -331,11 +368,9 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
case PCB_LINE_T: // should not exist on copper layers
|
||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
|
@ -456,14 +491,78 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2,
|
||||
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;
|
||||
allLayerHoles.ExportTo( brdpolysetHoles );
|
||||
|
||||
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
|
||||
layer++ )
|
||||
{
|
||||
// Skip user layers, which are not drawn here
|
||||
if( IsUserLayer( layer) )
|
||||
continue;
|
||||
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
|
@ -481,9 +580,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
{
|
||||
case PCB_LINE_T:
|
||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
|
@ -556,10 +653,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
currLayerPolyset += polyset;
|
||||
}
|
||||
|
||||
SetGLTechLayersColor( layer );
|
||||
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||
|
||||
if( layer == EDGE_N )
|
||||
{
|
||||
|
@ -582,38 +677,222 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
// 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() )
|
||||
module->ReadAndInsert3DComponentShape( this );
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
||||
void EDA_3D_CANVAS::CreateDrawGL_List()
|
||||
{
|
||||
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
|
||||
BOARD* pcb = pcbframe->GetBoard();
|
||||
BOARD* pcb = GetBoard();
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
m_gllist = glGenLists( 1 );
|
||||
|
||||
// Build 3D board parameters:
|
||||
g_Parm_3D_Visu.InitSettings( pcb );
|
||||
|
||||
glNewList( m_gllist, GL_COMPILE_AND_EXECUTE );
|
||||
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
|
||||
// draw axis
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) )
|
||||
// Create axis gl list (if it is not shown, the list will be not called
|
||||
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 );
|
||||
SetGLColor( WHITE );
|
||||
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.3f ); // Z axis
|
||||
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,
|
||||
// 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;
|
||||
EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines
|
||||
EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
|
||||
double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
|
||||
double transparency = 0.4;
|
||||
const double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
|
||||
const double transparency = 0.3;
|
||||
|
||||
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 thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
|
||||
aVia->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||
aVia->LayerPair( &top_layer, &bottom_layer );
|
||||
|
||||
// Drawing via hole:
|
||||
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
|
||||
S3D_MASTER* shape3D = m_3D_Drawings;
|
||||
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() )
|
||||
{
|
||||
shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects );
|
||||
shape3D->SetLoadTransparentObjects( aAllowTransparentObjects );
|
||||
|
||||
if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
|
||||
shape3D->ReadData();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <3d_draw_basic_functions.h>
|
||||
|
||||
// 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();
|
||||
|
||||
// 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
|
||||
|
||||
// Creates the GL_QUAD
|
||||
Set_Object_Data( coords, aBiuTo3DUnits );
|
||||
TransfertToGLlist( coords, aBiuTo3DUnits );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <kiface_i.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <3d_canvas.h>
|
||||
|
@ -40,21 +41,24 @@
|
|||
INFO3D_VISU g_Parm_3D_Visu;
|
||||
|
||||
// Key to store 3D Viewer config:
|
||||
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
|
||||
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
|
||||
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
|
||||
static const wxString keyShowRealisticMode( wxT( "ShowRealisticMode" ) );
|
||||
static const wxString keyShowAxis( wxT( "ShowAxis" ) );
|
||||
static const wxString keyShowZones( wxT( "ShowZones" ) );
|
||||
static const wxString keyShowFootprints( wxT( "ShowFootprints" ) );
|
||||
static const wxString keyShowCopperThickness( wxT( "ShowCopperThickness" ) );
|
||||
static const wxString keyShowAdhesiveLayers( wxT( "ShowAdhesiveLayers" ) );
|
||||
static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) );
|
||||
static const wxString keyShowSolderMaskLayers( wxT( "ShowSolderMasLayers" ) );
|
||||
static const wxString keyShowSolderPasteLayers( wxT( "ShowSolderPasteLayers" ) );
|
||||
static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) );
|
||||
static const wxString keyShowBoardBody( wxT( "ShowBoardBody" ) );
|
||||
static const wxString keyShowEcoLayers( wxT( "ShowEcoLayers" ) );
|
||||
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
|
||||
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
|
||||
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
|
||||
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
||||
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
|
||||
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
|
||||
static const wxChar keyShowGridSize[] = wxT( "Grid3DSize" );
|
||||
static const wxChar keyShowZones[] = wxT( "ShowZones" );
|
||||
static const wxChar keyShowFootprints[] = wxT( "ShowFootprints" );
|
||||
static const wxChar keyShowCopperThickness[] = wxT( "ShowCopperThickness" );
|
||||
static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
|
||||
static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
|
||||
static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
|
||||
static const wxChar keyShowSolderPasteLayers[] =wxT( "ShowSolderPasteLayers" );
|
||||
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 )
|
||||
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 )
|
||||
|
||||
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
||||
const wxString& title,
|
||||
long style ) :
|
||||
EDA_BASE_FRAME( parent, DISPLAY3D_FRAME_TYPE, title,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, DISPLAY3D_FRAME_TYPE, aTitle,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
{
|
||||
m_canvas = NULL;
|
||||
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 ) );
|
||||
SetIcon( icon );
|
||||
|
||||
GetSettings();
|
||||
LoadSettings( config() );
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// 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
|
||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
if( config )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings();
|
||||
INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
|
||||
config->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 );
|
||||
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
||||
aCfg->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
||||
aCfg->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
||||
aCfg->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
||||
|
||||
bool tmp;
|
||||
config->Read( keyShowRealisticMode, &tmp, false );
|
||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
bool tmp;
|
||||
aCfg->Read( keyShowRealisticMode, &tmp, false );
|
||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
|
||||
config->Read( keyShowAxis, &tmp, true );
|
||||
prms.SetFlag( FL_AXIS, tmp );
|
||||
aCfg->Read( keyShowAxis, &tmp, true );
|
||||
prms.SetFlag( FL_AXIS, tmp );
|
||||
|
||||
config->Read( keyShowFootprints, &tmp, true );
|
||||
prms.SetFlag( FL_MODULE, tmp );
|
||||
aCfg->Read( keyShowGrid, &tmp, true );
|
||||
prms.SetFlag( FL_GRID, tmp );
|
||||
|
||||
config->Read( keyShowCopperThickness, &tmp, false );
|
||||
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
|
||||
aCfg->Read( keyShowGridSize, &prms.m_3D_Grid, 10.0 );
|
||||
prms.SetFlag( FL_MODULE, tmp );
|
||||
|
||||
config->Read( keyShowZones, &tmp, true );
|
||||
prms.SetFlag( FL_ZONE, tmp );
|
||||
aCfg->Read( keyShowFootprints, &tmp, true );
|
||||
prms.SetFlag( FL_MODULE, tmp );
|
||||
|
||||
config->Read( keyShowAdhesiveLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ADHESIVE, tmp );
|
||||
aCfg->Read( keyShowCopperThickness, &tmp, false );
|
||||
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
|
||||
|
||||
config->Read( keyShowSilkScreenLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SILKSCREEN, tmp );
|
||||
aCfg->Read( keyShowZones, &tmp, true );
|
||||
prms.SetFlag( FL_ZONE, tmp );
|
||||
|
||||
config->Read( keyShowSolderMaskLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERMASK, tmp );
|
||||
aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ADHESIVE, tmp );
|
||||
|
||||
config->Read( keyShowSolderPasteLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERPASTE, tmp );
|
||||
aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SILKSCREEN, tmp );
|
||||
|
||||
config->Read( keyShowCommentsLayer, &tmp, true );
|
||||
prms.SetFlag( FL_COMMENTS, tmp );
|
||||
aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERMASK, tmp );
|
||||
|
||||
config->Read( keyShowEcoLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ECO, tmp );
|
||||
aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERPASTE, tmp );
|
||||
|
||||
config->Read( keyShowBoardBody, &tmp, true );
|
||||
prms.SetFlag( FL_SHOW_BOARD_BODY, tmp );
|
||||
}
|
||||
aCfg->Read( keyShowCommentsLayer, &tmp, true );
|
||||
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 )
|
||||
return;
|
||||
INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
|
||||
EDA_BASE_FRAME::SaveSettings();
|
||||
|
||||
config->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
||||
config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
||||
config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
config->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
config->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
||||
config->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
||||
config->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
config->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
||||
config->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
||||
config->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
||||
config->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
||||
config->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
||||
config->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||
config->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||
config->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
aCfg->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
||||
aCfg->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
||||
aCfg->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
aCfg->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
||||
aCfg->Write( keyShowGrid, prms.GetFlag( FL_GRID ) );
|
||||
aCfg->Write( keyShowGridSize, prms.m_3D_Grid );
|
||||
aCfg->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
||||
aCfg->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
aCfg->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
||||
aCfg->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
||||
aCfg->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
||||
aCfg->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
||||
aCfg->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
||||
aCfg->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||
aCfg->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||
aCfg->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:
|
||||
g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
|
||||
NewDisplay();
|
||||
m_canvas->Refresh();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_MODULE_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
|
||||
NewDisplay();
|
||||
m_canvas->Refresh();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_USE_COPPER_THICKNESS:
|
||||
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_BOARD);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_ZONE_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_BOARD);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_ADHESIVE_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_TECH_LAYERS);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SILKSCREEN_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_TECH_LAYERS);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDER_MASK_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_TECH_LAYERS);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDER_PASTE_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_TECH_LAYERS);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_COMMENTS_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_AUX_LAYERS);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_ECO_ONOFF:
|
||||
g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
|
||||
NewDisplay();
|
||||
NewDisplay(GL_ID_AUX_LAYERS);
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -434,7 +440,6 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
|||
GetMenuBar()->Check( ii, false );
|
||||
}
|
||||
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MENU3D_GRID_NOGRID:
|
||||
|
@ -466,18 +471,17 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
NewDisplay();
|
||||
NewDisplay( GL_ID_GRID );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_FRAME::NewDisplay()
|
||||
void EDA_3D_FRAME::NewDisplay( GLuint aGlList )
|
||||
{
|
||||
m_reloadRequest = false;
|
||||
|
||||
m_canvas->ClearLists();
|
||||
m_canvas->ClearLists( aGlList );
|
||||
m_canvas->CreateDrawGL_List();
|
||||
|
||||
// m_canvas->InitGL();
|
||||
m_canvas->Refresh( true );
|
||||
m_canvas->DisplayStatus();
|
||||
}
|
||||
|
@ -507,6 +511,9 @@ void EDA_3D_FRAME::Set3DBgColor()
|
|||
|
||||
newcolor = wxGetColourFromUser( this, oldcolor );
|
||||
|
||||
if( !newcolor.IsOk() ) // Happens on cancel dialog
|
||||
return;
|
||||
|
||||
if( newcolor != oldcolor )
|
||||
{
|
||||
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
||||
|
@ -515,3 +522,8 @@ void EDA_3D_FRAME::Set3DBgColor()
|
|||
NewDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
BOARD* EDA_3D_FRAME::GetBoard()
|
||||
{
|
||||
return Parent()->GetBoard();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <info3d_visu.h>
|
||||
|
|
|
@ -109,6 +109,10 @@ public:
|
|||
private:
|
||||
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
||||
FILE3D_TYPE m_ShapeType;
|
||||
double m_lastTransparency; // last transparency value from
|
||||
// last material in use
|
||||
bool m_loadTransparentObjects;
|
||||
bool m_loadNonTransparentObjects;
|
||||
|
||||
public:
|
||||
S3D_MASTER( EDA_ITEM* aParent );
|
||||
|
@ -117,11 +121,41 @@ public:
|
|||
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
|
||||
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 );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
/**
|
||||
* Function ReadData
|
||||
* Select the parser to read the 3D data file (vrml, x3d ...)
|
||||
* and build the description objects list
|
||||
*/
|
||||
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)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
|
@ -147,6 +181,13 @@ public:
|
|||
*/
|
||||
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 );
|
||||
};
|
||||
|
||||
|
|
|
@ -166,13 +166,22 @@ void EDA_3D_FRAME::CreateMenuBar()
|
|||
wxMenu * gridlistMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
|
||||
_( "3D Grid" ), KiBitmap( grid_xpm ) );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, 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 );
|
||||
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 );
|
||||
// If the grid is on, check the corresponding menuitem showing the grid size
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
|
||||
{
|
||||
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();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#ifndef __3D_VIEWER_H__
|
||||
#define __3D_VIEWER_H__
|
||||
|
||||
#include <wxstruct.h> // for EDA_BASE_FRAME.
|
||||
#include <draw_frame.h>
|
||||
|
||||
#if !wxUSE_GLCANVAS
|
||||
#error Please build wxWidgets with Opengl support (./configure --with-opengl)
|
||||
|
@ -53,24 +53,29 @@
|
|||
|
||||
#include <3d_struct.h>
|
||||
|
||||
#define KISYS3DMOD "KISYS3DMOD"
|
||||
|
||||
class EDA_3D_CANVAS;
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
||||
#define LIB3D_PATH wxT( "packages3d" )
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
|
||||
#define LIB3D_PATH wxT( "packages3d" )
|
||||
|
||||
class EDA_3D_FRAME : public EDA_BASE_FRAME
|
||||
|
||||
class EDA_3D_FRAME : public KIWAY_PLAYER
|
||||
{
|
||||
private:
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
bool m_reloadRequest;
|
||||
wxString m_defaultFileName; /// Filename to propose for screenshot
|
||||
|
||||
/// Tracks whether to use Orthographic or Perspective projection
|
||||
bool m_ortho;
|
||||
|
||||
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 );
|
||||
|
||||
~EDA_3D_FRAME()
|
||||
{
|
||||
m_auimgr.UnInit();
|
||||
|
@ -78,6 +83,8 @@ public:
|
|||
|
||||
PCB_BASE_FRAME* Parent() { return (PCB_BASE_FRAME*)GetParent(); }
|
||||
|
||||
BOARD* GetBoard();
|
||||
|
||||
/**
|
||||
* Function ReloadRequest
|
||||
* must be called when reloading data from Pcbnew is needed
|
||||
|
@ -93,8 +100,10 @@ public:
|
|||
* Function NewDisplay
|
||||
* Rebuild the display list.
|
||||
* 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; }
|
||||
const wxString &GetDefaultFileName() const { return m_defaultFileName; }
|
||||
|
@ -121,8 +130,9 @@ private:
|
|||
// to the current display options
|
||||
void ReCreateMainToolbar();
|
||||
void SetToolbars();
|
||||
void GetSettings();
|
||||
void SaveSettings();
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ); // overload virtual
|
||||
void SaveSettings( wxConfigBase* aCfg ); // overload virtual
|
||||
|
||||
// Other functions
|
||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||
|
|
|
@ -74,7 +74,6 @@ enum DISPLAY3D_FLG {
|
|||
FL_LAST
|
||||
};
|
||||
|
||||
|
||||
class INFO3D_VISU
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
class S3D_MASTER;
|
||||
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 X3D_MODEL_PARSER;
|
||||
|
|
|
@ -519,8 +519,12 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
|
|||
vertices.push_back( vertex );
|
||||
}
|
||||
|
||||
GetMaster()->Set_Object_Coords( vertices );
|
||||
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
|
||||
if( GetMaster()->IsOpenGlAllowed() )
|
||||
{
|
||||
GetMaster()->ObjectCoordsTo3DUnits( vertices );
|
||||
TransfertToGLlist( vertices, vrmlunits_to_3Dunits );
|
||||
}
|
||||
|
||||
vertices.clear();
|
||||
coordIndex.clear();
|
||||
}
|
||||
|
|
|
@ -479,8 +479,11 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
|||
vertices.push_back( triplets.at( *id ) );
|
||||
}
|
||||
|
||||
GetMaster()->Set_Object_Coords( vertices );
|
||||
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
|
||||
if( GetMaster()->IsOpenGlAllowed() )
|
||||
{
|
||||
GetMaster()->ObjectCoordsTo3DUnits( vertices );
|
||||
TransfertToGLlist( vertices, vrmlunits_to_3Dunits );
|
||||
}
|
||||
|
||||
vertices.clear();
|
||||
coordIndex.clear();
|
||||
|
|
|
@ -23,8 +23,9 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
|
|||
# reports.
|
||||
#
|
||||
|
||||
option( USE_KIWAY_DLLS
|
||||
"Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." OFF )
|
||||
#option( USE_KIWAY_DLLS "Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." ON )
|
||||
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
|
||||
# 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
|
||||
# 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:
|
||||
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_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
|
||||
# subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
|
||||
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()
|
||||
|
||||
find_package( OpenMP QUIET )
|
||||
|
||||
if( OPENMP_FOUND )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||
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()
|
||||
|
||||
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_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)
|
||||
if( NOT APPLE )
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
endif()
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
endif()
|
||||
|
||||
# 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_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")
|
||||
|
||||
if( NOT CMAKE_CXX_COMPILER )
|
||||
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
|
||||
endif( NOT CMAKE_CXX_COMPILER )
|
||||
endif()
|
||||
|
||||
if( NOT CMAKE_CXX_COMPILER )
|
||||
EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
|
||||
endif( NOT CMAKE_CXX_COMPILER )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
@ -340,7 +349,7 @@ include( ExternalProject )
|
|||
include( CheckFindPackageResult )
|
||||
|
||||
# Turn on wxWidgets compatibility mode for some classes
|
||||
add_definitions(-DWX_COMPATIBILITY)
|
||||
add_definitions( -DWX_COMPATIBILITY )
|
||||
|
||||
#######################
|
||||
# Find OpenGL library #
|
||||
|
@ -348,6 +357,12 @@ add_definitions(-DWX_COMPATIBILITY)
|
|||
find_package( OpenGL QUIET )
|
||||
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
|
||||
# Always defined, empty if no libraries are to be build
|
||||
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 )
|
||||
|
||||
message(STATUS "Scripting ENABLED")
|
||||
|
||||
message(STATUS "Scripting ENABLED")
|
||||
include( download_wxpython )
|
||||
|
||||
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
|
||||
|
@ -439,14 +454,18 @@ endif( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC)
|
|||
#####################
|
||||
# Find GLEW library #
|
||||
#####################
|
||||
find_package(GLEW)
|
||||
check_find_package_result(GLEW_FOUND "GLEW")
|
||||
if( NOT GLEW_FOUND )
|
||||
find_package( GLEW )
|
||||
check_find_package_result( GLEW_FOUND "GLEW" )
|
||||
endif()
|
||||
|
||||
######################
|
||||
# Find Cairo library #
|
||||
######################
|
||||
find_package(Cairo 1.8.1 QUIET)
|
||||
check_find_package_result(CAIRO_FOUND "Cairo")
|
||||
if( NOT CAIRO_FOUND )
|
||||
find_package( Cairo 1.8.1 QUIET )
|
||||
check_find_package_result( CAIRO_FOUND "Cairo" )
|
||||
endif()
|
||||
|
||||
# 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." )
|
||||
endif()
|
||||
|
||||
add_custom_target( boost ) # it is required to meet some further dependencies
|
||||
|
||||
message( WARNING "
|
||||
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.
|
||||
|
@ -482,8 +503,8 @@ else()
|
|||
endif()
|
||||
|
||||
if( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
||||
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
|
||||
endif( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
||||
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
|
||||
endif()
|
||||
|
||||
# Include wxWidgets macros.
|
||||
include( ${wxWidgets_USE_FILE} )
|
||||
|
@ -531,15 +552,15 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
|||
set( PythonInterp_FIND_VERSION 2.6 )
|
||||
set( PythonLibs_FIND_VERSION 2.6 )
|
||||
endif()
|
||||
|
||||
|
||||
# force a python version < 3.0
|
||||
set( PythonInterp_FIND_VERSION 2.6)
|
||||
set( PythonLibs_FIND_VERSION 2.6 )
|
||||
|
||||
find_package( PythonInterp )
|
||||
|
||||
|
||||
check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
||||
|
||||
|
||||
if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
|
||||
message( FATAL_ERROR "Python 2.x is required." )
|
||||
endif()
|
||||
|
|
|
@ -59,7 +59,9 @@ set( BOOST_LIBS_BUILT
|
|||
)
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
|
||||
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
|
||||
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
|
||||
|
@ -99,7 +101,7 @@ else()
|
|||
endif()
|
||||
|
||||
|
||||
if( MINGW )
|
||||
if( MINGW AND NOT CMAKE_HOST_UNIX ) # building for MINGW on windows not UNIX
|
||||
if( MSYS )
|
||||
# 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
|
||||
|
@ -113,14 +115,16 @@ if( MINGW )
|
|||
set( b2_libs ${b2_libs} --with-${lib} )
|
||||
endforeach()
|
||||
unset( BOOST_CFLAGS )
|
||||
|
||||
else()
|
||||
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
|
||||
#message( STATUS "libs_csv:${libs_csv}" )
|
||||
|
||||
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
|
||||
# pass to *both* C and C++ compilers
|
||||
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
||||
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
||||
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
||||
set( BOOST_CXXFLAGS "cxxflags=${PIC_FLAG}" )
|
||||
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
||||
unset( b2_libs )
|
||||
endif()
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ set( CAIRO_ROOT "${PROJECT_SOURCE_DIR}/cairo_root" )
|
|||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/cairo )
|
||||
|
||||
|
@ -42,7 +44,7 @@ if ( KICAD_BUILD_STATIC )
|
|||
endif( KICAD_BUILD_STATIC )
|
||||
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
|
||||
set( CAIRO_CFLAGS "CFLAGS=" )
|
||||
set( CAIRO_LDFLAGS "LDFLAGS=-framework CoreServices -framework Cocoa" )
|
||||
|
@ -94,8 +96,14 @@ ExternalProject_Add( cairo
|
|||
|
||||
#BINARY_DIR "${PREFIX}"
|
||||
|
||||
BUILD_COMMAND $(MAKE)
|
||||
BUILD_COMMAND $(MAKE)
|
||||
|
||||
INSTALL_DIR "${CAIRO_ROOT}"
|
||||
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>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/glew )
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
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" )
|
||||
|
|
|
@ -33,13 +33,15 @@ set( PIXMAN_ROOT "${PROJECT_SOURCE_DIR}/pixman_root" )
|
|||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/pixman )
|
||||
|
||||
set(PIXMAN_CPPFLAGS "CFLAGS=")
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
set(PIXMAN_CPPFLAGS "${PIXMAN_CPPFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
|
||||
else()
|
||||
|
|
|
@ -33,7 +33,9 @@ set( PKGCONFIG_ROOT "${PROJECT_SOURCE_DIR}/pkgconfig_root" )
|
|||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/pkgconfig )
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ if (APPLE)
|
|||
STRING(REGEX REPLACE " -arch " "," LIBWXPYTHON_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
||||
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_arch=${LIBWXPYTHON_ARCHITECTURES})
|
||||
endif( CMAKE_OSX_ARCHITECTURES )
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
SET( LIBWXPYTHON_PRECMD export CFLAGS=-Qunused-arguments && )
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
if ( KICAD_BUILD_STATIC )
|
||||
|
@ -74,7 +78,7 @@ ExternalProject_Add( libwxpython
|
|||
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWXPYTHON_ROOT}"
|
||||
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}"
|
||||
|
||||
|
|
|
@ -33,11 +33,13 @@ set( LIBWX_ROOT "${PROJECT_SOURCE_DIR}/libwx_root" )
|
|||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/libwx )
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
STRING(REGEX REPLACE " -arch " "," LIBWX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
||||
SET( LIBWX_ARCHITECTURES --enable-universal_binary=${LIBWX_ARCHITECTURES})
|
||||
|
@ -80,7 +82,7 @@ ExternalProject_Add( libwx
|
|||
#SET directories
|
||||
set(wxWidgets_BIN_DIR ${LIBWX_ROOT}/bin)
|
||||
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)
|
||||
|
||||
|
||||
|
@ -110,7 +112,7 @@ ExternalProject_Add_Step( libwx bzr_init_libwx
|
|||
######
|
||||
|
||||
ExternalProject_Add_Step( libwx libwx_recursive_message
|
||||
COMMAND cmake .
|
||||
COMMAND cmake .
|
||||
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
|
||||
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.
|
||||
Known problems:
|
||||
wxMSW:
|
||||
*DO NOT* use wxMSW.2.8.1
|
||||
in fact: use wxWidgets >= 2.9.3
|
||||
use *only* wxWidgets >= 3.0
|
||||
|
||||
wxGTK
|
||||
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:
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
@ -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.
|
||||
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("%%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:
|
||||
======================
|
||||
*) Get licensing cleaned up.
|
||||
*) DLL-ization of pcbnew & eeschema
|
||||
http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
|
||||
https://blueprints.launchpad.net/kicad/+spec/modular-kicad
|
||||
*) Get licensing cleaned up.
|
||||
|
||||
*) DLL-ization of pcbnew & eeschema
|
||||
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(
|
||||
../potrace
|
||||
../common
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
set(BITMAP2COMPONENT_SRCS
|
||||
set( BITMAP2COMPONENT_SRCS
|
||||
../common/single_top.cpp
|
||||
bitmap2component.cpp
|
||||
bitmap2cmp_gui_base
|
||||
bitmap2cmp_gui
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler(bitmap2component)
|
||||
else(MINGW)
|
||||
set(BITMAP2COMPONENT_RESOURCES bitmap2component.rc)
|
||||
endif(MINGW)
|
||||
endif(WIN32)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=0"
|
||||
)
|
||||
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "COMPILING_DLL"
|
||||
)
|
||||
|
||||
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)
|
||||
set(BITMAP2COMPONENT_RESOURCES bitmap2component.icns)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(MACOSX_BUNDLE_ICON_FILE bitmap2component.icns)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.bitmap2component)
|
||||
endif(APPLE)
|
||||
if( false ) # linker map with cross reference
|
||||
set_target_properties( bitmap2component PROPERTIES
|
||||
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=bitmap2component.map"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
add_executable(bitmap2component WIN32 MACOSX_BUNDLE
|
||||
${BITMAP2COMPONENT_SRCS}
|
||||
${BITMAP2COMPONENT_RESOURCES})
|
||||
if( MINGW )
|
||||
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler( bitmap2component )
|
||||
else()
|
||||
set( BITMAP2COMPONENT_RESOURCES bitmap2component.rc )
|
||||
endif()
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(bitmap2component PROPERTIES MACOSX_BUNDLE_INFO_PLIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries( bitmap2component common polygon bitmaps
|
||||
${wxWidgets_LIBRARIES}
|
||||
potrace
|
||||
)
|
||||
|
||||
install(TARGETS bitmap2component
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary)
|
||||
if( APPLE )
|
||||
set( BITMAP2COMPONENT_RESOURCES bitmap2component.icns )
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
set( MACOSX_BUNDLE_ICON_FILE bitmap2component.icns )
|
||||
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.bitmap2component )
|
||||
|
||||
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.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <wxstruct.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <bitmap2cmp_gui_base.h>
|
||||
|
||||
#include <potracelib.h>
|
||||
|
@ -39,47 +38,57 @@
|
|||
#include <colors_selection.h>
|
||||
#include <build_version.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <kiway.h>
|
||||
#include <kiface_i.h>
|
||||
|
||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
||||
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
||||
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
||||
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
||||
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
||||
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
|
||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
||||
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
||||
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
||||
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
||||
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
||||
#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
|
||||
This is the main frame for this application
|
||||
*/
|
||||
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||
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
|
||||
{
|
||||
private:
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
wxSize m_FrameSize;
|
||||
wxPoint m_FramePos;
|
||||
wxConfig * m_Config;
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
wxSize m_imageDPI; // The initial image resolution. When unknown,
|
||||
// set to DEFAULT_DPI x DEFAULT_DPI per Inch
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
wxSize m_frameSize;
|
||||
wxPoint m_framePos;
|
||||
wxConfig* m_config;
|
||||
|
||||
public:
|
||||
BM2CMP_FRAME();
|
||||
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~BM2CMP_FRAME();
|
||||
|
||||
// overload KIWAY_PLAYER virtual
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl=0 );
|
||||
|
||||
private:
|
||||
|
||||
// Event handlers
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnLoadFile( wxCommandEvent& event );
|
||||
bool LoadFile( wxString& aFullFileName );
|
||||
void OnExport( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
|
@ -109,30 +118,51 @@ private:
|
|||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||
void OnOptionsSelection( wxCommandEvent& 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 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;
|
||||
m_Config = new wxConfig();
|
||||
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_SIZEX, & m_FrameSize.x, -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_OUTPUT_FILE, &m_ConvertedFileName );
|
||||
if( m_Config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) )
|
||||
m_config = new wxConfig();
|
||||
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_SIZEX, & m_frameSize.x, -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_OUTPUT_FILE, &m_ConvertedFileName );
|
||||
|
||||
if( m_config->Read( KEYWORD_BINARY_THRESHOLD, &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_Config->Read( KEYWORD_LAST_FORMAT, &tmp );
|
||||
m_config->Read( KEYWORD_LAST_FORMAT, &tmp );
|
||||
m_radioBoxFormat->SetSelection( tmp );
|
||||
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap( KiBitmap( icon_bitmap2component_xpm ) );
|
||||
|
@ -140,34 +170,36 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
|
|||
|
||||
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 );
|
||||
|
||||
if ( m_FramePos == wxDefaultPosition )
|
||||
m_imageDPI.x = m_imageDPI.y = DEFAULT_DPI; // Default resolution in Bit per inches
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
{
|
||||
if( ( m_Config == NULL ) || IsIconized() )
|
||||
if( !m_config || IsIconized() )
|
||||
return;
|
||||
|
||||
m_FrameSize = GetSize();
|
||||
m_FramePos = GetPosition();
|
||||
m_frameSize = GetSize();
|
||||
m_framePos = GetPosition();
|
||||
|
||||
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_SIZEX, (long) m_FrameSize.x );
|
||||
m_Config->Write( KEYWORD_FRAME_SIZEY, (long) m_FrameSize.y );
|
||||
m_Config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
||||
m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||
m_Config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||
m_Config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
|
||||
m_Config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
||||
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_SIZEX, (long) m_frameSize.x );
|
||||
m_config->Write( KEYWORD_FRAME_SIZEY, (long) m_frameSize.y );
|
||||
m_config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
||||
m_config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||
m_config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||
m_config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->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
|
||||
* destructor and before the native window is destroyed
|
||||
|
@ -207,23 +239,24 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
|||
*/
|
||||
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn(m_BitmapFileName);
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn( m_BitmapFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = wxGetCwd();
|
||||
|
||||
wxFileDialog FileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
_( "Image Files " ) + wxImage::GetImageExtWildcard(),
|
||||
wxFD_OPEN );
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fullFilename = FileDlg.GetPath();
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
|
||||
if( ! LoadFile( fullFilename ) )
|
||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||
return;
|
||||
|
||||
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 ) )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -246,15 +288,32 @@ bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
|||
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
int nb = m_Pict_Bitmap.GetDepth();
|
||||
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "%d" ), w );
|
||||
m_SizeXValue->SetLabel(msg);
|
||||
msg.Printf( wxT( "%d" ), h );
|
||||
m_SizeYValue->SetLabel(msg);
|
||||
msg.Printf( wxT( "%d" ), nb );
|
||||
m_BPPValue->SetLabel(msg);
|
||||
// Determine image resolution in DPI (does not existing in all formats).
|
||||
// the resolution can be given in bit per inches or bit per cm in file
|
||||
m_imageDPI.x = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
m_imageDPI.y = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||
|
||||
if( m_imageDPI.x > 1 && m_imageDPI.y > 1 )
|
||||
{
|
||||
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_GreyscalePicturePanel->SetVirtualSize( w, h );
|
||||
|
@ -262,16 +321,55 @@ bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
|||
|
||||
m_Greyscale_Image.Destroy();
|
||||
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
||||
|
||||
if( m_rbOptions->GetSelection() > 0 )
|
||||
NegateGreyscaleImage( );
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( 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;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
|
@ -297,11 +395,12 @@ void BM2CMP_FRAME::Binarize( double aThreshold )
|
|||
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||
{
|
||||
unsigned char pix;
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
for( int x = 0; x < w; x++ )
|
||||
|
@ -321,58 +420,61 @@ void BM2CMP_FRAME::OnOptionsSelection( wxCommandEvent& event )
|
|||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
||||
{
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
||||
{
|
||||
int sel = m_radioBoxFormat->GetSelection();
|
||||
|
||||
switch( sel )
|
||||
{
|
||||
case 0:
|
||||
OnExportEeschema();
|
||||
break;
|
||||
case 0:
|
||||
OnExportEeschema();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
OnExportPcbnew( true );
|
||||
break;
|
||||
case 1:
|
||||
OnExportPcbnew( true );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
OnExportPcbnew( false );
|
||||
break;
|
||||
case 2:
|
||||
OnExportPcbnew( false );
|
||||
break;
|
||||
|
||||
case 3:
|
||||
OnExportPostScript();
|
||||
break;
|
||||
case 3:
|
||||
OnExportPostScript();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
OnExportLogo();
|
||||
break;
|
||||
case 4:
|
||||
OnExportLogo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportLogo()
|
||||
{
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
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,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = FileDlg.ShowModal();
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
@ -389,24 +491,26 @@ void BM2CMP_FRAME::OnExportLogo()
|
|||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportPostScript()
|
||||
{
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
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,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
@ -423,27 +527,29 @@ void BM2CMP_FRAME::OnExportPostScript()
|
|||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportEeschema()
|
||||
{
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
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,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == NULL )
|
||||
{
|
||||
|
@ -460,29 +566,29 @@ void BM2CMP_FRAME::OnExportEeschema()
|
|||
|
||||
void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||
{
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxString msg = aLegacyFormat ?
|
||||
_( "Footprint file (*.emp)|*.emp" ) :
|
||||
_( "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,
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == NULL )
|
||||
{
|
||||
|
@ -496,6 +602,7 @@ void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
|||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
||||
{
|
||||
// Create a potrace bitmap
|
||||
|
@ -514,40 +621,93 @@ void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
|||
/* fill the bitmap with data */
|
||||
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 );
|
||||
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>-----------------------------------------------------------------
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
// EDA_APP
|
||||
// main program
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace BMP2CMP {
|
||||
|
||||
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();
|
||||
SetTopWindow( frame );
|
||||
frame->Show( true );
|
||||
default:
|
||||
{
|
||||
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/
|
||||
//
|
||||
// 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 );
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
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->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextSizeX = new wxStaticText( m_panelRight, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextSizeX->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextSizeX, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_staticTextSize = new wxStaticText( m_panelRight, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextSize->Wrap( -1 );
|
||||
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->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALL|wxALIGN_CENTER_VERTICAL, 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 );
|
||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_SizeYValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
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_SizeYunits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeYunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_SizePixUnits = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizePixUnits->Wrap( -1 );
|
||||
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->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->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->Wrap( -1 );
|
||||
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 );
|
||||
|
||||
|
||||
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 );
|
||||
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") };
|
||||
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->SetSelection( 4 );
|
||||
brightSizer->Add( m_radioBoxFormat, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
m_radioBoxFormat->SetSelection( 2 );
|
||||
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
|
||||
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->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->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->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_GreyscalePicturePanel->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_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 );
|
||||
|
@ -143,6 +178,10 @@ BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
|||
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_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_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 );
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_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_microsoft_bom">0</property>
|
||||
<object class="Frame" expanded="1">
|
||||
|
@ -44,7 +46,7 @@
|
|||
<property name="pos"></property>
|
||||
<property name="size">527,470</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="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
|
@ -506,7 +508,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
|
@ -521,16 +523,16 @@
|
|||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">3</property>
|
||||
<property name="cols">4</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablecols">1,2</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgSizerInfo</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">3</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
|
@ -564,7 +566,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</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="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -572,7 +574,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></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_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -617,7 +619,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<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>
|
||||
|
@ -700,173 +702,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|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">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="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -949,7 +785,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<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>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -987,7 +823,339 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></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_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -1115,7 +1283,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<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>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1279,6 +1447,364 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</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>
|
||||
|
@ -1461,7 +1987,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1509,7 +2035,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">4</property>
|
||||
<property name="selection">2</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
|
@ -1551,7 +2077,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1641,7 +2167,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<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/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -11,6 +11,9 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class KIWAY_PLAYER;
|
||||
|
||||
#include "kiway_player.h"
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
|
@ -22,6 +25,7 @@
|
|||
#include <wx/icon.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
|
@ -37,7 +41,7 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class BM2CMP_FRAME_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class BM2CMP_FRAME_BASE : public wxFrame
|
||||
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -47,15 +51,21 @@ class BM2CMP_FRAME_BASE : public wxFrame
|
|||
wxScrolledWindow* m_GreyscalePicturePanel;
|
||||
wxScrolledWindow* m_BNPicturePanel;
|
||||
wxPanel* m_panelRight;
|
||||
wxStaticText* m_staticTextSizeX;
|
||||
wxStaticText* m_staticTextSize;
|
||||
wxStaticText* m_SizeXValue;
|
||||
wxStaticText* m_SizeXunits;
|
||||
wxStaticText* m_staticTextSizeY;
|
||||
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_BPPValue;
|
||||
wxStaticText* m_BPPunits;
|
||||
wxStaticText* m_staticTextBPI;
|
||||
wxTextCtrl* m_DPIValueX;
|
||||
wxTextCtrl* m_DPIValueY;
|
||||
wxStaticText* m_DPI_Units;
|
||||
wxButton* m_buttonLoad;
|
||||
wxButton* m_buttonExport;
|
||||
wxRadioBox* m_radioBoxFormat;
|
||||
|
@ -66,6 +76,9 @@ class BM2CMP_FRAME_BASE : public wxFrame
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
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 OnExport( 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_state_t* st;
|
||||
|
||||
|
||||
// set tracing parameters, starting from defaults
|
||||
param = potrace_param_default();
|
||||
if( !param )
|
||||
|
@ -171,8 +171,8 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo
|
|||
{
|
||||
case 4:
|
||||
info.m_Format = KICAD_LOGO;
|
||||
info.m_ScaleX = 1e3 * 25.4 / 300; // the conversion scale from PPI to micro
|
||||
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom
|
||||
info.m_ScaleX = 1e3 * 25.4 / aDpi_X; // the conversion scale from PPI to micro
|
||||
info.m_ScaleY = 1e3 * 25.4 / aDpi_Y; // Y axis is top to bottom
|
||||
info.CreateOutputFile();
|
||||
break;
|
||||
|
||||
|
@ -186,22 +186,22 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo
|
|||
|
||||
case 2:
|
||||
info.m_Format = EESCHEMA_FMT;
|
||||
info.m_ScaleX = 1000.0 / 300; // 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_ScaleX = 1000.0 / aDpi_X; // the conversion scale from PPI to UI
|
||||
info.m_ScaleY = -1000.0 / aDpi_Y; // Y axis is bottom to Top for components in libs
|
||||
info.CreateOutputFile();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
info.m_Format = PCBNEW_KICAD_MOD;
|
||||
info.m_ScaleX = 1e6 * 25.4 / 300; // the conversion scale from PPI to UI
|
||||
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
|
||||
info.m_ScaleX = 1e6 * 25.4 / aDpi_X; // the conversion scale from PPI to UI
|
||||
info.m_ScaleY = 1e6 * 25.4 / aDpi_Y; // Y axis is top to bottom in modedit
|
||||
info.CreateOutputFile();
|
||||
break;
|
||||
|
||||
case 0:
|
||||
info.m_Format = PCBNEW_LEGACY_EMP;
|
||||
info.m_ScaleX = 10000.0 / 300; // the conversion scale
|
||||
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
|
||||
info.m_ScaleX = 10000.0 / aDpi_X; // the conversion scale
|
||||
info.m_ScaleY = 10000.0 / aDpi_Y; // Y axis is top to bottom in modedit
|
||||
info.CreateOutputFile();
|
||||
break;
|
||||
|
||||
|
|
|
@ -66,6 +66,48 @@ if( WIN32 AND MSYS )
|
|||
add_definitions( -DGLEW_STATIC )
|
||||
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
|
||||
dialog_about/AboutDialog_main.cpp
|
||||
dialog_about/dialog_about.cpp
|
||||
|
@ -93,11 +135,13 @@ set( COMMON_PAGE_LAYOUT_SRCS
|
|||
)
|
||||
|
||||
set( COMMON_SRCS
|
||||
${LIB_KICAD_SRCS}
|
||||
${COMMON_ABOUT_DLG_SRCS}
|
||||
${COMMON_PAGE_LAYOUT_SRCS}
|
||||
base_struct.cpp
|
||||
basicframe.cpp
|
||||
bezier_curves.cpp
|
||||
bin_mod.cpp
|
||||
bitmap.cpp
|
||||
block_commande.cpp
|
||||
build_version.cpp
|
||||
|
@ -107,6 +151,7 @@ set( COMMON_SRCS
|
|||
class_marker_base.cpp
|
||||
class_plotter.cpp
|
||||
class_undoredo_container.cpp
|
||||
colors.cpp
|
||||
common.cpp
|
||||
common_plot_functions.cpp
|
||||
common_plotHPGL_functions.cpp
|
||||
|
@ -115,13 +160,13 @@ set( COMMON_SRCS
|
|||
common_plotGERBER_functions.cpp
|
||||
common_plotDXF_functions.cpp
|
||||
common_plotSVG_functions.cpp
|
||||
config_params.cpp
|
||||
confirm.cpp
|
||||
copy_to_clipboard.cpp
|
||||
dialog_shim.cpp
|
||||
displlst.cpp
|
||||
dlist.cpp
|
||||
drawframe.cpp
|
||||
drawpanel.cpp
|
||||
draw_frame.cpp
|
||||
draw_panel.cpp
|
||||
drawtxt.cpp
|
||||
dsnlexer.cpp
|
||||
eda_dde.cpp
|
||||
|
@ -134,16 +179,19 @@ set( COMMON_SRCS
|
|||
hotkeys_basic.cpp
|
||||
hotkey_grid_table.cpp
|
||||
html_messagebox.cpp
|
||||
kiface_i.cpp
|
||||
kiway.cpp
|
||||
kiway_holder.cpp
|
||||
msgpanel.cpp
|
||||
netlist_keywords.cpp
|
||||
newstroke_font.cpp
|
||||
projet_config.cpp
|
||||
project.cpp
|
||||
ptree.cpp
|
||||
reporter.cpp
|
||||
richio.cpp
|
||||
search_stack.cpp
|
||||
selcolor.cpp
|
||||
string.cpp
|
||||
systemdirsappend.cpp
|
||||
trigo.cpp
|
||||
utf8.cpp
|
||||
wildcards_and_files_ext.cpp
|
||||
|
@ -153,9 +201,11 @@ set( COMMON_SRCS
|
|||
zoom.cpp
|
||||
)
|
||||
|
||||
# We will not want edaappl.cpp linked into the KIFACE, only into the KIWAY.
|
||||
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()
|
||||
|
||||
if( NOT HAVE_STRTOKR )
|
||||
|
@ -184,11 +234,10 @@ set( COMMON_SRCS
|
|||
geometry/shape_collisions.cpp
|
||||
geometry/shape_index.cpp
|
||||
)
|
||||
|
||||
|
||||
add_library( common STATIC ${COMMON_SRCS} )
|
||||
add_dependencies( common lib-dependencies )
|
||||
|
||||
|
||||
set( PCB_COMMON_SRCS
|
||||
base_screen.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
|
||||
* 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 );
|
||||
|
||||
|
@ -257,7 +257,7 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
|
|||
|
||||
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
|
||||
{
|
||||
wxString msg = ReturnStringFromValue( g_UserUnit, aValue );
|
||||
wxString msg = StringFromValue( g_UserUnit, aValue );
|
||||
|
||||
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 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;
|
||||
|
||||
value = ReturnValueFromString( g_UserUnit, aTextValue);
|
||||
value = ValueFromString( g_UserUnit, aTextValue);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr )
|
||||
int ValueFromTextCtrl( const wxTextCtrl& aTextCtr )
|
||||
{
|
||||
int value;
|
||||
wxString msg = aTextCtr.GetValue();
|
||||
|
||||
value = ReturnValueFromString( g_UserUnit, msg );
|
||||
value = ValueFromString( g_UserUnit, msg );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
|
||||
#include <build_version.h>
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <online_help.h>
|
||||
#include <id.h>
|
||||
#include <eda_doc.h>
|
||||
|
@ -61,11 +62,9 @@ static const wxChar entryPerspective[] = wxT( "Perspective" );
|
|||
|
||||
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aFrameType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName ) :
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName ) :
|
||||
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
|
||||
{
|
||||
wxSize minsize;
|
||||
|
@ -108,7 +107,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
|
|||
|
||||
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.
|
||||
}
|
||||
|
@ -116,9 +115,6 @@ void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
|||
|
||||
EDA_BASE_FRAME::~EDA_BASE_FRAME()
|
||||
{
|
||||
if( wxGetApp().GetHtmlHelpController() )
|
||||
wxGetApp().SetHtmlHelpController( NULL );
|
||||
|
||||
delete m_autoSaveTimer;
|
||||
|
||||
// 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();
|
||||
|
||||
wxGetApp().SetLanguageIdentifier( id );
|
||||
wxGetApp().SetLanguage();
|
||||
Pgm().SetLanguageIdentifier( id );
|
||||
Pgm().SetLanguage();
|
||||
ReCreateMenuBar();
|
||||
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;
|
||||
|
||||
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" );
|
||||
config->Read( text, &m_FramePos.x );
|
||||
|
||||
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 );
|
||||
}
|
||||
text = m_FrameName + entryAutoSaveInterval;
|
||||
aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
|
||||
}
|
||||
|
||||
// Ensure Window title bar is visible
|
||||
#if defined( __WXMAC__ )
|
||||
// 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 = 20;
|
||||
// Ypos_min = GetMBarHeight(); seems no more exist in new API (subject to change)
|
||||
int Ypos_min = 20;
|
||||
#else
|
||||
Ypos_min = 0;
|
||||
int Ypos_min = 0;
|
||||
#endif
|
||||
if( m_FramePos.y < Ypos_min )
|
||||
m_FramePos.y = Ypos_min;
|
||||
|
@ -229,44 +216,39 @@ void EDA_BASE_FRAME::LoadSettings()
|
|||
if( maximized )
|
||||
Maximize();
|
||||
|
||||
// Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
|
||||
// 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 );
|
||||
aCfg->Read( m_FrameName + entryPerspective, &m_perspective );
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::SaveSettings()
|
||||
void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||
{
|
||||
wxString text;
|
||||
wxConfig* config = wxGetApp().GetSettings();
|
||||
wxString text;
|
||||
|
||||
if( !config || IsIconized() )
|
||||
if( IsIconized() )
|
||||
return;
|
||||
|
||||
m_FrameSize = GetSize();
|
||||
m_FramePos = GetPosition();
|
||||
|
||||
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" );
|
||||
config->Write( text, (long) m_FramePos.y );
|
||||
aCfg->Write( text, (long) m_FramePos.y );
|
||||
|
||||
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" );
|
||||
config->Write( text, (long) m_FrameSize.y );
|
||||
aCfg->Write( text, (long) m_FrameSize.y );
|
||||
|
||||
text = m_FrameName + wxT( "Maximized" );
|
||||
config->Write( text, IsMaximized() );
|
||||
aCfg->Write( text, IsMaximized() );
|
||||
|
||||
if( m_hasAutoSave )
|
||||
{
|
||||
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
|
||||
|
@ -276,8 +258,16 @@ void EDA_BASE_FRAME::SaveSettings()
|
|||
|
||||
// printf( "perspective(%s): %s\n",
|
||||
// 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,
|
||||
wxFileHistory * aFileHistory )
|
||||
wxFileHistory* aFileHistory )
|
||||
{
|
||||
wxFileHistory* fileHistory = aFileHistory;
|
||||
|
||||
if( fileHistory == NULL )
|
||||
fileHistory = & wxGetApp().GetFileHistory();
|
||||
if( !fileHistory )
|
||||
fileHistory = &Kiface().GetFileHistory();
|
||||
|
||||
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,
|
||||
wxFileHistory* aFileHistory )
|
||||
{
|
||||
wxString fn, msg;
|
||||
size_t i;
|
||||
wxFileHistory* fileHistory = aFileHistory;
|
||||
|
||||
if( fileHistory == NULL )
|
||||
fileHistory = & wxGetApp().GetFileHistory();
|
||||
if( !fileHistory )
|
||||
fileHistory = &Kiface().GetFileHistory();
|
||||
|
||||
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() )
|
||||
{
|
||||
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 );
|
||||
|
||||
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,
|
||||
* or the the full specific doc
|
||||
* 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
|
||||
*/
|
||||
if( event.GetId() == wxID_INDEX )
|
||||
{
|
||||
// Temporary change the help filename
|
||||
wxString tmp = wxGetApp().GetHelpFileName();
|
||||
// Temporarily change the help filename
|
||||
wxString tmp = Kiface().GetHelpFileName();
|
||||
|
||||
// Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
|
||||
wxGetApp().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) );
|
||||
wxString helpFile = wxGetApp().GetHelpFile();
|
||||
Kiface().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) );
|
||||
wxString helpFile = Kiface().GetHelpFile();
|
||||
|
||||
if( !helpFile )
|
||||
{ // Try to find "Getting_Started_in_KiCad.pdf"
|
||||
wxGetApp().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
|
||||
helpFile = wxGetApp().GetHelpFile();
|
||||
Kiface().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
|
||||
helpFile = Kiface().GetHelpFile();
|
||||
}
|
||||
|
||||
if( !helpFile )
|
||||
{
|
||||
msg.Printf( _( "Help file %s could not be found." ),
|
||||
GetChars( wxGetApp().GetHelpFileName() ) );
|
||||
GetChars( Kiface().GetHelpFileName() ) );
|
||||
wxMessageBox( msg );
|
||||
}
|
||||
else
|
||||
|
@ -368,36 +361,36 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
|
|||
GetAssociatedDocument( this, helpFile );
|
||||
}
|
||||
|
||||
wxGetApp().SetHelpFileName( tmp );
|
||||
Kiface().SetHelpFileName( tmp );
|
||||
return;
|
||||
}
|
||||
|
||||
#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();
|
||||
wxGetApp().GetHtmlHelpController()->Display( wxGetApp().GetHelpFileName() );
|
||||
Kiface().GetHtmlHelpController()->DisplayContents();
|
||||
Kiface().GetHtmlHelpController()->Display( Kiface().GetHelpFileName() );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
|
||||
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
||||
wxString helpFile = wxGetApp().GetHelpFile();
|
||||
wxString helpFile = Kiface().GetHelpFile();
|
||||
|
||||
if( !helpFile )
|
||||
{
|
||||
msg.Printf( _( "Help file %s could not be found." ),
|
||||
GetChars( wxGetApp().GetHelpFileName() ) );
|
||||
GetChars( Kiface().GetHelpFileName() ) );
|
||||
wxMessageBox( msg );
|
||||
}
|
||||
else
|
||||
|
@ -413,8 +406,8 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
|
|||
|
||||
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn = wxGetApp().GetEditorName();
|
||||
wxString wildcard( wxT( "*" ) );
|
||||
wxFileName fn = Pgm().GetEditorName();
|
||||
wxString wildcard( wxT( "*" ) );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
wildcard += wxT( ".exe" );
|
||||
|
@ -430,18 +423,16 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
|
|||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
wxASSERT( wxGetApp().GetCommonSettings() );
|
||||
wxString editor = dlg.GetPath();
|
||||
|
||||
wxConfig* cfg = wxGetApp().GetCommonSettings();
|
||||
wxGetApp().SetEditorName( dlg.GetPath() );
|
||||
cfg->Write( wxT( "Editor" ), wxGetApp().GetEditorName() );
|
||||
Pgm().SetEditorName( editor );
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::GetKicadAbout( wxCommandEvent& event )
|
||||
{
|
||||
bool ShowAboutDialog(wxWindow * parent);
|
||||
ShowAboutDialog(this);
|
||||
ShowAboutDialog( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -535,7 +526,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
|
|||
wxString tmp;
|
||||
wxPlatformInfo info;
|
||||
|
||||
tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" );
|
||||
tmp = wxT( "Application: " ) + Pgm().App().GetAppName() + wxT( "\n" );
|
||||
tmp << wxT( "Version: " ) << GetBuildVersion()
|
||||
#ifdef DEBUG
|
||||
<< wxT( " Debug" )
|
||||
|
@ -666,14 +657,14 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName,
|
|||
if( !autoSaveFileName.FileExists() )
|
||||
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 \
|
||||
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 );
|
||||
int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
|
||||
|
||||
// Make a backup of the current file, delete the file, and rename the auto save file to
|
||||
// the file name.
|
||||
|
@ -703,7 +694,7 @@ edits you made?" ),
|
|||
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
|
||||
{
|
||||
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
|
||||
|
@ -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 )
|
||||
{
|
||||
// Disable all other windows
|
||||
#if wxCHECK_VERSION(2, 9, 4)
|
||||
if ( IsTopLevel() )
|
||||
if( IsTopLevel() )
|
||||
{
|
||||
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||
while (node)
|
||||
|
||||
while( node )
|
||||
{
|
||||
wxWindow *win = node->GetData();
|
||||
if (win != this)
|
||||
win->Enable(!aModal);
|
||||
wxWindow* win = node->GetData();
|
||||
|
||||
if( win != this )
|
||||
win->Enable( !aModal );
|
||||
|
||||
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 <gr_basic.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <common.h>
|
||||
#include <macros.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;
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* some countries use 1,5 and others (and C) 1.5
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <base_struct.h>
|
||||
|
|
|
@ -211,34 +211,34 @@ void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt)
|
|||
putc( '(', fout );
|
||||
for( unsigned i = 0; i < txt.length(); i++ )
|
||||
{
|
||||
// Lazyness made me use stdio buffering yet another time...
|
||||
wchar_t ch = txt[i];
|
||||
if( ch < 256 )
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
// The ~ shouldn't reach the outside
|
||||
case '~':
|
||||
break;
|
||||
// These characters must be escaped
|
||||
case '(':
|
||||
case ')':
|
||||
case '\\':
|
||||
putc( '\\', fout );
|
||||
// Lazyness made me use stdio buffering yet another time...
|
||||
wchar_t ch = txt[i];
|
||||
if( ch < 256 )
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
// The ~ shouldn't reach the outside
|
||||
case '~':
|
||||
break;
|
||||
// These characters must be escaped
|
||||
case '(':
|
||||
case ')':
|
||||
case '\\':
|
||||
putc( '\\', fout );
|
||||
|
||||
// FALLTHRU
|
||||
default:
|
||||
putc( ch, fout );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// FALLTHRU
|
||||
default:
|
||||
putc( ch, fout );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
* using postscript metrics for the Helvetica font (optionally used for
|
||||
* 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,
|
||||
double aScale, bool aMirror )
|
||||
double aScale, bool aMirror )
|
||||
{
|
||||
wxASSERT( !outputFile );
|
||||
m_plotMirror = aMirror;
|
||||
|
@ -354,31 +354,31 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
|
|||
switch( aH_justify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
dx = -tw / 2;
|
||||
break;
|
||||
dx = -tw / 2;
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
dx = -tw;
|
||||
break;
|
||||
dx = -tw;
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_LEFT:
|
||||
dx = 0;
|
||||
break;
|
||||
dx = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( aV_justify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
dy = th / 2;
|
||||
break;
|
||||
dy = th / 2;
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_TOP:
|
||||
dy = th;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
dy = 0;
|
||||
break;
|
||||
dy = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
RotatePoint( &dx, &dy, aOrient );
|
||||
|
@ -620,7 +620,7 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
}
|
||||
if( penState != plume || pos != penLastpos )
|
||||
{
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
fprintf( outputFile, "%g %g %sto\n",
|
||||
pos_dev.x, pos_dev.y,
|
||||
( plume=='D' ) ? "line" : "move" );
|
||||
|
@ -650,39 +650,39 @@ bool PS_PLOTTER::StartPlot()
|
|||
|
||||
static const char* PSMacro[] =
|
||||
{
|
||||
"%%BeginProlog\n"
|
||||
"/line { newpath moveto lineto 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",
|
||||
"/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
||||
"/arc0 { newpath arc stroke } bind def\n",
|
||||
"/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
||||
" grestore stroke } bind def\n",
|
||||
"/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
||||
" grestore stroke } bind def\n",
|
||||
"/poly0 { stroke } bind def\n",
|
||||
"/poly1 { closepath gsave fill grestore stroke } bind def\n",
|
||||
"/poly2 { closepath gsave fill grestore stroke } bind def\n",
|
||||
"/rect0 { rectstroke } bind def\n",
|
||||
"/rect1 { rectfill } bind def\n",
|
||||
"/rect2 { rectfill } bind def\n",
|
||||
"/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
|
||||
"/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
|
||||
"/dashedline { [200] 100 setdash } bind def\n",
|
||||
"/solidline { [] 0 setdash } bind def\n",
|
||||
"%%BeginProlog\n"
|
||||
"/line { newpath moveto lineto 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",
|
||||
"/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
||||
"/arc0 { newpath arc stroke } bind def\n",
|
||||
"/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
||||
" grestore stroke } bind def\n",
|
||||
"/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
||||
" grestore stroke } bind def\n",
|
||||
"/poly0 { stroke } bind def\n",
|
||||
"/poly1 { closepath gsave fill grestore stroke } bind def\n",
|
||||
"/poly2 { closepath gsave fill grestore stroke } bind def\n",
|
||||
"/rect0 { rectstroke } bind def\n",
|
||||
"/rect1 { rectfill } bind def\n",
|
||||
"/rect2 { rectfill } bind def\n",
|
||||
"/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
|
||||
"/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
|
||||
"/dashedline { [200] 100 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",
|
||||
" /KicadFont findfont 0.000001 scalefont setfont\n",
|
||||
" show } bind def\n",
|
||||
" show } bind def\n",
|
||||
|
||||
// This is for regular postscript text
|
||||
"/textshow { gsave\n",
|
||||
" findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
|
||||
" } bind def\n",
|
||||
|
||||
// Utility for getting Latin1 encoded fonts
|
||||
"/reencodefont {\n",
|
||||
// Utility for getting Latin1 encoded fonts
|
||||
"/reencodefont {\n",
|
||||
" findfont dup length dict begin\n",
|
||||
" { 1 index /FID ne\n",
|
||||
" { def }\n",
|
||||
|
@ -692,13 +692,13 @@ bool PS_PLOTTER::StartPlot()
|
|||
" currentdict\n",
|
||||
" end } bind def\n"
|
||||
|
||||
// Remap AdobeStandard fonts to Latin1
|
||||
"/KicadFont /Helvetica reencodefont definefont pop\n",
|
||||
"/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
|
||||
"/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
|
||||
"/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
|
||||
"%%EndProlog\n",
|
||||
NULL
|
||||
// Remap AdobeStandard fonts to Latin1
|
||||
"/KicadFont /Helvetica reencodefont definefont pop\n",
|
||||
"/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
|
||||
"/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
|
||||
"/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
|
||||
"%%EndProlog\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
time_t time1970 = time( NULL );
|
||||
|
@ -726,8 +726,8 @@ bool PS_PLOTTER::StartPlot()
|
|||
psPaperSize.Set( pageInfo.GetHeightMils(), pageInfo.GetWidthMils() );
|
||||
|
||||
fprintf( outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
|
||||
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
|
||||
(int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
|
||||
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
|
||||
(int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
|
||||
|
||||
// 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,
|
||||
|
@ -775,9 +775,9 @@ bool PS_PLOTTER::StartPlot()
|
|||
// within the Document Structuring Convention.
|
||||
fputs( "%%Page: 1 1\n"
|
||||
"%%BeginPageSetup\n"
|
||||
"gsave\n"
|
||||
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
||||
"linemode1\n", outputFile );
|
||||
"gsave\n"
|
||||
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
||||
"linemode1\n", outputFile );
|
||||
|
||||
|
||||
// Rototranslate the coordinate to achieve the landscape layout
|
||||
|
@ -803,7 +803,7 @@ bool PS_PLOTTER::EndPlot()
|
|||
wxASSERT( outputFile );
|
||||
fputs( "showpage\n"
|
||||
"grestore\n"
|
||||
"%%EOF\n", outputFile );
|
||||
"%%EOF\n", outputFile );
|
||||
fclose( outputFile );
|
||||
outputFile = NULL;
|
||||
|
||||
|
@ -813,15 +813,15 @@ bool PS_PLOTTER::EndPlot()
|
|||
|
||||
|
||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||
enum EDA_COLOR_T aColor,
|
||||
const wxString& aText,
|
||||
double aOrient,
|
||||
const wxSize& aSize,
|
||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
enum EDA_COLOR_T aColor,
|
||||
const wxString& aText,
|
||||
double aOrient,
|
||||
const wxSize& aSize,
|
||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
{
|
||||
SetCurrentLineWidth( aWidth );
|
||||
SetColor( aColor );
|
||||
|
@ -874,7 +874,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
|||
if( m_textMode == PLOTTEXTMODE_PHANTOM )
|
||||
{
|
||||
fputsPostscriptString( outputFile, aText );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
fprintf( outputFile, " %g %g phantomshow\n",
|
||||
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 <gr_basic.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <wxstruct.h>
|
||||
#include <param_config.h>
|
||||
#include <config_params.h>
|
||||
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
@ -19,8 +40,89 @@
|
|||
#include <boost/foreach.hpp>
|
||||
|
||||
|
||||
#define CONFIG_VERSION 1
|
||||
#define FORCE_LOCAL_CONFIG true
|
||||
void wxConfigSaveParams( 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;
|
||||
|
||||
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 )
|
||||
|
@ -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,
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
// 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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) );
|
||||
|
||||
if( itmp == UNSPECIFIED_COLOR )
|
||||
|
@ -395,7 +284,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
|
|||
|
||||
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
double dtmp = m_Default;
|
||||
|
@ -448,7 +337,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
|
|||
|
||||
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
// 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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
*m_Pt_param = aConfig->Read( m_Ident, m_default );
|
||||
}
|
||||
|
||||
|
||||
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
aConfig->Write( m_Ident, *m_Pt_param );
|
||||
}
|
||||
|
||||
|
||||
|
||||
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
|
||||
wxString* ptparam,
|
||||
const wxChar* group ) :
|
||||
|
@ -551,7 +440,7 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
|
|||
|
||||
void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_Pt_param == NULL || aConfig == NULL )
|
||||
if( !m_Pt_param || !aConfig )
|
||||
return;
|
||||
|
||||
wxArrayString* libname_list = m_Pt_param;
|
||||
|
||||
unsigned indexlib = 0;
|
||||
wxString configkey;
|
||||
wxString libname;
|
||||
|
||||
for( ; indexlib < libname_list->GetCount(); indexlib++ )
|
||||
for( unsigned indexlib = 0; indexlib < libname_list->GetCount(); indexlib++ )
|
||||
{
|
||||
configkey = m_Ident;
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
#include <class_drawpanel.h>
|
||||
#include <class_base_screen.h>
|
||||
#include <confirm.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
|
||||
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <wxstruct.h>
|
||||
#include <common.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <build_version.h>
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ static wxString HtmlNewline( const unsigned int amount = 1 );
|
|||
static void InitKiCadAboutNew( AboutAppInfo& info )
|
||||
{
|
||||
// Set application specific icon
|
||||
const wxTopLevelWindow * const tlw = wxDynamicCast(::wxGetApp().GetTopWindow(), wxTopLevelWindow);
|
||||
const wxTopLevelWindow* const tlw = wxDynamicCast( Pgm().App().GetTopWindow(), wxTopLevelWindow);
|
||||
|
||||
if( tlw )
|
||||
info.SetIcon( tlw->GetIcon() );
|
||||
|
@ -56,10 +56,10 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
|
|||
}
|
||||
|
||||
/* Set title */
|
||||
info.SetAppName( wxT( ".: " ) + wxGetApp().GetTitle() + wxT( " :." ) );
|
||||
info.SetAppName( wxT( ".: " ) + Pgm().App().GetAppName() + wxT( " :." ) );
|
||||
|
||||
/* Copyright information */
|
||||
info.SetCopyright( wxT( "(C) 1992-2013 KiCad Developers Team" ) );
|
||||
info.SetCopyright( wxT( "(C) 1992-2014 KiCad Developers Team" ) );
|
||||
|
||||
/* KiCad build version */
|
||||
wxString version;
|
||||
|
|
|
@ -24,12 +24,22 @@
|
|||
*/
|
||||
|
||||
#include <dialog_shim.h>
|
||||
|
||||
#include <kiway_player.h>
|
||||
|
||||
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
|
||||
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
|
||||
Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) );
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <dialog_get_component.h>
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.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" ),
|
||||
_( "Select a key" ), C_COUNT, choices, this );
|
||||
int key = ReturnKeyCodeFromKeyName( keyname );
|
||||
int key = KeyCodeFromKeyName( keyname );
|
||||
|
||||
if( key == 0 )
|
||||
return;
|
||||
|
@ -251,7 +251,7 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
|
|||
#endif
|
||||
// See if this key code is handled in hotkeys names list
|
||||
bool exists;
|
||||
ReturnKeyNameFromKeyCode( key, &exists );
|
||||
KeyNameFromKeyCode( key, &exists );
|
||||
|
||||
if( !exists ) // not handled, see hotkeys_basic.cpp
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <base_struct.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_title_block.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <worksheet_shape_builder.h>
|
||||
#include <class_base_screen.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <kicad_string.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <gr_basic.h>
|
||||
#include <common.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -38,7 +39,7 @@
|
|||
#include <class_drawpanel_gal.h>
|
||||
#include <class_base_screen.h>
|
||||
#include <msgpanel.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <confirm.h>
|
||||
#include <kicad_device_context.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
@ -89,12 +90,12 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
|
|||
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,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize,
|
||||
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_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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
if ( cfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
|
||||
if( aCfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
|
||||
SetGridVisibility( btmp );
|
||||
|
||||
int itmp;
|
||||
|
||||
if( cfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
|
||||
if( aCfg->Read( m_FrameName + GridColorEntryKeyword, &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
|
||||
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();
|
||||
|
||||
EDA_BASE_FRAME::SaveSettings();
|
||||
cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
|
||||
cfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
|
||||
cfg->Write( m_FrameName + GridColorEntryKeyword, ( long ) GetGridColor() );
|
||||
cfg->Write( m_FrameName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
|
||||
aCfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
|
||||
aCfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
|
||||
aCfg->Write( m_FrameName + GridColorEntryKeyword, ( long ) GetGridColor() );
|
||||
aCfg->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 ) )
|
||||
return false;
|
||||
|
||||
Block->SetCommand( (BLOCK_COMMAND_T) ReturnBlockCommand( aKey ) );
|
||||
Block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
|
||||
|
||||
if( Block->GetCommand() == 0 )
|
||||
return false;
|
|
@ -28,7 +28,8 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <gr_basic.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
|
@ -36,7 +37,7 @@
|
|||
#include <class_drawpanel.h>
|
||||
#include <class_drawpanel_gal.h>
|
||||
#include <class_base_screen.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.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
|
||||
|
||||
// keys to store options in config:
|
||||
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
|
||||
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
|
||||
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
|
||||
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
|
||||
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
|
||||
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
|
||||
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
|
||||
#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.
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -122,12 +124,14 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
|||
m_mouseCaptureCallback = NULL;
|
||||
m_endMouseCaptureCallback = NULL;
|
||||
|
||||
if( wxGetApp().GetSettings() )
|
||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
wxGetApp().GetSettings()->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false );
|
||||
wxGetApp().GetSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
|
||||
wxGetApp().GetSettings()->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
|
||||
wxGetApp().GetSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
|
||||
cfg->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false );
|
||||
cfg->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
|
||||
cfg->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
|
||||
cfg->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
wxGetApp().GetSettings()->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
|
||||
wxGetApp().GetSettings()->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
|
||||
wxGetApp().GetSettings()->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
|
||||
wxGetApp().GetSettings()->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan );
|
||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
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 char_count = aText.length();
|
||||
|
@ -315,7 +315,7 @@ void DrawGraphicText( EDA_RECT* aClipBox,
|
|||
|
||||
current_char_pos = aPos;
|
||||
|
||||
dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth );
|
||||
dx = GraphicTextWidth( aText, size_h, aItalic, aWidth );
|
||||
dy = size_v;
|
||||
|
||||
/* Do not draw the text if out of draw area! */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <eda_dde.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <id.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
|
@ -14,23 +14,25 @@
|
|||
#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;
|
||||
m_commonSettings->Read( wxT( "UseSystemBrowser" ), &tmp, 0 );
|
||||
m_useSystemPdfBrowser = tmp != 0;
|
||||
m_common_settings->Read( wxT( "UseSystemBrowser" ), &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_commonSettings->Write( wxT( "UseSystemBrowser" ), m_useSystemPdfBrowser );
|
||||
m_common_settings->Write( wxT( "PdfBrowserName" ), GetPdfBrowserName() );
|
||||
m_common_settings->Write( wxT( "UseSystemBrowser" ), m_use_system_pdf_browser );
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,7 +128,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
|||
|
||||
if( !wxFileExists( fullfilename ) )
|
||||
{
|
||||
msg.Printf( _( "Doc File <%s> not found" ), GetChars( aDocName ) );
|
||||
msg.Printf( _( "Doc File '%s' not found" ), GetChars( aDocName ) );
|
||||
DisplayError( aFrame, msg );
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ EDA_TEXT::~EDA_TEXT()
|
|||
|
||||
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 <common.h>
|
||||
#include <macros.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <footprint_info.h>
|
||||
#include <io_mgr.h>
|
||||
|
|
|
@ -24,13 +24,16 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <wx/config.h> // wxExpandEnvVars()
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <appl_wxstruct.h>
|
||||
//#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <search_stack.h>
|
||||
#include <pcb_netlist.h>
|
||||
#include <reporter.h>
|
||||
#include <footprint_info.h>
|
||||
|
@ -43,20 +46,7 @@
|
|||
using namespace FP_LIB_TABLE_T;
|
||||
|
||||
|
||||
/**
|
||||
* 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" ) );
|
||||
static const wxChar global_tbl_name[] = wxT( "fp-lib-table" );
|
||||
|
||||
|
||||
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
|
||||
|
||||
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 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 )
|
||||
bool FP_LIB_TABLE::ConvertFromLegacy( SEARCH_STACK& aSStack, NETLIST& aNetList,
|
||||
const wxArrayString& aLibNames, REPORTER* aReporter ) throw( IO_ERROR )
|
||||
{
|
||||
wxString msg;
|
||||
FPID lastFPID;
|
||||
|
@ -720,7 +672,6 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
|||
aNetList.SortByFPID();
|
||||
|
||||
wxString libPath;
|
||||
wxFileName fn;
|
||||
|
||||
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++ )
|
||||
{
|
||||
fn = wxFileName( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
|
||||
wxFileName fn( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
|
||||
|
||||
libPath = wxGetApp().FindLibraryPath( fn );
|
||||
libPath = aSStack.FindValidPath( fn );
|
||||
|
||||
if( !libPath )
|
||||
{
|
||||
|
@ -766,7 +717,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
|||
}
|
||||
}
|
||||
|
||||
if( module == NULL )
|
||||
if( !module )
|
||||
{
|
||||
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
|
||||
// longer valid.
|
||||
FPID emptyFPID;
|
||||
|
||||
component->SetFPID( emptyFPID );
|
||||
retv = false;
|
||||
continue;
|
||||
|
@ -800,7 +752,9 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
|||
|
||||
if( wxFileName::GetPathSeparator() == wxChar( '\\' )
|
||||
&& uri.Find( wxChar( '/' ) ) >= 0 )
|
||||
{
|
||||
uri.Replace( wxT( "/"), wxT( "\\" ) );
|
||||
}
|
||||
#ifdef __WINDOWS__
|
||||
if( uri.CmpNoCase( libPath ) )
|
||||
#else
|
||||
|
@ -818,7 +772,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
|||
{
|
||||
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" ),
|
||||
GetChars( component->GetReference() ),
|
||||
GetChars( component->GetFPID().Format() ) );
|
||||
|
@ -836,7 +790,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
|||
{
|
||||
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( newFPID.Format() ) );
|
||||
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()
|
||||
{
|
||||
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();
|
||||
return wxT( "KISYSMOD" );
|
||||
}
|
||||
|
||||
|
||||
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
|
||||
{
|
||||
bool tableExists = true;
|
||||
wxFileName fn = GetGlobalTableFileName();
|
||||
bool tableExists = true;
|
||||
wxFileName fn = GetGlobalTableFileName();
|
||||
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
|
@ -927,21 +832,22 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS
|
|||
GetChars( fn.GetPath() ) ) );
|
||||
}
|
||||
|
||||
// Attempt to copy the default global file table from the KiCad template folder to
|
||||
// the users home configuration path.
|
||||
wxString fileName = wxGetApp().FindLibraryPath( defaultFileName );
|
||||
// Attempt to copy the default global file table from the KiCad
|
||||
// template folder to the user's home configuration path.
|
||||
wxString fileName = Kiface().KifaceSearch().FindValidPath( global_tbl_name );
|
||||
|
||||
// The fallback is to create an empty global footprint table for the user to populate.
|
||||
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
|
||||
{
|
||||
FP_LIB_TABLE emptyTable;
|
||||
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
||||
FP_LIB_TABLE emptyTable;
|
||||
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
||||
|
||||
emptyTable.Format( &sf, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LINE_READER reader( fn.GetFullPath() );
|
||||
FP_LIB_TABLE_LEXER lexer( &reader );
|
||||
FILE_LINE_READER reader( fn.GetFullPath() );
|
||||
FP_LIB_TABLE_LEXER lexer( &reader );
|
||||
|
||||
aTable.Parse( &lexer );
|
||||
return tableExists;
|
||||
|
@ -952,38 +858,38 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
|
|||
{
|
||||
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() );
|
||||
|
||||
#if defined( __WINDOWS__ )
|
||||
fn.AppendDir( wxT( "kicad" ) );
|
||||
#endif
|
||||
|
||||
fn.SetName( GetFileName() );
|
||||
|
||||
wxLogTrace( traceFpLibTable, wxT( "Global footprint library table file '%s'." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
fn.SetName( global_tbl_name );
|
||||
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
||||
// prefer wxString filename so it can be seen in a debugger easier than wxFileName.
|
||||
|
||||
const wxString& FP_LIB_TABLE::GetFileName()
|
||||
{
|
||||
return defaultFileName;
|
||||
}
|
||||
|
||||
|
||||
void FP_LIB_TABLE::Load( const wxFileName& aFileName, FP_LIB_TABLE* aFallBackTable )
|
||||
void FP_LIB_TABLE::Load( const wxString& aFileName )
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
fallBack = aFallBackTable;
|
||||
|
||||
// Empty footprint library tables are valid.
|
||||
if( aFileName.IsOk() && aFileName.FileExists() )
|
||||
if( wxFileName::IsFileReadable( aFileName ) )
|
||||
{
|
||||
FILE_LINE_READER reader( aFileName.GetFullPath() );
|
||||
FP_LIB_TABLE_LEXER lexer( &reader );
|
||||
FILE_LINE_READER reader( aFileName );
|
||||
FP_LIB_TABLE_LEXER lexer( &reader );
|
||||
|
||||
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)
|
||||
if( GLEW_VERSION_2_1 )
|
||||
{
|
||||
wxLogInfo( wxT( "OpenGL Version 2.1 supported." ) );
|
||||
wxLogInfo( wxT( "OpenGL 2.1 supported." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( parentWindow, wxT( "OpenGL Version 2.1 is not supported!" ) );
|
||||
DisplayError( parentWindow, wxT( "OpenGL 2.1 or higher is required!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include <common.h>
|
||||
|
@ -299,14 +299,14 @@ wxString FindKicadHelpPath()
|
|||
bool PathFound = false;
|
||||
|
||||
/* find kicad/help/ */
|
||||
tmp = wxGetApp().GetExecutablePath();
|
||||
tmp = Pgm().GetExecutablePath();
|
||||
|
||||
if( tmp.Last() == '/' )
|
||||
tmp.RemoveLast();
|
||||
|
||||
FullPath = tmp.BeforeLast( '/' ); // cd ..
|
||||
FullPath += wxT( "/doc/help/" );
|
||||
LocaleString = wxGetApp().GetLocale()->GetCanonicalName();
|
||||
LocaleString = Pgm().GetLocale()->GetCanonicalName();
|
||||
|
||||
wxString path_tmp = FullPath;
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -319,9 +319,9 @@ wxString FindKicadHelpPath()
|
|||
}
|
||||
|
||||
/* 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 ) )
|
||||
PathFound = true;
|
||||
|
@ -379,7 +379,7 @@ wxString FindKicadFile( const wxString& shortname )
|
|||
/* Test the presence of the file in the directory shortname of
|
||||
* the KiCad binary path.
|
||||
*/
|
||||
FullFileName = wxGetApp().GetExecutablePath() + shortname;
|
||||
FullFileName = Pgm().GetExecutablePath() + shortname;
|
||||
|
||||
if( wxFileExists( FullFileName ) )
|
||||
return FullFileName;
|
||||
|
@ -387,9 +387,9 @@ wxString FindKicadFile( const wxString& shortname )
|
|||
/* Test the presence of the file in the directory shortname
|
||||
* defined by the environment variable KiCad.
|
||||
*/
|
||||
if( wxGetApp().IsKicadEnvVariableDefined() )
|
||||
if( Pgm().IsKicadEnvVariableDefined() )
|
||||
{
|
||||
FullFileName = wxGetApp().GetKicadEnvVariable() + shortname;
|
||||
FullFileName = Pgm().GetKicadEnvVariable() + shortname;
|
||||
|
||||
if( wxFileExists( FullFileName ) )
|
||||
return FullFileName;
|
||||
|
@ -426,7 +426,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
|
|||
#ifdef __WXMAC__
|
||||
if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) )
|
||||
{
|
||||
return ProcessExecute( wxGetApp().GetExecutablePath() + wxT( "/" )
|
||||
return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" )
|
||||
+ ExecFile + wxT( " " )
|
||||
+ 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;
|
||||
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;
|
||||
}
|
||||
else // Path of executables.
|
||||
{
|
||||
wxString tmp = wxGetApp().GetExecutablePath();
|
||||
wxString tmp = Pgm().GetExecutablePath();
|
||||
#ifdef __WINDOWS__
|
||||
tmp.MakeLower();
|
||||
#endif
|
||||
if( tmp.Contains( wxT( "kicad" ) ) )
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
tmp = wxGetApp().GetExecutablePath();
|
||||
tmp = Pgm().GetExecutablePath();
|
||||
#endif
|
||||
if( tmp.Last() == '/' )
|
||||
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 )
|
||||
{
|
||||
wxString command;
|
||||
|
@ -575,12 +534,12 @@ bool OpenPDF( const wxString& file )
|
|||
wxString type;
|
||||
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 );
|
||||
command = wxGetApp().GetPdfBrowserFileName() + wxT( " " ) + filename;
|
||||
command = Pgm().GetPdfBrowserName() + wxT( " " ) + filename;
|
||||
}
|
||||
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,
|
||||
int aSize, EDA_COLOR_T aColor )
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ wxString HOTKEY_EDITOR_GRID_TABLE::GetValue( int row, int col )
|
|||
}
|
||||
else
|
||||
{
|
||||
return ReturnKeyNameFromKeyCode( hotkey_descr->m_KeyCode );
|
||||
return KeyNameFromKeyCode( hotkey_descr->m_KeyCode );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <kiface_i.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <id.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 )
|
||||
{
|
||||
m_KeyCode = keycode; // Key code (ascii value for ascii keys
|
||||
|
||||
// or wxWidgets code for function key
|
||||
m_InfoMsg = infomsg; // info message.
|
||||
m_Idcommand = idcommand; // internal id for the corresponding
|
||||
|
||||
// command (see hotkey_id_commnand list)
|
||||
m_IdMenuEvent = idmenuevent; // id to call the corresponding event
|
||||
// (if any) (see id.h)
|
||||
|
@ -137,13 +139,13 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
|
|||
{ wxT( "" ), 0 }
|
||||
};
|
||||
|
||||
#define MODIFIER_CTRL wxT( "Ctrl+" )
|
||||
#define MODIFIER_ALT wxT( "Alt+" )
|
||||
#define MODIFIER_CTRL wxT( "Ctrl+" )
|
||||
#define MODIFIER_ALT wxT( "Alt+" )
|
||||
#define MODIFIER_SHIFT wxT( "Shift+" )
|
||||
|
||||
|
||||
/**
|
||||
* Function ReturnKeyNameFromKeyCode
|
||||
* Function KeyNameFromKeyCode
|
||||
* return the key name from the key code
|
||||
* Only some wxWidgets key values are handled for function key ( see
|
||||
* 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)
|
||||
* @return the key name in a wxString
|
||||
*/
|
||||
wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
|
||||
wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
|
||||
{
|
||||
wxString keyname, modifier, fullkeyname;
|
||||
int ii;
|
||||
|
@ -237,7 +239,7 @@ wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList,
|
|||
wxString keyname;
|
||||
|
||||
if( aList )
|
||||
keyname = ReturnKeyNameFromCommandId( aList, aCommandId );
|
||||
keyname = KeyNameFromCommandId( aList, aCommandId );
|
||||
|
||||
if( !keyname.IsEmpty() )
|
||||
{
|
||||
|
@ -278,14 +280,14 @@ wxString AddHotkeyName( const wxString& aText,
|
|||
{
|
||||
wxString msg = aText;
|
||||
wxString keyname;
|
||||
EDA_HOTKEY** List;
|
||||
EDA_HOTKEY** list;
|
||||
|
||||
if( aDescList )
|
||||
{
|
||||
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
|
||||
{
|
||||
List = aDescList->m_HK_InfoList;
|
||||
keyname = ReturnKeyNameFromCommandId( List, aCommandId );
|
||||
list = aDescList->m_HK_InfoList;
|
||||
keyname = KeyNameFromCommandId( list, aCommandId );
|
||||
|
||||
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)
|
||||
* @param aList = pointer to a EDA_HOTKEY list of commands
|
||||
* @param aCommandId = Command Id value
|
||||
* @return the key name in a wxString
|
||||
*/
|
||||
wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
||||
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
||||
{
|
||||
wxString keyname;
|
||||
|
||||
|
@ -329,7 +331,7 @@ wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
|||
|
||||
if( hk_decr->m_Idcommand == aCommandId )
|
||||
{
|
||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -339,14 +341,14 @@ wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
|||
|
||||
|
||||
/**
|
||||
* Function ReturnKeyCodeFromKeyName
|
||||
* Function KeyCodeFromKeyName
|
||||
* return the key code from its key name
|
||||
* Only some wxWidgets key values are handled for function key
|
||||
* @param keyname = wxString key name to find in s_Hotkey_Name_List[],
|
||||
* like F2 or space or an usual (ascii) char.
|
||||
* @return the key code
|
||||
*/
|
||||
int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
||||
int KeyCodeFromKeyName( const wxString& keyname )
|
||||
{
|
||||
int ii, keycode = 0;
|
||||
|
||||
|
@ -406,7 +408,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
|||
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
|
||||
{
|
||||
wxString keyname;
|
||||
EDA_HOTKEY** List;
|
||||
EDA_HOTKEY** list;
|
||||
|
||||
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++ )
|
||||
{
|
||||
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" ) ) )
|
||||
{
|
||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
|
||||
// Some chars should be modified, using html encoding, to be
|
||||
// displayed by DisplayHtmlInfoMessage()
|
||||
keyname.Replace( wxT("<"), wxT("<") );
|
||||
|
@ -480,8 +483,8 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
|||
|
||||
msg = wxT( "$hotkey list\n" );
|
||||
|
||||
/* Print the current hotkey list */
|
||||
EDA_HOTKEY** List;
|
||||
// Print the current hotkey list
|
||||
EDA_HOTKEY** list;
|
||||
|
||||
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 += 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 " );
|
||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
AddDelimiterString( keyname );
|
||||
infokey = hk_decr->m_InfoMsg;
|
||||
AddDelimiterString( infokey );
|
||||
|
@ -548,21 +551,21 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
|
|||
{
|
||||
wxFile cfgfile( aFilename );
|
||||
|
||||
/* get length */
|
||||
// get length
|
||||
cfgfile.SeekEnd();
|
||||
wxFileOffset size = cfgfile.Tell();
|
||||
cfgfile.Seek( 0 );
|
||||
|
||||
/* read data */
|
||||
// read data
|
||||
char* buffer = new char[size];
|
||||
cfgfile.Read( buffer, size );
|
||||
|
||||
wxString data( buffer, wxConvUTF8 );
|
||||
|
||||
/* parse */
|
||||
// parse
|
||||
ParseHotkeyConfig( data, aDescList );
|
||||
|
||||
/* cleanup */
|
||||
// cleanup
|
||||
delete[] buffer;
|
||||
cfgfile.Close();
|
||||
return 1;
|
||||
|
@ -603,7 +606,7 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList )
|
|||
void ParseHotkeyConfig( const wxString& data,
|
||||
struct EDA_HOTKEY_CONFIG* aDescList )
|
||||
{
|
||||
/* Read the config */
|
||||
// Read the config
|
||||
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
|
||||
EDA_HOTKEY** CurrentHotkeyList = 0;
|
||||
|
||||
|
@ -643,23 +646,23 @@ void ParseHotkeyConfig( const wxString& data,
|
|||
if( CurrentHotkeyList == NULL )
|
||||
continue;
|
||||
|
||||
/* Get the key name */
|
||||
// Get the key name
|
||||
lineTokenizer.SetString( lineTokenizer.GetString(), L"\"\r\n\t ", wxTOKEN_STRTOK );
|
||||
wxString keyname = lineTokenizer.GetNextToken();
|
||||
|
||||
wxString remainder = lineTokenizer.GetString();
|
||||
|
||||
/* Get the command name */
|
||||
// Get the command name
|
||||
wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' );
|
||||
|
||||
/* search the hotkey in current hotkey list */
|
||||
for( EDA_HOTKEY** List = CurrentHotkeyList; *List != NULL; List++ )
|
||||
// search the hotkey in current hotkey 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 )
|
||||
{
|
||||
int code = ReturnKeyCodeFromKeyName( keyname );
|
||||
int code = KeyCodeFromKeyName( keyname );
|
||||
|
||||
if( 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 mask = wxT( "*." ) + ext;
|
||||
wxString path = wxGetCwd();
|
||||
wxString filename = wxGetApp().GetAppName() + wxT( "." ) + ext;
|
||||
wxString filename = Kiface().Name() + wxT( '.' ) + ext;
|
||||
|
||||
filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
|
||||
path,
|
||||
|
@ -709,7 +712,7 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescLi
|
|||
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
wxString mask = wxT( "*." ) + ext;
|
||||
wxString path = wxGetCwd();
|
||||
wxString filename = wxGetApp().GetAppName() + wxT( "." ) + ext;
|
||||
wxString filename = Kiface().Name() + wxT( "." ) + ext;
|
||||
|
||||
filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
|
||||
path,
|
||||
|
@ -736,14 +739,14 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
|
|||
|
||||
wxMenu* HotkeySubmenu = new wxMenu();
|
||||
|
||||
/* List existing hotkey menu*/
|
||||
// List existing hotkey menu
|
||||
AddMenuItem( HotkeySubmenu,
|
||||
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
||||
_( "&List Current Keys" ),
|
||||
_( "Displays the current hotkeys list and corresponding commands" ),
|
||||
KiBitmap( info_xpm ) );
|
||||
|
||||
/* Call hotkeys editor*/
|
||||
// Call hotkeys editor
|
||||
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
|
||||
_( "&Edit Hotkeys" ),
|
||||
_( "Call the hotkeys editor" ),
|
||||
|
@ -751,19 +754,19 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
|
|||
|
||||
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,
|
||||
_( "E&xport Hotkeys" ),
|
||||
_( "Create a hotkey configuration file to export the current hotkeys" ),
|
||||
KiBitmap( save_setup_xpm ) );
|
||||
|
||||
/* Reload hotkey file */
|
||||
// Reload hotkey file
|
||||
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
|
||||
_( "&Import Hotkeys" ),
|
||||
_( "Load an existing hotkey configuration file" ),
|
||||
KiBitmap( reload_xpm ) );
|
||||
|
||||
/* Append HotkeySubmenu to menu */
|
||||
// Append HotkeySubmenu to menu
|
||||
AddMenuItem( aMenu, HotkeySubmenu,
|
||||
ID_PREFERENCES_HOTKEY_SUBMENU, _( "&Hotkeys" ),
|
||||
_( "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()
|
||||
{
|
||||
memset( &m_dso_players, 0, sizeof( m_dso_players ) );
|
||||
memset( &m_kiface, 0, sizeof( m_kiface ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
const wxString KIWAY::dso_name( FACE_T aFaceId )
|
||||
{
|
||||
switch( aFaceId )
|
||||
|
@ -51,11 +52,12 @@ const wxString KIWAY::dso_name( FACE_T aFaceId )
|
|||
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_PCB:
|
||||
//case FACE_LIB:
|
||||
//case FACE_MOD:
|
||||
if( m_dso_players[aFaceId] )
|
||||
return m_dso_players[aFaceId];
|
||||
if( m_kiface[aFaceId] )
|
||||
return m_kiface[aFaceId];
|
||||
|
||||
default:
|
||||
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:
|
||||
break;
|
||||
|
||||
//case FACE_LIB:
|
||||
//case FACE_MOD:
|
||||
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 <appl_wxstruct.h>
|
||||
#include <kiface_i.h>
|
||||
#include <drawtxt.h>
|
||||
#include <worksheet.h>
|
||||
#include <class_title_block.h>
|
||||
#include <worksheet_shape_builder.h>
|
||||
#include <class_worksheet_dataitem.h>
|
||||
|
||||
|
||||
// The layout shape used in the application
|
||||
// It is accessible by WORKSHEET_LAYOUT::GetTheInstance()
|
||||
WORKSHEET_LAYOUT wksTheInstance;
|
||||
|
@ -70,21 +71,25 @@ WORKSHEET_LAYOUT::WORKSHEET_LAYOUT()
|
|||
m_bottomMargin = 10.0; // the bottom page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetLeftMargin( double aMargin )
|
||||
{
|
||||
m_leftMargin = aMargin; // the left page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetRightMargin( double aMargin )
|
||||
{
|
||||
m_rightMargin = aMargin; // the right page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetTopMargin( double aMargin )
|
||||
{
|
||||
m_topMargin = aMargin; // the top page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetBottomMargin( double aMargin )
|
||||
{
|
||||
m_bottomMargin = aMargin; // the bottom page margin in mm
|
||||
|
@ -98,8 +103,7 @@ void WORKSHEET_LAYOUT::ClearList()
|
|||
m_list.clear();
|
||||
}
|
||||
|
||||
/* Insert an item to the list of items at position aIdx
|
||||
*/
|
||||
|
||||
void WORKSHEET_LAYOUT::Insert( WORKSHEET_DATAITEM* aItem, unsigned aIdx )
|
||||
{
|
||||
if ( aIdx >= GetCount() )
|
||||
|
@ -108,8 +112,7 @@ void WORKSHEET_LAYOUT::Insert( WORKSHEET_DATAITEM* aItem, unsigned aIdx )
|
|||
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 )
|
||||
{
|
||||
if ( aIdx >= GetCount() )
|
||||
|
@ -118,8 +121,7 @@ bool WORKSHEET_LAYOUT::Remove( unsigned aIdx )
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Remove the item to the list of items at position aIdx
|
||||
*/
|
||||
|
||||
bool WORKSHEET_LAYOUT::Remove( WORKSHEET_DATAITEM* aItem )
|
||||
{
|
||||
unsigned idx = 0;
|
||||
|
@ -135,8 +137,7 @@ bool WORKSHEET_LAYOUT::Remove( WORKSHEET_DATAITEM* aItem )
|
|||
return Remove( idx );
|
||||
}
|
||||
|
||||
/* return the index of aItem, or -1 if does not exist
|
||||
*/
|
||||
|
||||
int WORKSHEET_LAYOUT::GetItemIndex( WORKSHEET_DATAITEM* aItem ) const
|
||||
{
|
||||
unsigned idx = 0;
|
||||
|
@ -161,17 +162,13 @@ WORKSHEET_DATAITEM* WORKSHEET_LAYOUT::GetItem( unsigned aIdx ) const
|
|||
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 )
|
||||
{
|
||||
wxFileName fn = aFullFileName;
|
||||
wxString shortFileName = aFullFileName;
|
||||
wxFileName fn = aFullFileName;
|
||||
wxString shortFileName = aFullFileName;
|
||||
wxString fileName = Kiface().KifaceSearch().FindValidPath( fn.GetFullName() );
|
||||
|
||||
wxString fileName = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||
if( !fileName.IsEmpty() )
|
||||
{
|
||||
fn = fileName;
|
||||
|
@ -182,19 +179,15 @@ const wxString WORKSHEET_LAYOUT::MakeShortFileName( const wxString& aFullFileNam
|
|||
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 )
|
||||
{
|
||||
wxFileName fn = aShortFileName;
|
||||
wxString fullFileName = aShortFileName;
|
||||
wxFileName fn = aShortFileName;
|
||||
wxString fullFileName = aShortFileName;
|
||||
|
||||
if( fn.GetPath().IsEmpty() && !fn.GetFullName().IsEmpty() )
|
||||
{
|
||||
wxString name = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||
wxString name = Kiface().KifaceSearch().FindValidPath( fn.GetFullName() );
|
||||
if( !name.IsEmpty() )
|
||||
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
|
||||
mimic a KIWAY, not actually implement one, since only a single DSO is
|
||||
supported by it.
|
||||
This is a program launcher for a single KIFACE DSO. It only mimics a KIWAY,
|
||||
not actually implements one, since only a single DSO is 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 <fctsys.h>
|
||||
#include <wx/dynlib.h>
|
||||
#include <wx/filename.h>
|
||||
#include <kiway.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/snglinst.h>
|
||||
|
||||
#include <kiway.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiway_player.h>
|
||||
#include <confirm.h>
|
||||
|
||||
|
||||
/**
|
||||
* Class PROCESS
|
||||
* provides its own OnInit() handler.
|
||||
*/
|
||||
class PROCESS : public wxApp
|
||||
{
|
||||
public:
|
||||
|
||||
bool OnInit();
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_APP( PROCESS )
|
||||
// The functions we use will cause the program launcher to pull stuff in
|
||||
// during linkage, keep the map file in mind to see what's going into it.
|
||||
|
||||
|
||||
#if !wxCHECK_VERSION( 3, 0, 0 )
|
||||
|
@ -107,41 +104,6 @@ static wxString wxJoin(const wxArrayString& arr, const wxChar sep,
|
|||
#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.
|
||||
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.
|
||||
void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
||||
{
|
||||
// POLICY CHOICE: Keep same path, so that installer MAY put the
|
||||
// "subsidiary shared libraries" in the same directory as the top process module.
|
||||
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
|
||||
// "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
|
||||
// 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.
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
|
@ -186,28 +148,119 @@ void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
|||
#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,
|
||||
// which is dedicated to loading only a single DSO.
|
||||
static KIWAY standalone;
|
||||
// POLICY CHOICE 1: Keep same path, and therefore installer must put the kiface 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.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.
|
||||
// Could have used one from the KIWAY also.
|
||||
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
|
||||
* 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
|
||||
* or NULL if the getter func was not found. If not found, it is possibly not version compatible
|
||||
* since the lookup is done by name and the name contains the API version.
|
||||
* @return KIFACE_GETTER_FUNC* - a pointer to a function which can be called to
|
||||
* get the KIFACE or NULL if the getter func was not found. If not found,
|
||||
* 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 )
|
||||
{
|
||||
#if defined(BUILD_KIWAY_DLL)
|
||||
void* addr = NULL;
|
||||
|
||||
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;
|
||||
|
||||
#else
|
||||
return &KIFACE_GETTER;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,32 +288,13 @@ static KIFACE* kiface;
|
|||
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().
|
||||
// That choice is not mandatory, see wx's appbase.cpp OnInit().
|
||||
if( !wxApp::OnInit() )
|
||||
return false;
|
||||
// first thing: set m_wx_app
|
||||
m_wx_app = aWxApp;
|
||||
|
||||
wxStandardPathsBase& paths = wxStandardPaths::Get();
|
||||
|
||||
#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
|
||||
wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
||||
if( !wxIsAbsolutePath( absoluteArgv0 ) )
|
||||
{
|
||||
|
@ -267,6 +306,9 @@ bool PROCESS::OnInit()
|
|||
// KIFACE has hard dependencies on subsidiary DSOs below it.
|
||||
SetLibEnvVar( absoluteArgv0 );
|
||||
|
||||
if( !initPgm() )
|
||||
return false;
|
||||
|
||||
wxString dname = dso_full_path( absoluteArgv0 );
|
||||
|
||||
// Get the getter.
|
||||
|
@ -279,24 +321,147 @@ bool PROCESS::OnInit()
|
|||
return false;
|
||||
}
|
||||
|
||||
// Get the KIFACE, and give the DSO a single chance to do its
|
||||
// "process level" initialization.
|
||||
kiface = getter( &kiface_version, KIFACE_VERSION, &wxGetApp() );
|
||||
// Get the KIFACE.
|
||||
kiface = getter( &kiface_version, KIFACE_VERSION, this );
|
||||
|
||||
// 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*" ) );
|
||||
|
||||
// Use KIFACE to create a window that the KIFACE knows about,
|
||||
// pass classId=0 for now. KIFACE::CreateWindow() is a virtual
|
||||
// so we don't need to link to it.
|
||||
wxFrame* frame = (wxFrame*) kiface->CreateWindow( 0, &standalone );
|
||||
// Give the DSO a single chance to do its "process level" initialization.
|
||||
// "Process level" specifically means stay away from any projects in there.
|
||||
if( !kiface->OnKifaceStart( this ) )
|
||||
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();
|
||||
|
||||
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 NetlistFileExtension( wxT( "net" ) );
|
||||
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 KiCadPcbFileExtension( wxT( "kicad_pcb" ) );
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <gr_basic.h>
|
||||
#include <common.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_base_screen.h>
|
||||
#include <drawtxt.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <worksheet.h>
|
||||
#include <class_title_block.h>
|
||||
#include <build_version.h>
|
||||
|
@ -170,7 +170,7 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
|||
break;
|
||||
|
||||
case 'K':
|
||||
msg += productName + wxGetApp().GetAppName();
|
||||
msg += productName + Pgm().App().GetAppName();
|
||||
msg += wxT( " " ) + GetBuildVersion();
|
||||
break;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( EDA_UNITS_T aUnit, int textSize )
|
|||
if( 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;
|
||||
|
||||
textsize = ReturnValueFromString( aUnit, sizeText );
|
||||
textsize = ValueFromString( aUnit, sizeText );
|
||||
|
||||
// Limit to reasonable size
|
||||
if( textsize < 10 )
|
||||
|
@ -209,8 +209,8 @@ wxPoint EDA_POSITION_CTRL::GetValue()
|
|||
{
|
||||
wxPoint coord;
|
||||
|
||||
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue() );
|
||||
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue() );
|
||||
coord.x = ValueFromString( m_UserUnit, m_FramePosX->GetValue() );
|
||||
coord.y = ValueFromString( m_UserUnit, m_FramePosY->GetValue() );
|
||||
|
||||
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.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->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->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 );
|
||||
|
||||
wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value );
|
||||
wxString stringvalue = StringFromValue( m_UserUnit, m_Value );
|
||||
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
|
||||
|
||||
BoxSizer->Add( m_ValueCtrl,
|
||||
|
@ -301,7 +301,7 @@ int EDA_VALUE_CTRL::GetValue()
|
|||
int coord;
|
||||
wxString txtvalue = m_ValueCtrl->GetValue();
|
||||
|
||||
coord = ReturnValueFromString( m_UserUnit, txtvalue );
|
||||
coord = ValueFromString( m_UserUnit, txtvalue );
|
||||
return coord;
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ void EDA_VALUE_CTRL::SetValue( int new_value )
|
|||
|
||||
m_Value = new_value;
|
||||
|
||||
buffer = ReturnStringFromValue( m_UserUnit, m_Value );
|
||||
buffer = StringFromValue( m_UserUnit, m_Value );
|
||||
m_ValueCtrl->SetValue( buffer );
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <view/view.h>
|
||||
#include <class_base_screen.h>
|
||||
#include <wxstruct.h>
|
||||
#include <draw_frame.h>
|
||||
#include <kicad_device_context.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <menus_helpers.h>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
add_definitions( -DCVPCB )
|
||||
|
||||
###
|
||||
# Includes
|
||||
###
|
||||
set( MAKE_LINK_MAPS true )
|
||||
|
||||
add_definitions( -DCVPCB )
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(
|
||||
|
@ -15,12 +14,13 @@ include_directories(
|
|||
${INC_AFTER}
|
||||
)
|
||||
|
||||
###
|
||||
# Sources
|
||||
###
|
||||
|
||||
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_base.cpp
|
||||
../pcbnew/dialogs/dialog_fp_lib_table.cpp
|
||||
|
@ -40,101 +40,198 @@ set( CVPCB_SRCS
|
|||
class_footprints_listbox.cpp
|
||||
class_library_listbox.cpp
|
||||
cvframe.cpp
|
||||
cvpcb.cpp
|
||||
listboxes.cpp
|
||||
menubar.cpp
|
||||
readwrite_dlgs.cpp
|
||||
tool_cvpcb.cpp
|
||||
)
|
||||
|
||||
###
|
||||
# Windows resource file
|
||||
###
|
||||
if( WIN32 )
|
||||
if( MINGW )
|
||||
# CVPCB_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler( cvpcb )
|
||||
else()
|
||||
set( CVPCB_RESOURCES cvpcb.rc )
|
||||
endif()
|
||||
|
||||
if( MINGW )
|
||||
# CVPCB_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler( cvpcb )
|
||||
endif()
|
||||
|
||||
###
|
||||
# Apple resource files
|
||||
###
|
||||
|
||||
if( APPLE )
|
||||
set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns )
|
||||
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
|
||||
set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns )
|
||||
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb )
|
||||
endif()
|
||||
|
||||
###
|
||||
# Create the cvpcb executable
|
||||
###
|
||||
add_executable( cvpcb WIN32 MACOSX_BUNDLE
|
||||
${CVPCB_SRCS}
|
||||
${CVPCB_DIALOGS}
|
||||
${CVPCB_RESOURCES}
|
||||
)
|
||||
|
||||
###
|
||||
# Set properties for APPLE on cvpcb target
|
||||
###
|
||||
if( APPLE )
|
||||
set_target_properties( cvpcb PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
|
||||
if( USE_KIWAY_DLLS )
|
||||
add_executable( cvpcb WIN32 MACOSX_BUNDLE
|
||||
../common/single_top.cpp
|
||||
../common/pgm_base.cpp
|
||||
${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()
|
||||
|
||||
###
|
||||
# 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 <common.h>
|
||||
#include <project.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kicad_string.h>
|
||||
#include <macros.h>
|
||||
|
||||
|
@ -87,6 +88,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
|
|||
char Line[1024];
|
||||
FILE* file;
|
||||
size_t ii;
|
||||
SEARCH_STACK& search = Prj().SchSearchS();
|
||||
|
||||
if( m_netlist.IsEmpty() )
|
||||
return;
|
||||
|
@ -99,17 +101,17 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
|
|||
if( !fn.HasExt() )
|
||||
{
|
||||
fn.SetExt( FootprintAliasFileExtension );
|
||||
// above fails if filename have more than one point
|
||||
// above fails if filename has more than one point
|
||||
}
|
||||
else
|
||||
{
|
||||
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
|
||||
}
|
||||
tmp = wxGetApp().FindLibraryPath( fn );
|
||||
tmp = search.FindValidPath( fn );
|
||||
|
||||
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." ),
|
||||
GetChars( fn.GetFullName() ) );
|
||||
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <id.h>
|
||||
#include <common.h>
|
||||
#include <gestfich.h>
|
||||
#include <param_config.h>
|
||||
#include <config_params.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <confirm.h>
|
||||
|
@ -46,24 +47,24 @@
|
|||
#define GROUPEQU wxT("/cvpcb/libraries")
|
||||
|
||||
|
||||
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters( void )
|
||||
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
|
||||
{
|
||||
if( !m_projectFileParams.empty() )
|
||||
return m_projectFileParams;
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUPLIB,
|
||||
PARAM_COMMAND_ERASE ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
|
||||
&m_ModuleLibNames,
|
||||
GROUPLIB ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "EquName" ),
|
||||
&m_AliasLibNames,
|
||||
GROUPEQU ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetIExt" ),
|
||||
&m_NetlistFileExtension ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),
|
||||
&m_UserLibraryPath,
|
||||
GROUPLIB ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUPLIB, PARAM_COMMAND_ERASE ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||
wxT( "LibName" ), &m_ModuleLibNames, GROUPLIB ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||
wxT( "EquName" ), &m_AliasLibNames, GROUPEQU ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
|
||||
wxT( "NetIExt" ), &m_NetlistFileExtension ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME(
|
||||
wxT( "LibDir" ), &m_UserLibraryPath, GROUPLIB ) );
|
||||
|
||||
return m_projectFileParams;
|
||||
}
|
||||
|
@ -71,42 +72,34 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters( void )
|
|||
|
||||
void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
|
||||
{
|
||||
wxFileName fn = aFileName;
|
||||
wxFileName fn( aFileName );
|
||||
PROJECT& prj = Prj();
|
||||
|
||||
m_ModuleLibNames.Clear();
|
||||
m_AliasLibNames.Clear();
|
||||
|
||||
if( fn.GetExt() != ProjectFileExtension )
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
wxGetApp().RemoveLibraryPath( m_UserLibraryPath );
|
||||
|
||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
||||
// was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
||||
prj.ConfigLoad( prj.PcbSearchS(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
||||
|
||||
if( m_NetlistFileExtension.IsEmpty() )
|
||||
m_NetlistFileExtension = wxT( "net" );
|
||||
|
||||
// User library path takes precedent over default library search paths.
|
||||
wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 );
|
||||
// empty the table, Load() it again below.
|
||||
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.
|
||||
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 );
|
||||
wxString projectFpLibTableFileName = prj.FootprintLibTblName();
|
||||
|
||||
try
|
||||
{
|
||||
m_footprintLibTable->Load( projectFpLibTableFileName, m_globalFootprintTable );
|
||||
FootprintLibs()->Load( projectFpLibTableFileName );
|
||||
}
|
||||
catch( IO_ERROR ioe )
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( this, ioe.errorText );
|
||||
}
|
||||
|
@ -136,5 +129,11 @@ void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
|
|||
if( !IsWritable( fn ) )
|
||||
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 <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_drawpanel_gal.h>
|
||||
|
@ -70,28 +70,25 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
|
|||
DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" )
|
||||
|
||||
|
||||
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style ) :
|
||||
PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size,
|
||||
style, DISPLAY_FOOTPRINTS_FRAME_NAME )
|
||||
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Footprint Viewer" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
|
||||
{
|
||||
m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME;
|
||||
m_FrameName = FOOTPRINTVIEWER_FRAME_NAME;
|
||||
m_showAxis = true; // true to draw axis.
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
|
||||
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
||||
|
||||
LoadSettings();
|
||||
LoadSettings( config() );
|
||||
|
||||
// Initialize grid id to a default value if not found in config or bad:
|
||||
if( (m_LastGridSizeId <= 0) ||
|
||||
|
@ -148,8 +145,6 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
|
|||
{
|
||||
delete GetScreen();
|
||||
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;
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -493,7 +488,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
|
|||
wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ),
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <wxBasePcbFrame.h>
|
||||
|
||||
// The name (for wxWidgets) of the footprint viewer frame
|
||||
#define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" )
|
||||
|
||||
class CVPCB_MAINFRAME;
|
||||
|
||||
|
@ -40,10 +42,7 @@ class CVPCB_MAINFRAME;
|
|||
class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME
|
||||
{
|
||||
public:
|
||||
DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||
|
||||
DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent );
|
||||
~DISPLAY_FOOTPRINTS_FRAME();
|
||||
|
||||
void OnCloseWindow( wxCloseEvent& Event );
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <wxstruct.h>
|
||||
#include <macros.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
|
@ -207,7 +207,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
|
|||
return;
|
||||
|
||||
// If the footprint view window is displayed, update the footprint.
|
||||
if( GetParent()->m_DisplayFootprintFrame )
|
||||
if( GetParent()->GetFpViewerFrame() )
|
||||
GetParent()->CreateScreenCmp();
|
||||
|
||||
GetParent()->DisplayStatus();
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <build_version.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <macros.h>
|
||||
#include <confirm.h>
|
||||
#include <eda_doc.h>
|
||||
|
@ -104,24 +105,22 @@ END_EVENT_TABLE()
|
|||
|
||||
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
||||
|
||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
||||
EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition,
|
||||
wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
|
||||
|
||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, CVPCB_FRAME_TYPE, wxT( "CvPCB" ), wxDefaultPosition,
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
||||
{
|
||||
m_FrameName = CVPCB_MAINFRAME_NAME;
|
||||
m_ListCmp = NULL;
|
||||
m_FootprintList = NULL;
|
||||
m_LibraryList = NULL;
|
||||
m_DisplayFootprintFrame = NULL;
|
||||
m_mainToolBar = NULL;
|
||||
m_modified = false;
|
||||
m_isEESchemaNetlist = false;
|
||||
m_KeepCvpcbOpen = false;
|
||||
m_undefinedComponentCnt = 0;
|
||||
m_skipComponentSelect = false;
|
||||
|
||||
m_globalFootprintTable = NULL;
|
||||
m_footprintLibTable = NULL;
|
||||
m_NetlistFileExtension = wxT( "net" );
|
||||
|
||||
/* Name of the document footprint list
|
||||
* usually located in share/modules/footprints_doc
|
||||
|
@ -137,7 +136,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
|||
|
||||
SetAutoLayout( true );
|
||||
|
||||
LoadSettings();
|
||||
LoadSettings( config() );
|
||||
|
||||
if( 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 ) );
|
||||
|
||||
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();
|
||||
cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
||||
cfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
||||
return tbl;
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SaveSettings()
|
||||
void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
|
||||
{
|
||||
wxASSERT( wxGetApp().GetSettings() != NULL );
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
wxConfig* cfg = wxGetApp().GetSettings();
|
||||
|
||||
EDA_BASE_FRAME::SaveSettings();
|
||||
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
||||
cfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||
aCfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
||||
aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||
|
||||
int state = 0;
|
||||
|
||||
|
@ -267,7 +248,7 @@ void CVPCB_MAINFRAME::SaveSettings()
|
|||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||
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
|
||||
if( wxGetApp().GetHtmlHelpController() )
|
||||
if( Pgm().GetHtmlHelpController() )
|
||||
{
|
||||
if( wxGetApp().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
|
||||
wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true );
|
||||
if( Pgm().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
|
||||
Pgm().GetHtmlHelpController()->GetFrame()->Close( true );
|
||||
}
|
||||
|
||||
if( m_NetlistFileName.IsOk() )
|
||||
|
@ -333,8 +314,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
}
|
||||
|
||||
// Close module display frame
|
||||
if( m_DisplayFootprintFrame )
|
||||
m_DisplayFootprintFrame->Close( true );
|
||||
if( GetFpViewerFrame() )
|
||||
GetFpViewerFrame()->Close( true );
|
||||
|
||||
m_modified = false;
|
||||
|
||||
|
@ -460,9 +441,8 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
|
|||
|
||||
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
||||
{
|
||||
wxString oldPath;
|
||||
wxFileName newFileName;
|
||||
int id = event.GetId();
|
||||
wxFileName newFileName;
|
||||
|
||||
if( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
||||
{
|
||||
|
@ -483,70 +463,83 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
|||
if( newFileName == m_NetlistFileName )
|
||||
return;
|
||||
|
||||
if( m_NetlistFileName.DirExists() )
|
||||
oldPath = m_NetlistFileName.GetPath();
|
||||
OpenProjectFiles( std::vector<wxString>( 1, newFileName.GetFullPath() ) );
|
||||
}
|
||||
|
||||
/* Update the library search path list. */
|
||||
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
||||
wxGetApp().GetLibraryPathList().Remove( oldPath );
|
||||
|
||||
wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
|
||||
m_NetlistFileName = newFileName;
|
||||
ReadNetListAndLinkFiles();
|
||||
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
if( aFileSet.size() == 1 )
|
||||
{
|
||||
m_NetlistFileName = aFileSet[0];
|
||||
ReadNetListAndLinkFiles();
|
||||
|
||||
// OSX need it since some objects are "rebuild" just make aware AUI
|
||||
// Fixes #1258081
|
||||
m_auimgr.Update();
|
||||
UpdateTitle();
|
||||
|
||||
// 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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
bool tableChanged = false;
|
||||
int r = InvokePcbLibTableEditor( this, m_globalFootprintTable, m_footprintLibTable );
|
||||
bool tableChanged = false;
|
||||
int r = InvokePcbLibTableEditor( this, &GFootprintTable, FootprintLibs() );
|
||||
|
||||
if( r & 1 )
|
||||
{
|
||||
wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
|
||||
|
||||
try
|
||||
{
|
||||
FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() );
|
||||
m_globalFootprintTable->Format( &sf, 0 );
|
||||
GFootprintTable.Save( fileName );
|
||||
tableChanged = true;
|
||||
}
|
||||
catch( IO_ERROR& ioe )
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error occurred saving the global footprint library "
|
||||
"table:\n\n%s" ), ioe.errorText.GetData() );
|
||||
wxString msg = wxString::Format( _(
|
||||
"Error occurred saving the global footprint library table:\n'%s'\n%s" ),
|
||||
GetChars( fileName ),
|
||||
GetChars( ioe.errorText )
|
||||
);
|
||||
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
if( r & 2 )
|
||||
{
|
||||
wxFileName fn = m_NetlistFileName;
|
||||
fn.SetName( FP_LIB_TABLE::GetFileName() );
|
||||
fn.SetExt( wxEmptyString );
|
||||
wxString fileName = Prj().FootprintLibTblName();
|
||||
|
||||
try
|
||||
{
|
||||
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
||||
m_footprintLibTable->Format( &sf, 0 );
|
||||
FootprintLibs()->Save( fileName );
|
||||
tableChanged = true;
|
||||
}
|
||||
catch( IO_ERROR& ioe )
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error occurred saving the global footprint library "
|
||||
"table:\n\n%s" ), ioe.errorText.GetData() );
|
||||
wxString msg = wxString::Format( _(
|
||||
"Error occurred saving the project footprint library table:\n'%s'\n%s" ),
|
||||
GetChars( fileName ),
|
||||
GetChars( ioe.errorText )
|
||||
);
|
||||
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +547,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
|||
if( tableChanged )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 );
|
||||
|
||||
// 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 )
|
||||
return;
|
||||
|
@ -646,7 +641,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
|||
if ( ii >= 0 )
|
||||
m_FootprintList->SetSelection( ii, false );
|
||||
|
||||
if( m_DisplayFootprintFrame )
|
||||
if( GetFpViewerFrame() )
|
||||
{
|
||||
CreateScreenCmp();
|
||||
}
|
||||
|
@ -755,16 +750,17 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
|||
|
||||
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||
{
|
||||
FP_LIB_TABLE* fptbl = FootprintLibs();
|
||||
|
||||
// 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 "
|
||||
"library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_footprintLibTable != NULL )
|
||||
m_footprints.ReadFootprintFiles( m_footprintLibTable );
|
||||
m_footprints.ReadFootprintFiles( fptbl );
|
||||
|
||||
if( m_footprints.GetErrorCount() )
|
||||
{
|
||||
|
@ -777,20 +773,18 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
|||
|
||||
void CVPCB_MAINFRAME::UpdateTitle()
|
||||
{
|
||||
wxString title;
|
||||
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
|
||||
|
||||
if( m_NetlistFileName.IsOk() && m_NetlistFileName.FileExists() )
|
||||
{
|
||||
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
||||
wxT( " " ) + m_NetlistFileName.GetFullPath();
|
||||
title += m_NetlistFileName.GetFullPath();
|
||||
|
||||
if( !m_NetlistFileName.IsFileWritable() )
|
||||
title += _( " [Read Only]" );
|
||||
}
|
||||
else
|
||||
{
|
||||
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
||||
wxT( " " ) + _( " [no file]" );
|
||||
title += _( "[no file]" );
|
||||
}
|
||||
|
||||
SetTitle( title );
|
||||
|
@ -875,7 +869,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
|
|||
|
||||
|
||||
// File header.
|
||||
static char HeaderLinkFile[] = { "Cmp-Mod V01" };
|
||||
static char headerLinkFile[] = "Cmp-Mod V01";
|
||||
|
||||
|
||||
bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
||||
|
@ -883,7 +877,7 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
|||
COMPONENT* component;
|
||||
FILE* outputFile;
|
||||
wxFileName fn( aFullFileName );
|
||||
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
|
||||
|
||||
outputFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||
|
||||
|
@ -903,8 +897,8 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
|||
* IdModule = BUS_PC;
|
||||
* EndCmp
|
||||
*/
|
||||
retval |= fprintf( outputFile, "%s", HeaderLinkFile );
|
||||
retval |= fprintf( outputFile, " Created by %s", TO_UTF8( Title ) );
|
||||
retval |= fprintf( outputFile, "%s", headerLinkFile );
|
||||
retval |= fprintf( outputFile, " Created by %s", TO_UTF8( title ) );
|
||||
retval |= fprintf( outputFile, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
||||
|
||||
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
||||
|
@ -926,21 +920,17 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
|||
|
||||
void CVPCB_MAINFRAME::CreateScreenCmp()
|
||||
{
|
||||
if( m_DisplayFootprintFrame == NULL )
|
||||
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame();
|
||||
|
||||
if( !fpframe )
|
||||
{
|
||||
m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
|
||||
wxPoint( 0, 0 ),
|
||||
wxSize( 600, 400 ),
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||
|
||||
m_DisplayFootprintFrame->SetFootprintLibTable( m_footprintLibTable );
|
||||
|
||||
m_DisplayFootprintFrame->Show( true );
|
||||
fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
|
||||
fpframe->Show( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_DisplayFootprintFrame->IsIconized() )
|
||||
m_DisplayFootprintFrame->Iconize( false );
|
||||
if( fpframe->IsIconized() )
|
||||
fpframe->Iconize( false );
|
||||
|
||||
// The display footprint window might be buried under some other
|
||||
// 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.
|
||||
// We do this by a little dance of bringing it to front then the main
|
||||
// frame back.
|
||||
m_DisplayFootprintFrame->Raise(); // Make sure that is visible.
|
||||
Raise(); // .. but still we want the focus.
|
||||
fpframe->Raise(); // Make sure that is visible.
|
||||
Raise(); // .. but still we want the focus.
|
||||
}
|
||||
|
||||
m_DisplayFootprintFrame->InitDisplay();
|
||||
fpframe->InitDisplay();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1039,11 +1029,11 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
|
|||
wxFONTWEIGHT_NORMAL ) );
|
||||
}
|
||||
|
||||
if( m_footprintLibTable )
|
||||
if( FootprintLibs() )
|
||||
{
|
||||
wxArrayString libNames;
|
||||
|
||||
std::vector< wxString > libNickNames = m_footprintLibTable->GetLogicalLibs();
|
||||
std::vector< wxString > libNickNames = FootprintLibs()->GetLogicalLibs();
|
||||
|
||||
for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
|
||||
libNames.Add( libNickNames[ii] );
|
||||
|
@ -1062,3 +1052,10 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
|
|||
|
||||
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 <macros.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <gr_basic.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <kiface_i.h>
|
||||
#include <pgm_base.h>
|
||||
#include <wxstruct.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <cvpcb.h>
|
||||
#include <zones.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
|
@ -57,11 +59,13 @@ const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.eq
|
|||
const wxString titleLibLoadError( _( "Library Load Error" ) );
|
||||
|
||||
|
||||
#if 0 // add this logic to OpenProjectFiles()
|
||||
|
||||
/*
|
||||
* MacOSX: Needed for file association
|
||||
* http://wiki.wxwidgets.org/WxMac-specific_topics
|
||||
*/
|
||||
void EDA_APP::MacOpenFile( const wxString& aFileName )
|
||||
void PGM_BASE::MacOpenFile( const wxString& aFileName )
|
||||
{
|
||||
wxFileName filename = aFileName;
|
||||
wxString oldPath;
|
||||
|
@ -75,76 +79,258 @@ void EDA_APP::MacOpenFile( const wxString& aFileName )
|
|||
oldPath = frame->m_NetlistFileName.GetPath();
|
||||
|
||||
// Update the library search path list.
|
||||
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
||||
wxGetApp().GetLibraryPathList().Remove( oldPath );
|
||||
if( Pgm().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
||||
Pgm().GetLibraryPathList().Remove( oldPath );
|
||||
|
||||
wxGetApp().GetLibraryPathList().Insert( filename.GetPath(), 0 );
|
||||
Pgm().GetLibraryPathList().Insert( filename.GetPath(), 0 );
|
||||
|
||||
frame->m_NetlistFileName = filename;
|
||||
frame->ReadNetListAndLinkFiles();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Create a new application object
|
||||
IMPLEMENT_APP( EDA_APP )
|
||||
namespace CV {
|
||||
|
||||
|
||||
/************************************/
|
||||
/* Called to initialize the program */
|
||||
/************************************/
|
||||
|
||||
bool EDA_APP::OnInit()
|
||||
static struct IFACE : public KIFACE_I
|
||||
{
|
||||
wxFileName filename;
|
||||
wxString message;
|
||||
CVPCB_MAINFRAME* frame = NULL;
|
||||
// Of course all are virtual overloads, implementations of the KIFACE.
|
||||
|
||||
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
|
||||
Set3DShapesPath( wxT(KISYS3DMOD) );
|
||||
set3DShapesPath( wxT("KISYS3DMOD") );
|
||||
|
||||
if( m_Checker && m_Checker->IsAnotherRunning() )
|
||||
{
|
||||
if( !IsOK( NULL, _( "CvPcb is already running, Continue?" ) ) )
|
||||
return false;
|
||||
}
|
||||
/* Now that there are no *.mod files in the standard library, this function
|
||||
has no utility. User should simply set the variable manually.
|
||||
Looking for *.mod files which do not exist is fruitless.
|
||||
|
||||
if( argc > 1 )
|
||||
{
|
||||
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 );
|
||||
// SetFootprintLibTablePath();
|
||||
*/
|
||||
|
||||
g_DrawBgColor = BLACK;
|
||||
|
||||
wxString Title = GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||
frame = new CVPCB_MAINFRAME( Title );
|
||||
|
||||
// Show the frame
|
||||
SetTopWindow( frame );
|
||||
frame->Show( true );
|
||||
frame->m_NetlistFileExtension = wxT( "net" );
|
||||
|
||||
if( filename.IsOk() && filename.FileExists() )
|
||||
try
|
||||
{
|
||||
frame->m_NetlistFileName = filename;
|
||||
frame->LoadProjectFile( filename.GetFullPath() );
|
||||
// The global table is not related to a specific project. All projects
|
||||
// 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();
|
||||
return true;
|
||||
DisplayInfoMessage( NULL, wxT(
|
||||
"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." ) );
|
||||
}
|
||||
}
|
||||
|
||||
frame->UpdateTitle();
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
void IFACE::OnKifaceEnd()
|
||||
{
|
||||
end_common();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <footprint_info.h>
|
||||
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <param_config.h>
|
||||
#include <config_params.h>
|
||||
|
||||
|
||||
/* Forward declarations of all top-level window classes. */
|
||||
|
@ -47,28 +47,22 @@ class DISPLAY_FOOTPRINTS_FRAME;
|
|||
class COMPONENT;
|
||||
class FP_LIB_TABLE;
|
||||
|
||||
namespace CV { struct IFACE; }
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/// 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:
|
||||
bool m_KeepCvpcbOpen;
|
||||
FOOTPRINTS_LISTBOX* m_FootprintList;
|
||||
LIBRARY_LISTBOX* m_LibraryList;
|
||||
COMPONENTS_LISTBOX* m_ListCmp;
|
||||
DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame;
|
||||
wxAuiToolBar* m_mainToolBar;
|
||||
wxFileName m_NetlistFileName;
|
||||
wxArrayString m_ModuleLibNames;
|
||||
|
@ -87,10 +81,24 @@ protected:
|
|||
// (in automatic selection/deletion of associations)
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
|
||||
CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
public:
|
||||
CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||
~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
|
||||
* Called when clicking on a component in component list window
|
||||
|
@ -226,23 +234,9 @@ public:
|
|||
*/
|
||||
void LoadProjectFile( const wxString& aFileName );
|
||||
|
||||
/**
|
||||
* 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 LoadSettings( 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();
|
||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||
|
||||
/**
|
||||
* Function DisplayStatus
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
|
@ -43,18 +43,19 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
|
||||
DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) :
|
||||
DIALOG_CVPCB_CONFIG_FBP( parent )
|
||||
DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* aParent ) :
|
||||
DIALOG_CVPCB_CONFIG_FBP( aParent )
|
||||
{
|
||||
wxString title;
|
||||
wxFileName fn = parent->m_NetlistFileName;
|
||||
wxString title;
|
||||
wxFileName fn = aParent->m_NetlistFileName;
|
||||
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
m_Parent = parent;
|
||||
m_Config = wxGetApp().GetCommonSettings();
|
||||
m_Parent = aParent;
|
||||
m_Config = Pgm().CommonSettings();
|
||||
|
||||
Init( );
|
||||
title.Format( _( "Project file: <%s>" ), GetChars( fn.GetFullPath() ) );
|
||||
title.Format( _( "Project file: '%s'" ), GetChars( fn.GetFullPath() ) );
|
||||
SetTitle( title );
|
||||
|
||||
if( GetSizer() )
|
||||
|
@ -93,7 +94,7 @@ void DIALOG_CVPCB_CONFIG::Init()
|
|||
}
|
||||
|
||||
// Display actual libraries paths:
|
||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
||||
wxPathList libpaths = Pgm().GetLibraryPathList();
|
||||
|
||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||
{
|
||||
|
@ -112,9 +113,9 @@ void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
|
|||
if( m_LibPathChanged )
|
||||
{
|
||||
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 );
|
||||
|
@ -295,7 +296,8 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
insert = true;
|
||||
|
||||
wildcard = FootprintAliasFileWildcard;
|
||||
wxListBox * list = m_ListEquiv;
|
||||
|
||||
wxListBox* list = m_ListEquiv;
|
||||
|
||||
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();
|
||||
|
||||
if( libpath.IsEmpty() )
|
||||
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
|
||||
libpath = Pgm().LastVisitedLibraryPath();
|
||||
|
||||
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
|
||||
wxEmptyString, wildcard,
|
||||
|
@ -334,7 +336,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
fn = Filenames[jj];
|
||||
|
||||
if( jj == 0 )
|
||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||
Pgm().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||
|
||||
/* If the library path is already in the library search paths
|
||||
* 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
|
||||
* is a sub path of these default paths
|
||||
*/
|
||||
libfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fn.GetFullPath() );
|
||||
libfilename = Pgm().FilenameWithRelativePathInSearchList( fn.GetFullPath() );
|
||||
|
||||
// Remove extension:
|
||||
fn = libfilename;
|
||||
|
@ -372,7 +374,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( 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" ),
|
||||
path,
|
||||
|
@ -416,10 +418,10 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
|||
|
||||
m_listUserPaths->Insert( path, ipos );
|
||||
m_LibPathChanged = true;
|
||||
wxGetApp().InsertLibraryPath( path, ipos + 1 );
|
||||
Pgm().InsertLibraryPath( path, ipos + 1 );
|
||||
|
||||
// Display actual libraries paths:
|
||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
||||
wxPathList libpaths = Pgm().GetLibraryPathList();
|
||||
m_DefaultLibraryPathslistBox->Clear();
|
||||
|
||||
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" ) );
|
||||
}
|
||||
|
||||
wxGetApp().SaveLastVisitedLibraryPath( path );
|
||||
Pgm().SaveLastVisitedLibraryPath( path );
|
||||
}
|
||||
|
||||
|
||||
|
@ -445,13 +447,13 @@ void DIALOG_CVPCB_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
|
|||
|
||||
if( ii >= 0 )
|
||||
{
|
||||
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
|
||||
Pgm().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
|
||||
m_listUserPaths->Delete( ii );
|
||||
m_LibPathChanged = true;
|
||||
}
|
||||
|
||||
// Display actual libraries paths:
|
||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
||||
wxPathList libpaths = Pgm().GetLibraryPathList();
|
||||
m_DefaultLibraryPathslistBox->Clear();
|
||||
|
||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||
|
@ -466,7 +468,7 @@ void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
|
|||
wxString FullFileName;
|
||||
wxString docpath, filename;
|
||||
|
||||
docpath = wxGetApp().ReturnLastVisitedLibraryPath( wxT( "doc" ) );
|
||||
docpath = Pgm().LastVisitedLibraryPath( wxT( "doc" ) );
|
||||
|
||||
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
|
||||
wxEmptyString, PdfFileWildcard,
|
||||
|
@ -485,8 +487,8 @@ void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
|
|||
* a sub path of these default paths
|
||||
*/
|
||||
wxFileName fn = FullFileName;
|
||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||
Pgm().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||
|
||||
filename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( FullFileName );
|
||||
filename = Pgm().FilenameWithRelativePathInSearchList( FullFileName );
|
||||
m_TextHelpModulesFileName->SetValue( filename );
|
||||
}
|
||||
|
|
|
@ -14,8 +14,9 @@ class DIALOG_CVPCB_CONFIG : public DIALOG_CVPCB_CONFIG_FBP
|
|||
{
|
||||
private:
|
||||
CVPCB_MAINFRAME* m_Parent;
|
||||
wxConfig * m_Config;
|
||||
wxString m_UserLibDirBufferImg;
|
||||
wxConfigBase* m_Config;
|
||||
wxString m_UserLibDirBufferImg;
|
||||
|
||||
bool m_LibListChanged;
|
||||
bool m_LibPathChanged;
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
* @brief (Re)Create the menubar for CvPcb
|
||||
*/
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <menus_helpers.h>
|
||||
|
@ -74,11 +75,13 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
// Add this menu to list menu managed by m_fileHistory
|
||||
// (the file history will be updated when adding/removing files in history
|
||||
if( openRecentMenu )
|
||||
wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu );
|
||||
Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
|
||||
|
||||
openRecentMenu = new wxMenu();
|
||||
wxGetApp().GetFileHistory().UseMenu( openRecentMenu );
|
||||
wxGetApp().GetFileHistory().AddFilesToMenu();
|
||||
|
||||
Kiface().GetFileHistory().UseMenu( openRecentMenu );
|
||||
Kiface().GetFileHistory().AddFilesToMenu();
|
||||
|
||||
AddMenuItem( filesMenu, openRecentMenu, -1,
|
||||
_( "Open &Recent" ),
|
||||
_( "Open recent netlist" ),
|
||||
|
@ -115,7 +118,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
// Language submenu
|
||||
wxGetApp().AddMenuLanguageList( preferencesMenu );
|
||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||
|
||||
// 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()
|
||||
{
|
||||
COMPONENT* component;
|
||||
|
@ -164,7 +207,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
|||
// Check if footprint links were generated before the footprint library table was implemented.
|
||||
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 "
|
||||
"were not found in the footprint library table:\n\n" ) + missingLibs;
|
||||
|
@ -188,7 +231,9 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
|||
msg.Clear();
|
||||
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 );
|
||||
|
||||
|
@ -270,27 +315,27 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
|
|||
fn.SetExt( ComponentFileExtension );
|
||||
|
||||
// Save the project specific footprint library table.
|
||||
if( !m_footprintLibTable->IsEmpty( false ) )
|
||||
if( !FootprintLibs()->IsEmpty( false ) )
|
||||
{
|
||||
wxFileName fpLibFileName = fn;
|
||||
fpLibFileName.ClearExt();
|
||||
fpLibFileName.SetName( FP_LIB_TABLE::GetFileName() );
|
||||
wxString fp_lib_tbl = Prj().FootprintLibTblName();
|
||||
|
||||
if( fpLibFileName.FileExists()
|
||||
if( wxFileName::FileExists( fp_lib_tbl )
|
||||
&& IsOK( this, _( "A footprint library table already exists in this path.\n\nDo "
|
||||
"you want to overwrite it?" ) ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_footprintLibTable->Save( fpLibFileName );
|
||||
FootprintLibs()->Save( fp_lib_tbl );
|
||||
}
|
||||
catch( IO_ERROR& ioe )
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( this,
|
||||
wxString::Format( _( "An error occurred attempting to save the "
|
||||
"footprint library table <%s>\n\n%s" ),
|
||||
GetChars( fpLibFileName.GetFullPath() ),
|
||||
GetChars( ioe.errorText ) ) );
|
||||
wxString msg = wxString::Format( _(
|
||||
"An error occurred attempting to save the "
|
||||
"footprint library table '%s'\n\n%s" ),
|
||||
GetChars( fp_lib_tbl ),
|
||||
GetChars( ioe.errorText )
|
||||
);
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <kiface_i.h>
|
||||
#include <common.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||
{
|
||||
wxConfig* config = wxGetApp().GetSettings();
|
||||
wxConfigBase* config = Kiface().KifaceSettings();
|
||||
|
||||
if( m_mainToolBar != NULL )
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set( MAKE_LINK_MAPS false )
|
||||
set( MAKE_LINK_MAPS true )
|
||||
|
||||
add_definitions( -DEESCHEMA )
|
||||
|
||||
|
@ -194,11 +194,11 @@ endif()
|
|||
# auto-generate cmp_library_lexer.h and cmp_library_keywords.cpp for the component
|
||||
# library format.
|
||||
make_lexer(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.keywords
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_lexer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.cpp
|
||||
TLIB_T
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.keywords
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_lexer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.cpp
|
||||
TLIB_T
|
||||
)
|
||||
|
||||
make_lexer(
|
||||
${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 )
|
||||
|
||||
add_executable( eeschema WIN32 MACOSX_BUNDLE
|
||||
../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
|
||||
#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}
|
||||
)
|
||||
|
||||
# the DSO (KIFACE) housing the main eeschema code:
|
||||
add_library( eeschema_kiface MODULE
|
||||
${EESCHEMA_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
|
||||
# Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
|
||||
|
@ -262,6 +276,14 @@ if( USE_KIWAY_DLLS )
|
|||
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 )
|
||||
set_target_properties( eeschema_kiface PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||
|
@ -269,31 +291,55 @@ if( USE_KIWAY_DLLS )
|
|||
endif()
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
# generate a link map with cross reference
|
||||
# generate link map with cross reference
|
||||
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()
|
||||
|
||||
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
|
||||
# lib_kicad
|
||||
bitmaps
|
||||
polygon
|
||||
${wxWidgets_LIBRARIES}
|
||||
${GDI_PLUS_LIBRARIES}
|
||||
)
|
||||
|
||||
# Note that this filename is subject to change at milestone C) of
|
||||
# modular-kicad blueprint.
|
||||
install( TARGETS eeschema_kiface
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
else()
|
||||
add_executable( eeschema WIN32 MACOSX_BUNDLE
|
||||
${EESCHEMA_SRCS}
|
||||
${EESCHEMA_COMMON_SRCS}
|
||||
${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"
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
|
@ -302,19 +348,12 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries( eeschema
|
||||
common
|
||||
bitmaps
|
||||
polygon
|
||||
${wxWidgets_LIBRARIES}
|
||||
${GDI_PLUS_LIBRARIES}
|
||||
install( TARGETS eeschema
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
install( TARGETS eeschema
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
|
||||
add_subdirectory( plugins )
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <kiface_i.h>
|
||||
#include <wxEeschemaStruct.h>
|
||||
#include <build_version.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -145,8 +145,8 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
|
|||
return false;
|
||||
|
||||
wxString filename = dlg.GetPath();
|
||||
wxString title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
title += wxT( " " ) + filename;
|
||||
wxString title = wxT( "Eeschema " ) + GetBuildVersion() + wxT( ' ' ) + filename;
|
||||
|
||||
SetTitle( title );
|
||||
|
||||
int response = wxMessageBox( _( "Do you want to force all the footprint fields visibility?" ),
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <pgm_base.h>
|
||||
#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
|
@ -64,7 +64,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
const wxPoint& aPosition, bool aErase );
|
||||
|
||||
|
||||
int SCH_EDIT_FRAME::ReturnBlockCommand( int key )
|
||||
int SCH_EDIT_FRAME::BlockCommand( int key )
|
||||
{
|
||||
int cmd = BLOCK_IDLE;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
|||
bool aErase );
|
||||
|
||||
|
||||
int LIB_EDIT_FRAME::ReturnBlockCommand( int key )
|
||||
int LIB_EDIT_FRAME::BlockCommand( int key )
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -569,7 +569,7 @@ LIB_PIN* LIB_COMPONENT::GetPin( const wxString& aNumber, int aUnit, int aConvert
|
|||
{
|
||||
wxASSERT( pinList[i]->Type() == LIB_PIN_T );
|
||||
|
||||
pinList[i]->ReturnPinStringNum( pNumber );
|
||||
pinList[i]->PinStringNum( pNumber );
|
||||
|
||||
if( aNumber == pNumber )
|
||||
return pinList[i];
|
||||
|
|
|
@ -664,7 +664,7 @@ public:
|
|||
bool IsMulti() { return m_unitCount > 1; }
|
||||
|
||||
/**
|
||||
* Function ReturnSubReference
|
||||
* Function SubReference
|
||||
* @return the sub reference for component having multiple parts per package.
|
||||
* The sub reference identify the part (or unit)
|
||||
* @param aUnit = the part identifier ( 1 to max count)
|
||||
|
@ -672,7 +672,7 @@ public:
|
|||
* by the separator symbol (if any)
|
||||
* 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
|
||||
static int GetSubpartIdSeparator() { return m_subpartIdSeparator; }
|
||||
|
|
|
@ -259,7 +259,7 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
|
|||
i = busNumber.Find( '[' );
|
||||
i++;
|
||||
|
||||
while( busNumber[i] != '.' && i < busNumber.Len() )
|
||||
while( i < busNumber.Len() && busNumber[i] != '.' )
|
||||
{
|
||||
tmp.Append( busNumber[i] );
|
||||
i++;
|
||||
|
@ -267,12 +267,12 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
|
|||
|
||||
tmp.ToLong( &begin );
|
||||
|
||||
while( busNumber[i] == '.' && i < busNumber.Len() )
|
||||
while( i < busNumber.Len() && busNumber[i] == '.' )
|
||||
i++;
|
||||
|
||||
tmp.Empty();
|
||||
|
||||
while( busNumber[i] != ']' && i < busNumber.Len() )
|
||||
while( i < busNumber.Len() && busNumber[i] != ']' )
|
||||
{
|
||||
tmp.Append( busNumber[i] );
|
||||
i++;
|
||||
|
@ -353,7 +353,7 @@ wxString NETLIST_OBJECT::GetShortNetName() const
|
|||
netName = wxT("Net-(");
|
||||
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
|
||||
netName << wxT("-Pad")
|
||||
<< LIB_PIN::ReturnPinStringNum( m_netNameCandidate->m_PinNum )
|
||||
<< LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum )
|
||||
<< wxT(")");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
#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 SCH_COMPONENT;
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
wxString GetPinNumText()
|
||||
{
|
||||
// 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):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue