Upstream merged

This commit is contained in:
Maciej Suminski 2013-04-10 15:03:35 +02:00
commit 07cd3bcb56
409 changed files with 18253 additions and 21802 deletions

View File

@ -49,21 +49,21 @@
#include <3d_draw_basic_functions.h>
// Imported function:
extern void SetGLColor( int color );
extern void SetGLColor( EDA_COLOR_T color );
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
extern void CheckGLError();
/* returns true if aLayer should be displayed, false otherwise
*/
static bool Is3DLayerEnabled( int aLayer );
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
* Z orientation is 1.0 for all layers but "back" layers:
* LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
* used to calculate the Z orientation parameter for glNormal3f
*/
static GLfloat Get3DLayer_Z_Orientation( int aLayer );
static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
void EDA_3D_CANVAS::Redraw( bool finish )
{
@ -163,7 +163,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
Draw3D_Via( (SEGVIA*) track );
else
{
int layer = track->GetLayer();
LAYER_NUM layer = track->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
Draw3D_Track( track );
@ -174,7 +174,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
int layer = pcb->GetArea( ii )->GetLayer();
LAYER_NUM layer = pcb->GetArea( ii )->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
Draw3D_Zone( pcb->GetArea( ii ) );
@ -236,8 +236,8 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
*/
void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
{
int layer = aZone->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
LAYER_NUM layer = aZone->GetLayer();
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
if( layer == LAST_COPPER_LAYER )
@ -326,8 +326,8 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
{
double zpos = 0.0;
int gridcolor = DARKGRAY; // Color of grid lines
int gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
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;
glNormal3f( 0.0, 0.0, 1.0 );
@ -456,8 +456,8 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack )
{
int layer = aTrack->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
LAYER_NUM layer = aTrack->GetLayer();
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
if( layer == LAST_COPPER_LAYER )
@ -475,8 +475,8 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack )
void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
{
int layer, top_layer, bottom_layer;
int color;
LAYER_NUM layer, top_layer, bottom_layer;
EDA_COLOR_T color;
double biu_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits ;
int outer_radius = via->GetWidth() / 2;
@ -486,7 +486,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
via->ReturnLayerPair( &top_layer, &bottom_layer );
// Drawing horizontal thick rings:
for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer )
{
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
@ -530,15 +530,15 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
{
int layer = segment->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
LAYER_NUM layer = segment->GetLayer();
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
SetGLColor( color );
if( layer == EDGE_N )
{
for( layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
for( layer = FIRST_LAYER; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer )
{
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(layer);
@ -552,7 +552,7 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
break;
case S_CIRCLE:
{
{
int radius = KiROUND( hypot( double(segment->GetStart().x - segment->GetEnd().x),
double(segment->GetStart().y - segment->GetEnd().y) )
);
@ -624,8 +624,8 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
{
int layer = text->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
LAYER_NUM layer = text->GetLayer();
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
SetGLColor( color );
s_Text3DZPos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
@ -754,7 +754,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
return;
int color = g_ColorsSettings.GetLayerColor( m_Layer );
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( m_Layer );
SetGLColor( color );
// for outline shape = S_POLYGON:
@ -790,7 +790,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
if( m_Layer == EDGE_N )
{
for( int layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer )
{
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
@ -948,7 +948,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
switch( GetShape() )
{
case PAD_CIRCLE:
for( int layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
if( layer && (layer == nlmax) )
layer = LAYER_N_FRONT;
@ -998,16 +998,14 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
polyPadShape.insert( polyPadShape.end(), holecornersBuffer.begin(),
holecornersBuffer.end() );
}
break;
case PAD_RECT:
case PAD_TRAPEZOID:
{
{
wxPoint coord[5];
BuildPadPolygon( coord, wxSize(0,0), m_Orient );
for( int ii = 0; ii < 4; ii ++ )
{
CPolyPt pt( coord[ii].x + shape_pos.x, coord[ii].y+ shape_pos.y );
polyPadShape.push_back( pt );
@ -1019,7 +1017,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
polyPadShape.insert( polyPadShape.end(), holecornersBuffer.begin(),
holecornersBuffer.end() );
}
break;
break;
default:
break;
@ -1027,7 +1025,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
if( polyPadShape.size() )
{
for( int layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
if( layer && (layer == nlmax) )
layer = LAYER_N_FRONT;
@ -1061,41 +1059,41 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
}
bool Is3DLayerEnabled( int aLayer )
bool Is3DLayerEnabled( LAYER_NUM aLayer )
{
int flg = -1;
int flg;
// see if layer needs to be shown
// check the flags
switch (aLayer)
{
case DRAW_N:
flg=g_Parm_3D_Visu.FL_DRAWINGS;
flg = g_Parm_3D_Visu.FL_DRAWINGS;
break;
case COMMENT_N:
flg=g_Parm_3D_Visu.FL_COMMENTS;
flg = g_Parm_3D_Visu.FL_COMMENTS;
break;
case ECO1_N:
flg=g_Parm_3D_Visu.FL_ECO1;
flg = g_Parm_3D_Visu.FL_ECO1;
break;
case ECO2_N:
flg=g_Parm_3D_Visu.FL_ECO2;
flg = g_Parm_3D_Visu.FL_ECO2;
break;
}
// the layer was not a layer with a flag, so show it
if( flg < 0 )
return true;
default:
// the layer was not a layer with a flag, so show it
return true;
}
// if the layer has a flag, return the flag
return g_Parm_3D_Visu.m_DrawFlags[flg];
}
GLfloat Get3DLayer_Z_Orientation( int aLayer )
GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer )
{
double nZ;

View File

@ -122,10 +122,10 @@ static void Draw3D_VerticalPolygonalCylinder( const std::vector<CPolyPt>& aPolys
}
void SetGLColor( int color )
void SetGLColor( EDA_COLOR_T color )
{
double red, green, blue;
StructColors colordata = ColorRefs[color & MASKCOLOR];
double red, green, blue;
const StructColors &colordata = g_ColorRefs[ColorGetBase( color )];
red = colordata.m_Red / 255.0;
blue = colordata.m_Blue / 255.0;

View File

@ -35,20 +35,35 @@
#include <3d_viewer.h>
#include <info3d_visu.h>
#include "3d_struct.h"
#include "modelparsers.h"
// Imported function:
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
// separator chars
static const char* sep_chars = " \t\n\r";
S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
const wxString aExtension )
{
if ( aExtension == wxT( "x3d" ) )
{
return new X3D_MODEL_PARSER( aMaster );
}
else if ( aExtension == wxT( "wrl" ) )
{
return new VRML_MODEL_PARSER( aMaster );
}
else
{
return NULL;
}
}
int S3D_MASTER::ReadData()
{
char line[1024], * text;
wxFileName fn;
wxString FullFilename;
FILE* file;
int LineNum = 0;
if( m_Shape3DName.IsEmpty() )
{
@ -56,15 +71,17 @@ int S3D_MASTER::ReadData()
}
wxString shape3DNname = m_Shape3DName;
#ifdef __WINDOWS__
shape3DNname.Replace( wxT("/"), wxT("\\") );
shape3DNname.Replace( wxT( "/" ), wxT( "\\" ) );
#else
shape3DNname.Replace( wxT("\\"), wxT("/") );
shape3DNname.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
if( wxFileName::FileExists( shape3DNname ) )
{
FullFilename = shape3DNname;
fn.Assign( FullFilename );
}
else
{
@ -79,512 +96,24 @@ int S3D_MASTER::ReadData()
}
}
file = wxFopen( FullFilename, wxT( "rt" ) );
wxString extension = fn.GetExt();
S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create( this, extension );
if( file == NULL )
if( parser )
{
return -1;
}
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0)
{
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( text == NULL )
continue;
if( *text == '}' )
break;
if( stricmp( text, "children" ) == 0 )
{
ReadChildren( file, &LineNum );
}
}
}
}
fclose( file );
SetLocaleTo_Default(); // revert to the current locale
return 0;
}
int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
{
char line[512], * text, * command;
wxString mat_name;
S3D_MATERIAL* material = NULL;
command = strtok( NULL, sep_chars );
text = strtok( NULL, sep_chars );
mat_name = FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 )
{
for( material = m_Materials; material; material = material->Next() )
{
if( material->m_Name == mat_name )
{
material->SetMaterial();
return 1;
}
}
D( printf( "ReadMaterial error: material not found\n" ) );
parser->Load( FullFilename );
delete parser;
return 0;
}
if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0)
else
{
material = new S3D_MATERIAL( this, mat_name );
Insert( material );
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( text == NULL )
continue;
if( text[0] == '}' )
{
material->SetMaterial();
return 0;
}
if( stricmp( text, "diffuseColor" ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.x = atof( text );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.y = atof( text );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.z = atof( text );
}
else if( stricmp( text, "emissiveColor" ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.x = atof( text );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.y = atof( text );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.z = atof( text );
}
else if( strnicmp( text, "specularColor", 13 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_SpecularColor.x = atof( text );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.y = atof( text );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.z = atof( text );
}
else if( strnicmp( text, "ambientIntensity", 16 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_AmbientIntensity = atof( text );
}
else if( strnicmp( text, "transparency", 12 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_Transparency = atof( text );
}
else if( strnicmp( text, "shininess", 9 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_Shininess = atof( text );
}
}
wxLogDebug( wxT( "Unknown file type <%s>" ), GetChars( extension ) );
}
return -1;
}
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
{
char line[1024], * text;
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( *text == ']' )
return 0;
if( *text == ',' )
continue;
if( stricmp( text, "Shape" ) == 0 )
{
ReadShape( file, LineNum );
}
else
{
D( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) );
break;
}
}
return 1;
}
int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
{
char line[1024], * text;
int err = 1;
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( *text == '}' )
{
err = 0;
break;
}
if( stricmp( text, "appearance" ) == 0 )
{
ReadAppearance( file, LineNum );
}
else if( stricmp( text, "geometry" ) == 0 )
{
ReadGeometry( file, LineNum );
}
else
{
D( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) );
break;
}
}
return err;
}
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
{
char line[1024], * text;
int err = 1;
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( *text == '}' )
{
err = 0; break;
}
if( stricmp( text, "material" ) == 0 )
{
ReadMaterial( file, LineNum );
}
else
{
D( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) );
break;
}
}
return err;
}
#define BUFSIZE 2000
/**
* Function ReadCoordList
* reads 3D coordinate lists like:
* coord Coordinate { point [
* -5.24489 6.57640e-3 -9.42129e-2,
* -5.11821 6.57421e-3 0.542654,
* -3.45868 0.256565 1.32000 ] }
* or:
* normal Normal { vector [
* 0.995171 -6.08102e-6 9.81541e-2,
* 0.923880 -4.09802e-6 0.382683,
* 0.707107 -9.38186e-7 0.707107]
* }
*
* text_buffer contains the first line of this node :
* "coord Coordinate { point ["
*/
void ReadCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, int* LineNum )
{
unsigned int ii = 0, jj = 0;
char* text;
bool HasData = false;
bool StartData = false;
bool EndNode = false;
char string_num[512];
text = text_buffer;
while( !EndNode )
{
if( *text == 0 ) // Needs data !
{
text = text_buffer;
GetLine( file, text_buffer, LineNum, 512 );
}
while( !EndNode && *text )
{
switch( *text )
{
case '[':
StartData = true;
jj = 0;
string_num[jj] = 0;
break;
case '}':
EndNode = true;
break;
case ']':
case '\t':
case ' ':
case ',':
jj = 0;
if( !StartData || !HasData )
break;
aList.push_back( atof( string_num ) );
string_num[jj] = 0;
ii++;
HasData = false;
if( *text == ']' )
{
StartData = false;
}
break;
default:
if( !StartData )
break;
if( jj >= sizeof( string_num ) )
break;
string_num[jj] = *text;
jj++;
string_num[jj] = 0;
HasData = true;
break;
}
text++;
}
}
}
int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
{
char line[1024], buffer[1024], * text;
int err = 1;
std::vector< double > points;
std::vector< double > list;
double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
while( GetLine( file, line, LineNum, 512 ) )
{
strcpy( buffer, line );
text = strtok( buffer, sep_chars );
if( *text == '}' )
{
err = 0;
break;
}
if( stricmp( text, "normalPerVertex" ) == 0 )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
{
}
else
{
}
continue;
}
if( stricmp( text, "colorPerVertex" ) == 0 )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
{
}
else
{
}
continue;
}
if( stricmp( text, "normal" ) == 0 )
{
ReadCoordsList( file, line, list, LineNum );
list.clear();
continue;
}
if( stricmp( text, "normalIndex" ) == 0 )
{
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " ,\t\n\r" );
while( text )
{
if( *text == ']' )
break;
text = strtok( NULL, " ,\t\n\r" );
}
if( text && (*text == ']') )
break;
}
continue;
}
if( stricmp( text, "color" ) == 0 )
{
ReadCoordsList( file, line, list, LineNum );
list.clear();
continue;
}
if( stricmp( text, "solid" ) == 0 )
{
// ignore solid
continue;
}
if( stricmp( text, "colorIndex" ) == 0 )
{
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " ,\t\n\r" );
while( text )
{
if( *text == ']' )
break;
text = strtok( NULL, " ,\t\n\r" );
}
if( text && (*text == ']') )
break;
}
continue;
}
if( stricmp( text, "coord" ) == 0 )
{
ReadCoordsList( file, line, points, LineNum );
}
else if( stricmp( text, "coordIndex" ) == 0 )
{
if( points.size() < 3 || points.size() % 3 != 0 )
{
wxLogError( wxT( "3D geometry read error <%s> at line %d." ),
GetChars( FROM_UTF8( text ) ), *LineNum );
err = 1;
break;
}
std::vector< int > coordIndex;
std::vector< S3D_VERTEX > vertices;
while( GetLine( file, line, LineNum, 512 ) )
{
int jj;
text = strtok( line, " ,\t\n\r" );
while( text )
{
if( *text == ']' )
break;
jj = atoi( text );
if( jj < 0 )
{
for( jj = 0; jj < (int) coordIndex.size(); jj++ )
{
int kk = coordIndex[jj] * 3;
if( (kk < 0) || ((kk + 3) > (int)points.size()) )
{
wxLogError( wxT( "3D geometry index read error <%s> at line %d." ),
GetChars( FROM_UTF8( text ) ), *LineNum );
err = 1;
break;
}
S3D_VERTEX vertex;
vertex.x = points[kk];
vertex.y = points[kk + 1];
vertex.z = points[kk + 2];
vertices.push_back( vertex );
}
Set_Object_Coords( vertices );
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
vertices.clear();
coordIndex.clear();
}
else
{
coordIndex.push_back( jj );
}
text = strtok( NULL, " ,\t\n\r" );
}
if( text && (*text == ']') )
break;
}
}
else
{
wxLogError( wxT( "3D geometry read error <%s> at line %d." ),
GetChars( FROM_UTF8( text ) ), *LineNum );
err = 1;
break;
}
}
return err;
}
int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
{
char line[512];

View File

@ -115,26 +115,6 @@ public:
void Copy( S3D_MASTER* pattern );
int ReadData();
/**
* Function ReadMaterial
* read the description of a 3D material definition in the form:
* DEF yellow material Material (
* DiffuseColor 1.00000 1.00000 0.00000e 0
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
* SpecularColor 1.00000 1.00000 1.00000
* AmbientIntensity 1.00000
* Transparency 0.00000e 0
* Shininess 1.00000
*)
* Or type:
* USE yellow material
*/
int ReadMaterial( FILE* file, int* LineNum );
int ReadChildren( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum );
void Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices );
#if defined(DEBUG)

View File

@ -105,16 +105,16 @@ void EDA_3D_FRAME::ReCreateHToolbar()
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
_( "Move left <-" ) );
_( "Move left" ) );
m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
_( "Move right ->" ) );
_( "Move right" ) );
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
_( "Move up ^" ) );
_( "Move up" ) );
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
_( "Move down v" ) );
_( "Move down" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),

View File

@ -19,6 +19,8 @@ set(3D-VIEWER_SRCS
3d_toolbar.cpp
info3d_visu.cpp
trackball.cpp
x3dmodelparser.cpp
vrmlmodelparser.cpp
)
add_library(3d-viewer STATIC ${3D-VIEWER_SRCS})

View File

@ -135,7 +135,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
}
// calculate z position for each non copper layer
for( int layer_id = FIRST_NO_COPPER_LAYER; layer_id < NB_LAYERS; layer_id++ )
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
{
double zpos;
#define NonCopperLayerThicknessMargin 1.1
@ -184,7 +184,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NO_COPPER_LAYER + 5) *
(layer_id - FIRST_NON_COPPER_LAYER + 5) *
m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
}

View File

@ -93,7 +93,7 @@ public:
double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation
private:
double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized)
double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized)
double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
@ -173,7 +173,7 @@ public: INFO3D_VISU();
*/
int GetLayerObjectThicknessBIU( int aLayerId) const
{
return aLayerId >= FIRST_NO_COPPER_LAYER ?
return aLayerId >= FIRST_NON_COPPER_LAYER ?
GetNonCopperLayerThicknessBIU() :
GetCopperThicknessBIU();
}

192
3d-viewer/modelparsers.h Normal file
View File

@ -0,0 +1,192 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file modelparsers.h
*/
#ifndef MODELPARSERS_H
#define MODELPARSERS_H
#include <map>
#include <vector>
#include <wx/string.h>
class S3D_MASTER;
class S3D_VERTEX;
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
class S3D_MODEL_PARSER;
class X3D_MODEL_PARSER;
/**
* abstract class S3D_MODEL_PARSER
* Base class for 3D model parsers.
*/
class S3D_MODEL_PARSER
{
public:
S3D_MODEL_PARSER(S3D_MASTER* aMaster) :
master( aMaster )
{}
virtual ~S3D_MODEL_PARSER()
{}
S3D_MASTER* GetMaster()
{
return master;
}
/**
* Function Create
* Factory method for creating concrete 3D model parsers
* Notice that the caller is responsible to delete created parser.
*
* @param aMaster is master object that the parser will fill.
* @param aExtension is file extension of the file you are going to parse.
*/
static S3D_MODEL_PARSER* Create( S3D_MASTER* aMaster, const wxString aExtension );
/**
* Function Load
*
* Concrete parsers should implement this function
*/
virtual void Load( const wxString aFilename ) = 0;
private:
S3D_MASTER* master;
};
class wxXmlNode;
/**
* class X3D_MODEL_PARSER
* Implements parser for X3D file format (VRML2.0 successor)
* X3D files can be exported from eg. Blender */
class X3D_MODEL_PARSER: public S3D_MODEL_PARSER
{
public:
X3D_MODEL_PARSER( S3D_MASTER* aMaster );
~X3D_MODEL_PARSER();
void Load( const wxString aFilename );
typedef std::map< wxString, wxString > PROPERTY_MAP;
typedef std::vector< wxXmlNode* > NODE_LIST;
/**
* Function GetChildsByName
* Searches all child nodes with aName.
*
* @param aParent is node to search from
* @param aName is the name of node you try to find
* @param aResult contains found nodes
*/
static void GetChildsByName( wxXmlNode* aParent, const wxString aName, NODE_LIST& aResult );
/**
* Function GetNodeProperties
* Collects all node properties to map.
*
* @param aProps contains map of found properties
*/
static void GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps );
/**
* Return string representing x3d file in vrml format
* Function Load must be called before this function, otherwise empty
* data set is returned.
*/
wxString VRML_representation();
private:
std::vector< wxString > vrml_materials;
std::vector< wxString > vrml_points;
std::vector< wxString > vrml_coord_indexes;
void readTransform( wxXmlNode* aTransformNode );
void readMaterial( wxXmlNode* aMatNode );
void readIndexedFaceSet( wxXmlNode* aFaceNode, PROPERTY_MAP& aTransfromProps );
bool parseDoubleTriplet( const wxString& aData, S3D_VERTEX& aResult );
void rotate( S3D_VERTEX& aCoordinate, S3D_VERTEX& aRotAxis, double angle );
};
/**
* class WRL_MODEL_PARSER
* Parses
*/
class VRML_MODEL_PARSER: public S3D_MODEL_PARSER
{
public:
VRML_MODEL_PARSER( S3D_MASTER* aMaster );
~VRML_MODEL_PARSER();
void Load( const wxString aFilename );
private:
/**
* Function ReadMaterial
* read the description of a 3D material definition in the form:
* DEF yellow material Material (
* DiffuseColor 1.00000 1.00000 0.00000e 0
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
* SpecularColor 1.00000 1.00000 1.00000
* AmbientIntensity 1.00000
* Transparency 0.00000e 0
* Shininess 1.00000
*)
* Or type:
* USE yellow material
*/
int readMaterial( FILE* file, int* LineNum );
int readChildren( FILE* file, int* LineNum );
int readShape( FILE* file, int* LineNum );
int readAppearance( FILE* file, int* LineNum );
int readGeometry( FILE* file, int* LineNum );
/**
* Function ReadCoordList
* reads 3D coordinate lists like:
* coord Coordinate { point [
* -5.24489 6.57640e-3 -9.42129e-2,
* -5.11821 6.57421e-3 0.542654,
* -3.45868 0.256565 1.32000 ] }
* or:
* normal Normal { vector [
* 0.995171 -6.08102e-6 9.81541e-2,
* 0.923880 -4.09802e-6 0.382683,
* 0.707107 -9.38186e-7 0.707107]
* }
*
* text_buffer contains the first line of this node :
* "coord Coordinate { point ["
*/
void readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList,
int* LineNum );
};
#endif // MODELPARSERS_H

View File

@ -0,0 +1,546 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 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 vrmlmodelparser.cpp
*/
#include <fctsys.h>
#include <vector>
#include <macros.h>
#include <kicad_string.h>
#include <info3d_visu.h>
#include "3d_struct.h"
#include "modelparsers.h"
// separator chars
static const char* sep_chars = " \t\n\r";
VRML_MODEL_PARSER::VRML_MODEL_PARSER( S3D_MASTER* aMaster ) :
S3D_MODEL_PARSER( aMaster )
{}
VRML_MODEL_PARSER::~VRML_MODEL_PARSER()
{}
void VRML_MODEL_PARSER::Load( const wxString aFilename )
{
char line[1024], * text;
FILE* file;
int LineNum = 0;
file = wxFopen( aFilename, wxT( "rt" ) );
if( file == NULL )
{
return;
}
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
{
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( text == NULL )
continue;
if( *text == '}' )
break;
if( stricmp( text, "children" ) == 0 )
{
readChildren( file, &LineNum );
}
}
}
}
fclose( file );
SetLocaleTo_Default(); // revert to the current locale
}
int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum )
{
char line[512], * text, * command;
wxString mat_name;
S3D_MATERIAL* material = NULL;
command = strtok( NULL, sep_chars );
text = strtok( NULL, sep_chars );
mat_name = FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 )
{
for( material = GetMaster()->m_Materials; material; material = material->Next() )
{
if( material->m_Name == mat_name )
{
material->SetMaterial();
return 1;
}
}
D( printf( "ReadMaterial error: material not found\n" ) );
return 0;
}
if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0)
{
material = new S3D_MATERIAL( GetMaster(), mat_name );
GetMaster()->Insert( material );
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( text == NULL )
continue;
if( text[0] == '}' )
{
material->SetMaterial();
return 0;
}
if( stricmp( text, "diffuseColor" ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.x = atof( text );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.y = atof( text );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.z = atof( text );
}
else if( stricmp( text, "emissiveColor" ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.x = atof( text );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.y = atof( text );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.z = atof( text );
}
else if( strnicmp( text, "specularColor", 13 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_SpecularColor.x = atof( text );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.y = atof( text );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.z = atof( text );
}
else if( strnicmp( text, "ambientIntensity", 16 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_AmbientIntensity = atof( text );
}
else if( strnicmp( text, "transparency", 12 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_Transparency = atof( text );
}
else if( strnicmp( text, "shininess", 9 ) == 0 )
{
text = strtok( NULL, sep_chars );
material->m_Shininess = atof( text );
}
}
}
return -1;
}
int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum )
{
char line[1024], * text;
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( *text == ']' )
return 0;
if( *text == ',' )
continue;
if( stricmp( text, "Shape" ) == 0 )
{
readShape( file, LineNum );
}
else
{
D( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) );
break;
}
}
return 1;
}
int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum )
{
char line[1024], * text;
int err = 1;
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( *text == '}' )
{
err = 0;
break;
}
if( stricmp( text, "appearance" ) == 0 )
{
readAppearance( file, LineNum );
}
else if( stricmp( text, "geometry" ) == 0 )
{
readGeometry( file, LineNum );
}
else
{
D( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) );
break;
}
}
return err;
}
int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
{
char line[1024], * text;
int err = 1;
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if( *text == '}' )
{
err = 0;
break;
}
if( stricmp( text, "material" ) == 0 )
{
readMaterial( file, LineNum );
}
else
{
D( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) );
break;
}
}
return err;
}
#define BUFSIZE 2000
void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer,
std::vector< double >& aList, int* LineNum )
{
unsigned int ii = 0, jj = 0;
char* text;
bool HasData = false;
bool StartData = false;
bool EndNode = false;
char string_num[512];
text = text_buffer;
while( !EndNode )
{
if( *text == 0 ) // Needs data !
{
text = text_buffer;
GetLine( file, text_buffer, LineNum, 512 );
}
while( !EndNode && *text )
{
switch( *text )
{
case '[':
StartData = true;
jj = 0;
string_num[jj] = 0;
break;
case '}':
EndNode = true;
break;
case ']':
case '\t':
case ' ':
case ',':
jj = 0;
if( !StartData || !HasData )
break;
aList.push_back( atof( string_num ) );
string_num[jj] = 0;
ii++;
HasData = false;
if( *text == ']' )
{
StartData = false;
}
break;
default:
if( !StartData )
break;
if( jj >= sizeof( string_num ) )
break;
string_num[jj] = *text;
jj++;
string_num[jj] = 0;
HasData = true;
break;
}
text++;
}
}
}
int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{
char line[1024], buffer[1024], * text;
int err = 1;
std::vector< double > points;
std::vector< double > list;
double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
while( GetLine( file, line, LineNum, 512 ) )
{
strcpy( buffer, line );
text = strtok( buffer, sep_chars );
if( *text == '}' )
{
err = 0;
break;
}
if( stricmp( text, "normalPerVertex" ) == 0 )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
{
}
else
{
}
continue;
}
if( stricmp( text, "colorPerVertex" ) == 0 )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
{
}
else
{
}
continue;
}
if( stricmp( text, "normal" ) == 0 )
{
readCoordsList( file, line, list, LineNum );
list.clear();
continue;
}
if( stricmp( text, "normalIndex" ) == 0 )
{
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " ,\t\n\r" );
while( text )
{
if( *text == ']' )
break;
text = strtok( NULL, " ,\t\n\r" );
}
if( text && (*text == ']') )
break;
}
continue;
}
if( stricmp( text, "color" ) == 0 )
{
readCoordsList( file, line, list, LineNum );
list.clear();
continue;
}
if( stricmp( text, "solid" ) == 0 )
{
// ignore solid
continue;
}
if( stricmp( text, "colorIndex" ) == 0 )
{
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " ,\t\n\r" );
while( text )
{
if( *text == ']' )
break;
text = strtok( NULL, " ,\t\n\r" );
}
if( text && (*text == ']') )
break;
}
continue;
}
if( stricmp( text, "coord" ) == 0 )
{
readCoordsList( file, line, points, LineNum );
}
else if( stricmp( text, "coordIndex" ) == 0 )
{
if( points.size() < 3 || points.size() % 3 != 0 )
{
wxLogError( wxT( "3D geometry read error <%s> at line %d." ),
GetChars( FROM_UTF8( text ) ), *LineNum );
err = 1;
break;
}
std::vector< int > coordIndex;
std::vector< S3D_VERTEX > vertices;
while( GetLine( file, line, LineNum, 512 ) )
{
int jj;
text = strtok( line, " ,\t\n\r" );
while( text )
{
if( *text == ']' )
break;
jj = atoi( text );
if( jj < 0 )
{
for( jj = 0; jj < (int) coordIndex.size(); jj++ )
{
int kk = coordIndex[jj] * 3;
if( (kk < 0) || ((kk + 3) > (int)points.size()) )
{
wxLogError( wxT( "3D geometry index read error <%s> at line %d." ),
GetChars( FROM_UTF8( text ) ), *LineNum );
err = 1;
break;
}
S3D_VERTEX vertex;
vertex.x = points[kk];
vertex.y = points[kk + 1];
vertex.z = points[kk + 2];
vertices.push_back( vertex );
}
GetMaster()->Set_Object_Coords( vertices );
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
vertices.clear();
coordIndex.clear();
}
else
{
coordIndex.push_back( jj );
}
text = strtok( NULL, " ,\t\n\r" );
}
if( text && (*text == ']') )
break;
}
}
else
{
wxLogError( wxT( "3D geometry read error <%s> at line %d." ),
GetChars( FROM_UTF8( text ) ), *LineNum );
err = 1;
break;
}
}
return err;
}

View File

@ -0,0 +1,491 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file x3dmodelparser.cpp
*/
#include <fctsys.h>
#include <macros.h>
#include <info3d_visu.h>
#include <wx/xml/xml.h>
#include <wx/tokenzr.h>
#include <wx/string.h>
#include <map>
#include <queue>
#include <vector>
#include "3d_struct.h"
#include "modelparsers.h"
X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
S3D_MODEL_PARSER( aMaster )
{}
X3D_MODEL_PARSER::~X3D_MODEL_PARSER()
{}
void X3D_MODEL_PARSER::Load( const wxString aFilename )
{
wxXmlDocument doc;
if( !doc.Load( aFilename ) )
{
wxLogError( wxT( "Error while parsing file <%s>" ), GetChars( aFilename ) );
return;
}
if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
{
wxLogError( wxT( "Filetype is not X3D <%s>" ), GetChars( aFilename ) );
return;
}
// Shapes are inside of Transform nodes
// Transform node contains information about
// transition, scale and rotation of the shape
NODE_LIST transforms;
GetChildsByName( doc.GetRoot(), wxT( "Transform" ), transforms );
for( NODE_LIST::iterator node_it = transforms.begin();
node_it != transforms.end();
node_it++ )
{
readTransform( *node_it );
}
}
wxString X3D_MODEL_PARSER::VRML_representation()
{
wxString output;
for( unsigned i = 0; i < vrml_points.size(); i++ )
{
output += wxT( "Shape {\n"
" appearance Appearance {\n"
" material Material {\n" ) +
vrml_materials[i] +
wxT( " }\n"
" }\n"
" geometry IndexedFaceSet {\n"
" solid TRUE\n"
" coord Coordinate {\n"
" point [\n") +
vrml_points[i] +
wxT( " ]\n"
" }\n"
" coordIndex [\n" ) +
vrml_coord_indexes[i] +
wxT( " ]\n"
" }\n"
"},\n" );
}
return output;
}
void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent,
const wxString aName,
std::vector< wxXmlNode* >& aResult )
{
// Breadth-first search (BFS)
std::queue< wxXmlNode* > found;
found.push( aParent );
while( !found.empty() )
{
wxXmlNode *elem = found.front();
for( wxXmlNode *child = elem->GetChildren();
child != NULL;
child = child->GetNext() )
{
if( child->GetName() == aName )
{
aResult.push_back( child );
}
found.push( child );
}
found.pop();
}
}
void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps )
{
wxXmlProperty *prop;
for( prop = aNode->GetAttributes();
prop != NULL;
prop = prop->GetNext() )
{
aProps[ prop->GetName() ] = prop->GetValue();
}
}
/* Private ----- */
void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
{
NODE_LIST childnodes;
GetChildsByName( aTransformNode, wxT( "Material" ), childnodes );
for( NODE_LIST::iterator node = childnodes.begin();
node != childnodes.end();
node++ )
{
readMaterial( *node );
}
childnodes.clear();
PROPERTY_MAP properties;
GetNodeProperties( aTransformNode, properties );
GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes );
for( NODE_LIST::iterator node = childnodes.begin();
node != childnodes.end();
node++ )
{
readIndexedFaceSet( *node, properties );
}
childnodes.clear();
}
void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
{
PROPERTY_MAP properties;
GetNodeProperties( aMatNode, properties );
// DEFine new Material named as value of DEF
if( properties.find( wxT( "DEF" ) ) != properties.end() )
{
double amb, shine, transp;
S3D_MATERIAL* material = new S3D_MATERIAL( GetMaster(), properties[ wxT( "DEF" ) ] );
GetMaster()->Insert( material );
if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ],
material->m_DiffuseColor ) )
{
D( printf("diffuseColor parsing error") );
}
if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ],
material->m_SpecularColor ) )
{
D( printf("specularColor parsing error") );
}
if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ],
material->m_EmissiveColor ) )
{
D( printf("emissiveColor parsing error") );
}
wxStringTokenizer values;
values.SetString( properties[ wxT( "ambientIntensity" ) ] );
if( values.GetNextToken().ToDouble( &amb ) )
{
material->m_AmbientIntensity = amb;
}
else
{
D( printf( "ambienterror" ) );
}
values.SetString( properties[ wxT( "shininess" ) ] );
if( values.GetNextToken().ToDouble( &shine ) )
{
material->m_Shininess = shine;
}
else
{
D( printf( "shininess error" ) );
}
values.SetString( properties[ wxT( "transparency" ) ] );
if( values.GetNextToken().ToDouble( &transp ) )
{
material->m_Transparency = transp;
}
else
{
D( printf( "trans error") );
}
material->SetMaterial();
// VRML
wxString vrml_material;
PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF
for(;p != properties.end();p++)
{
vrml_material.Append( p->first + wxT( " " ) + p->second + wxT( "\n" ) );
}
vrml_materials.push_back( vrml_material );
}
// USE existing material named by value of USE
else if( properties.find( wxT( "USE" ) ) != properties.end() )
{
S3D_MATERIAL* material = NULL;
wxString mat_name = properties[ wxT( "USE" ) ];
for( material = GetMaster()->m_Materials; material; material = material->Next() )
{
if( material->m_Name == mat_name )
{
wxString vrml_material;
vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n" ),
material->m_SpecularColor.x,
material->m_SpecularColor.y,
material->m_SpecularColor.z ) );
vrml_material.Append( wxString::Format( wxT( "diffuseColor %f %f %f\n" ),
material->m_DiffuseColor.x,
material->m_DiffuseColor.y,
material->m_DiffuseColor.z ) );
vrml_material.Append( wxString::Format( wxT( "emissiveColor %f %f %f\n" ),
material->m_EmissiveColor.x,
material->m_EmissiveColor.y,
material->m_EmissiveColor.z ) );
vrml_material.Append( wxString::Format( wxT( "ambientIntensity %f\n"),
material->m_AmbientIntensity ) );
vrml_material.Append( wxString::Format( wxT( "shininess %f\n"),
material->m_Shininess ) );
vrml_material.Append( wxString::Format( wxT( "transparency %f\n"),
material->m_Transparency ) );
vrml_materials.push_back( vrml_material );
material->SetMaterial();
return;
}
}
D( printf( "ReadMaterial error: material not found\n" ) );
}
}
bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData,
S3D_VERTEX& aResult )
{
wxStringTokenizer tokens(aData);
return tokens.GetNextToken().ToDouble( &aResult.x ) &&
tokens.GetNextToken().ToDouble( &aResult.y ) &&
tokens.GetNextToken().ToDouble( &aResult.z );
}
void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV,
S3D_VERTEX& aU,
double angle )
{
S3D_VERTEX rotated;
double C = cos( angle );
double S = sin( angle );
double t = 1.0 - C;
rotated.x = ( t * aU.x * aU.x + C ) * aV.x +
( t * aU.x * aU.y - S * aU.z ) * aV.y +
( t * aU.x * aU.z + S * aU.y ) * aV.z;
rotated.y = ( t * aU.x * aU.y + S * aU.z ) * aV.x +
( t * aU.y * aU.y + C ) * aV.y +
( t * aU.y * aU.z - S * aU.x ) * aV.z;
rotated.z = ( t * aU.x * aU.z - S * aU.y ) * aV.x +
( t * aU.y * aU.z + S * aU.x ) * aV.y +
( t * aU.z * aU.z + C) * aV.z;
aV.x = rotated.x;
aV.y = rotated.y;
aV.z = rotated.z;
}
/* Steps:
* 1. Read transform data
* 2. Read vertex triplets
* 3. Read coordinate indexes
* 4. Apply geometry to Master object
*/
void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
PROPERTY_MAP& aTransformProps)
{
/* Step 1: Read transform data
* --------------------------- */
S3D_VERTEX translation;
parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], translation );
S3D_VERTEX scale;
parseDoubleTriplet( aTransformProps[ wxT( "scale" ) ], scale );
S3D_VERTEX rotation;
double angle = 0.0;
wxStringTokenizer tokens(aTransformProps[ wxT( "rotation" ) ]);
if( !(tokens.GetNextToken().ToDouble( &rotation.x ) &&
tokens.GetNextToken().ToDouble( &rotation.y ) &&
tokens.GetNextToken().ToDouble( &rotation.z ) &&
tokens.GetNextToken().ToDouble( &angle ) ) )
{
D( printf("rotation read error") );
}
double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits *
UNITS3D_TO_UNITSPCB;
/* Step 2: Read all coordinate points
* ---------------------------- */
std::vector< double > points;
NODE_LIST coordinates;
GetChildsByName( aFaceNode, wxT( "Coordinate" ), coordinates);
PROPERTY_MAP coordinate_properties;
// IndexedFaceSet has one Coordinate child node
GetNodeProperties( coordinates[0], coordinate_properties );
// Save points to vector as doubles
wxStringTokenizer point_tokens( coordinate_properties[ wxT("point") ] );
double point = 0.0;
while( point_tokens.HasMoreTokens() )
{
if( point_tokens.GetNextToken().ToDouble( &point ) )
{
points.push_back( point );
}
else
{
wxLogError( wxT( "Error converting to double" ) );
}
}
if( points.size() % 3 != 0 )
{
D( printf( "Number of points is incorrect" ) );
return;
}
/* Create 3D vertex from 3 points and
* apply transforms in order of SCALE, ROTATION, TRANSLATION
*/
wxString vrml_pointlist;
std::vector< S3D_VERTEX > triplets;
for( unsigned id = 0; id < points.size() / 3; id++ )
{
int triplet_indx = id * 3;
S3D_VERTEX point( points[ triplet_indx ],
points[ triplet_indx + 1 ],
points[ triplet_indx + 2 ] );
point.x *= scale.x;
point.y *= scale.y;
point.z *= scale.z;
rotate( point, rotation, angle );
point.x += translation.x;
point.y += translation.y;
point.z += translation.z;
triplets.push_back(point);
// VRML
vrml_pointlist.Append( wxString::Format( wxT( "%f %f %f\n" ), point.x, point.y, point.z ) );
}
vrml_points.push_back( vrml_pointlist );
/* -- Read coordinate indexes -- */
PROPERTY_MAP faceset_properties;
GetNodeProperties( aFaceNode, faceset_properties );
std::vector< S3D_VERTEX > vertices;
std::vector< int > coordIndex;
wxString coordIndex_str = faceset_properties[ wxT( "coordIndex" ) ];
wxStringTokenizer index_tokens( coordIndex_str );
wxString vrml_coord_indx_list;
while( index_tokens.HasMoreTokens() )
{
long index = 0;
index_tokens.GetNextToken().ToLong( &index );
// -1 marks the end of polygon
if( index < 0 )
{
/* Step 4: Apply geometry to Master object
* --------------------------------------- */
std::vector<int>::const_iterator id;
for( id = coordIndex.begin();
id != coordIndex.end();
id++ )
{
vertices.push_back( triplets.at( *id ) );
}
GetMaster()->Set_Object_Coords( vertices );
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
vertices.clear();
coordIndex.clear();
vrml_coord_indx_list.Append( wxT( "-1\n" ) );
}
else
{
coordIndex.push_back( index );
vrml_coord_indx_list.Append( wxString::Format( wxT( "%u " ), index ) );
}
}
vrml_coord_indexes.push_back( vrml_coord_indx_list );
}

View File

@ -42,7 +42,7 @@ option(KICAD_STABLE_VERSION
)
option(KICAD_TESTING_VERSION
"set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)"
"set this option to ON to build the testing version of KICAD. mainly used to set version ID (default OFF)"
)
option(KICAD_SCRIPTING

View File

@ -2,9 +2,9 @@ Contribute to KiCad (under Linux)
--------------------
1) make sure you have all the dependencies of KiCad:
sudo apt-get install debhelper dpatch libx11-dev
sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev
sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
sudo apt-get install debhelper dpatch libx11-dev
sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev
sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
sudo apt-get install cmake bzr
2) initialize Bazaar:
@ -24,18 +24,20 @@ Contribute to KiCad (under Linux)
cd kicad_john
mkdir build; cd build
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Debug
to build a debug version
or
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release
to build a release version
make -j 4 # this is for a 4 core machine
7) Repeat step 5 and 6 until satisfied.
8) Delete the "build" folder and create a patch:
cd kicad_john
rm -R ./build
bzr add .
bzr status
bzr diff > gui_better_zoom.patch
8) Create a patch:
in kicad_john:
if some files are added: bzr add [FILE...]
bzr diff > my_changes.patch
9) Send the patch file "gui_better_zoom.patch" to the KiCad developers mailing list.
9) Send the patch file "my_changes.patch" to the KiCad developers mailing list.
in the subject of the e-mail include the keyword "[PATCH]".
in the body of the e-mail clearly explain what you have done.

View File

@ -5,16 +5,15 @@ Documentation subfolder.
Files
-----
AUTHORS.txt - The authors, contributors, document writers and translators list
CHANGELOG.txt - This years changelog (see for previous years Documentation/changelogs)
CMakeList.txt - CMAKE build tool script
COPYRIGHT.txt - A copy of the GNU General Public License Version 2
CTestConfig.txt - Support for CTest and CDash testing tools
Doxyfile - Doxygen preferences
INSTALL.txt - The release (binairy) installation instructions
TODO.txt - Todo list
uncrustify.cfg - Uncrustify code formatting tool preferences
version.txt - The current stable released version
AUTHORS.txt - The authors, contributors, document writers and translators list
CHANGELOG.txt - This years changelog (see for previous years Documentation/changelogs)
CMakeList.txt - CMAKE build tool script
COPYRIGHT.txt - A copy of the GNU General Public License Version 2
CTestConfig.cmake - Support for CTest and CDash testing tools
Doxyfile - Doxygen config file for Kicad
INSTALL.txt - The release (binairy) installation instructions
TODO.txt - Todo list
uncrustify.cfg - Uncrustify config file for uncrustify sorces formatting tool
Subdirectories
--------------
@ -37,6 +36,6 @@ packaging - Files for packaging on Windows and Mac OSX
pcbnew - Sourcecode of the printed circuit board editor
polygon - Sourcecode of the polygon library
resources - Resources for installation, freedesktop mime-types for linux
scripts - Helper scripts. For building, sourcecode packaging, font setting, pcb adjusting.
scripts - Helper scripts. For building, sourcecode packaging.
template - Project template(s)

View File

@ -26,13 +26,14 @@
// For some unknown reasons, polygon.hpp shoul be included first
#include <boost/polygon/polygon.hpp>
#include <wx/wx.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <cmath>
#include <vector>
#include <layers_id_colors_and_visibility.h>
#include <potracelib.h>
#include <auxiliary.h>
@ -310,8 +311,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
case PCBNEW_FMT:
{
#define SILKSCREEN_N_FRONT 21
int layer = SILKSCREEN_N_FRONT;
LAYER_NUM layer = SILKSCREEN_N_FRONT;
int width = 1;
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
0, 0, 0, 0,

View File

@ -92,6 +92,7 @@ set(COMMON_SRCS
netlist_keywords.cpp
newstroke_font.cpp
projet_config.cpp
ptree.cpp
richio.cpp
selcolor.cpp
string.cpp
@ -135,7 +136,6 @@ set(PCB_COMMON_SRCS
../pcbnew/class_marker_pcb.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_module.cpp
../pcbnew/class_module_transform_functions.cpp
../pcbnew/class_pad.cpp
../pcbnew/class_pad_draw_functions.cpp
../pcbnew/class_pcb_text.cpp

View File

@ -90,7 +90,7 @@ void EDA_ITEM::InitVars()
void EDA_ITEM::SetModified()
{
m_Flags |= IS_CHANGED;
SetFlags( IS_CHANGED );
// If this a child object, then the parent modification state also needs to be set.
if( m_Parent )

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -289,7 +289,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
if( !wxFileName::FileExists( fn ) )
{
msg = type + _( " file <" ) + fn + _( "> was not found." );
msg.Printf( wxT( "file <%s> was not found." ), GetChars( fn ) );
wxMessageBox( msg );
fileHistory->RemoveFileFromHistory( i );
fn = wxEmptyString;
@ -388,7 +388,8 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
wildcard += wxT( ".exe" );
#endif
wildcard = _( "Executable file (" ) + wildcard + wxT( ")|" ) + wildcard;
wildcard.Printf( _( "Executable file (%s)|%s" ),
GetChars( wildcard ), GetChars( wildcard ) );
wxFileDialog dlg( this, _( "Select Preferred Editor" ), fn.GetPath(),
fn.GetFullName(), wildcard,
@ -644,7 +645,8 @@ edits you made?" ),
// Rename the old file to the backup file name.
if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
msg = _( "Could not create backup file " ) + backupFileName.GetFullPath();
msg.Printf( _( "Could not create backup file <%s>" ),
GetChars( backupFileName.GetFullPath() ) );
wxMessageBox( msg );
}
}

View File

@ -108,7 +108,7 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
break;
default:
msg = wxT( "????" );
msg = wxT( "???" );
break;
}

View File

@ -36,34 +36,27 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{
LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE
BROWN, // VIA_BBLIND_VISIBLE
LIGHTGRAY, // VIA_THROUGH_VISIBLE
LIGHTGRAY, // MOD_TEXT_FR_VISIBLE
LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE
BROWN, // VIA_BBLIND_VISIBLE
LIGHTGRAY, // VIA_THROUGH_VISIBLE
YELLOW, // NON_PLATED_VISIBLE
LIGHTGRAY, // MOD_TEXT_FR_VISIBLE
BLUE, // MOD_TEXT_BK_VISIBLE
DARKGRAY, // MOD_TEXT_INVISIBLE
BLUE, // ANCHOR_VISIBLE
RED, // PAD_FR_VISIBLE
GREEN, // PAD_BK_VISIBLE
LIGHTGRAY, // RATSNEST_VISIBLE
DARKGRAY, //GRID_VISIBLE
DARKGRAY, // GRID_VISIBLE
LIGHTRED, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY
};
COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = default_layer_color[ii];
@ -78,7 +71,7 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
@ -93,7 +86,7 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{

View File

@ -65,14 +65,14 @@ int LAYER_BOX_SELECTOR::GetChoice()
// Get Current Layer
int LAYER_BOX_SELECTOR::GetLayerSelection()
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
{
return (long) GetClientData( GetSelection() );
return (LAYER_NUM)((unsigned long) GetClientData( GetSelection() ) );
}
// Set Layer #
int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
{
int elements = GetCount();
@ -97,8 +97,8 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
int elements = GetCount();
for( int i = 0; i < elements; i++ )
LAYER_NUM elements = GetCount();
for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i )
{
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
@ -106,14 +106,14 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
}
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex )
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
{
wxMemoryDC bmpDC;
wxBrush brush;
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayerIndex ) ) );
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );

View File

@ -330,7 +330,7 @@ void PAGE_INFO::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContro
GetCustomWidthMils() * 25.4 / 1000.0,
GetCustomHeightMils() * 25.4 / 1000.0 );
if( IsCustom() && IsPortrait() )
if( !IsCustom() && IsPortrait() )
aFormatter->Print( 0, " portrait" );
aFormatter->Print( 0, ")\n" );

View File

@ -195,7 +195,7 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
}
int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
STATUS_FLAGS PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
{
if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].GetFlags();
@ -253,7 +253,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx
}
bool PICKED_ITEMS_LIST::SetPickerFlags( int aFlags, unsigned aIdx )
bool PICKED_ITEMS_LIST::SetPickerFlags( STATUS_FLAGS aFlags, unsigned aIdx )
{
if( aIdx < m_ItemsList.size() )
{

View File

@ -52,14 +52,9 @@ wxString g_ProductName = wxT( "KiCad E.D.A. " );
bool g_ShowPageLimits = true;
wxString g_UserLibDirBuffer;
wxString g_Prj_Default_Config_FullFilename;
wxString g_Prj_Config_LocalFilename;
EDA_UNITS_T g_UserUnit;
EDA_COLOR_T g_GhostColor;
#if defined(KICAD_GOST)
static const bool s_gost = true;
#else
@ -77,34 +72,40 @@ bool IsGOST()
* 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 NBCOLOR items
* This list must have exactly NBCOLORS items
*/
StructColors ColorRefs[NBCOLOR] =
const StructColors g_ColorRefs[NBCOLORS] =
{
{ 0, 0, 0, BLACK, wxT( "BLACK" ), DARKDARKGRAY },
{ 192, 0, 0, BLUE, wxT( "BLUE" ), LIGHTBLUE },
{ 0, 160, 0, GREEN, wxT( "GREEN" ), LIGHTGREEN },
{ 160, 160, 0, CYAN, wxT( "CYAN" ), LIGHTCYAN },
{ 0, 0, 160, RED, wxT( "RED" ), LIGHTRED },
{ 160, 0, 160, MAGENTA, wxT( "MAGENTA" ), LIGHTMAGENTA },
{ 0, 128, 128, BROWN, wxT( "BROWN" ), YELLOW },
{ 192, 192, 192, LIGHTGRAY, wxT( "GRAY" ), WHITE },
{ 128, 128, 128, DARKGRAY, wxT( "DARKGRAY" ), LIGHTGRAY },
{ 255, 0, 0, LIGHTBLUE, wxT( "LIGHTBLUE" ), LIGHTBLUE },
{ 0, 255, 0, LIGHTGREEN, wxT( "LIGHTGREEN" ), LIGHTGREEN },
{ 255, 255, 0, LIGHTCYAN, wxT( "LIGHTCYAN" ), LIGHTCYAN },
{ 0, 0, 255, LIGHTRED, wxT( "LIGHTRED" ), LIGHTRED },
{ 255, 0, 255, LIGHTMAGENTA, wxT( "LIGHTMAGENTA" ), LIGHTMAGENTA },
{ 0, 255, 255, YELLOW, wxT( "YELLOW" ), YELLOW },
{ 255, 255, 255, WHITE, wxT( "WHITE" ), WHITE },
{ 64, 64, 64, DARKDARKGRAY, wxT( "DARKDARKGRAY" ), DARKGRAY },
{ 64, 0, 0, DARKBLUE, wxT( "DARKBLUE" ), BLUE },
{ 0, 64, 0, DARKGREEN, wxT( "DARKGREEN" ), GREEN },
{ 64, 64, 0, DARKCYAN, wxT( "DARKCYAN" ), CYAN },
{ 0, 0, 80, DARKRED, wxT( "DARKRED" ), RED },
{ 64, 0, 64, DARKMAGENTA, wxT( "DARKMAGENTA" ), MAGENTA },
{ 0, 64, 64, DARKBROWN, wxT( "DARKBROWN" ), BROWN },
{ 128, 255, 255, LIGHTYELLOW, wxT( "LIGHTYELLOW" ), LIGHTYELLOW }
{ 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 },
};

View File

@ -45,7 +45,7 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
SetDefaultLineWidth( 0 ); // No line width on DXF
plotMirror = false; // No mirroring on DXF
currentColor = BLACK;
m_currentColor = BLACK;
}
/**
@ -151,7 +151,7 @@ bool DXF_PLOTTER::StartPlot()
" 2\n"
"LAYER\n"
" 70\n"
"%d\n", NBCOLOR );
"%d\n", NBCOLORS );
/* The layer/colors palette. The acad/DXF palette is divided in 3 zones:
@ -159,7 +159,7 @@ bool DXF_PLOTTER::StartPlot()
- An HSV zone (10-250, 5 values x 2 saturations x 10 hues
- Greys (251 - 255)
The is *no* black... the white does it on paper, usually, and
There is *no* black... the white does it on paper, usually, and
anyway it depends on the plotter configuration, since DXF colors
are meant to be logical only (they represent *both* line color and
width); later version with plot styles only complicate the matter!
@ -170,36 +170,41 @@ bool DXF_PLOTTER::StartPlot()
static const struct {
const char *name;
int color;
} dxf_layer[NBCOLOR] = {
{ "BLACK", 250 },
{ "BLUE", 5 },
{ "GREEN", 3 },
{ "CYAN", 4 },
{ "RED", 1 },
{ "MAGENTA", 6 },
{ "BROWN", 54 },
{ "LIGHTGRAY", 9 },
{ "DARKGRAY", 8 },
{ "LIGHTBLUE", 171 },
{ "LIGHTGREEN", 91 },
{ "LIGHTCYAN", 131 },
{ "LIGHTRED", 11 },
{ "LIGHTMAGENTA", 221 },
{ "YELLOW", 2 },
{ "WHITE", 7 },
{ "DARKDARKGRAY", 251 },
{ "DARKBLUE", 178 },
{ "DARKGREEN", 98 },
{ "DARKCYAN", 138 },
{ "DARKRED", 18 },
{ "DARKMAGENTA", 228 },
{ "DARKBROWN", 58 },
{ "LIGHTYELLOW", 51 },
} dxf_layer[NBCOLORS] = {
{ "BLACK", 7 }, // In DXF, color 7 is *both* white and black!
{ "GRAY1", 251 },
{ "GRAY2", 8 },
{ "GRAY3", 9 },
{ "WHITE", 7 },
{ "LYELLOW", 51 },
{ "BLUE1", 178 },
{ "GREEN1", 98 },
{ "CYAN1", 138 },
{ "RED1", 18 },
{ "MAGENTA1", 228 },
{ "BROWN1", 58 },
{ "BLUE2", 5 },
{ "GREEN2", 3 },
{ "CYAN2", 4 },
{ "RED2", 1 },
{ "MAGENTA2", 6 },
{ "BROWN2", 54 },
{ "BLUE3", 171 },
{ "GREEN3", 91 },
{ "CYAN3", 131 },
{ "RED3", 11 },
{ "MAGENTA3", 221 },
{ "YELLOW3", 2 },
{ "BLUE4", 5 },
{ "GREEN4", 3 },
{ "CYAN4", 4 },
{ "RED4", 1 },
{ "MAGENTA4", 6 },
{ "YELLOW4", 2 }
};
for( int i = 0; i < NBCOLOR; i++ )
for( EDA_COLOR_T i = BLACK; i < NBCOLORS; i = NextColor(i) )
{
wxString cname = ColorRefs[i].m_Name;
fprintf( outputFile,
" 0\n"
"LAYER\n"
@ -254,10 +259,10 @@ void DXF_PLOTTER::SetColor( EDA_COLOR_T color )
|| ( color == BLACK )
|| ( color == WHITE ) )
{
currentColor = color;
m_currentColor = color;
}
else
currentColor = BLACK;
m_currentColor = BLACK;
}
/**
@ -287,7 +292,7 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
DPOINT centre_dev = userToDeviceCoordinates( centre );
if( radius > 0 )
{
wxString cname = ColorRefs[currentColor].m_Name;
wxString cname( ColorGetName( m_currentColor ) );
if (!fill)
{
fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
@ -349,7 +354,7 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
if( penLastpos != pos && plume == 'D' )
{
// DXF LINE
wxString cname = ColorRefs[currentColor].m_Name;
wxString cname( ColorGetName( m_currentColor ) );
fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
TO_UTF8( cname ),
pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
@ -396,7 +401,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad
double radius_dev = userToDeviceSize( radius );
// Emit a DXF ARC entity
wxString cname = ColorRefs[currentColor].m_Name;
wxString cname( ColorGetName( m_currentColor ) );
fprintf( outputFile,
"0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n",
TO_UTF8( cname ),
@ -570,7 +575,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
more useful as a CAD object */
DPOINT origin_dev = userToDeviceCoordinates( aPos );
SetColor( aColor );
wxString cname = ColorRefs[currentColor].m_Name;
wxString cname( ColorGetName( m_currentColor ) );
DPOINT size_dev = userToDeviceSize( aSize );
int h_code = 0, v_code = 0;
switch( aH_justify )

View File

@ -39,9 +39,9 @@ void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color )
if( colorMode )
{
double r = ColorRefs[color].m_Red / 255.0;
double g = ColorRefs[color].m_Green / 255.0;
double b = ColorRefs[color].m_Blue / 255.0;
double r = g_ColorRefs[color].m_Red / 255.0;
double g = g_ColorRefs[color].m_Green / 255.0;
double b = g_ColorRefs[color].m_Blue / 255.0;
if( negativeMode )
emitSetRGBColor( 1 - r, 1 - g, 1 - b );
else

View File

@ -59,17 +59,16 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
int iusPerMil = plotter->GetIUsPerDecimil() * 10;
wxSize pageSize = aPageInfo.GetSizeMils(); // in mils
int xg, yg;
wxPoint pos, ref;
#if defined( KICAD_GOST )
int refx, refy;
#endif
wxPoint pos, end, ref;
wxString msg;
wxSize text_size;
#if defined(KICAD_GOST)
wxSize text_size2;
wxSize text_size3;
wxSize text_size1_5;
#else
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
#endif
EDA_COLOR_T plotClr;
plotClr = plotter->GetColorMode() ? RED : BLACK;
@ -84,6 +83,19 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ) * iusPerMil;
#if defined(KICAD_GOST)
int lnMsg, ln;
text_size.x = SIZETEXT * iusPerMil;
text_size.y = SIZETEXT * iusPerMil;
wxSize sz;
wxSize text_size0_8( SIZETEXT * iusPerMil * 0.8, SIZETEXT * iusPerMil * 1 );
wxSize text_size1_5( SIZETEXT * iusPerMil * 1.5, SIZETEXT * iusPerMil * 1.5 );
wxSize text_size2( SIZETEXT * iusPerMil * 2, SIZETEXT * iusPerMil * 2 );
wxSize text_size3( SIZETEXT * iusPerMil * 3, SIZETEXT * iusPerMil * 3 );
int lineOsn_widht = plotter->GetCurrentLineWidth() * 2;
int lineTonk_widht = plotter->GetCurrentLineWidth();
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( ref );
pos.x = xg;
pos.y = ref.y;
@ -95,6 +107,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
pos.y = yg;
plotter->LineTo( pos );
plotter->FinishTo( ref );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
#else
@ -125,9 +138,6 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
#endif
text_size.x = WSTEXTSIZE * iusPerMil;
text_size.y = WSTEXTSIZE * iusPerMil;
// upper left corner in mils
ref.x = aPageInfo.GetLeftMarginMils();
ref.y = aPageInfo.GetTopMarginMils();
@ -137,56 +147,516 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() );
#if defined(KICAD_GOST)
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
// Lower right corner
refx = xg;
refy = yg;
// First page
if( aSheetNumber == 1 )
{
for( Ki_WorkSheetData* WsItem = &WS_Osn1_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * iusPerMil;
pos.y = (refy - WsItem->m_Posy) * iusPerMil;
end.x = (refx - WsItem->m_Endx) * iusPerMil;
end.y = (refy - WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn1_Text1 )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size0_8,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
else
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
}
}
// Sheet number
if( aNumberOfSheets > 1 )
{
pos.x = (refx - Mm2mils( 36 )) * iusPerMil;
pos.y = (refy - Mm2mils( 17.5 )) * iusPerMil;
msg.Empty();
msg << aSheetNumber;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Count of sheets
pos.x = (refx - Mm2mils( 10 )) * iusPerMil;
pos.y = (refy - Mm2mils( 17.5 )) * iusPerMil;
msg.Empty();
msg << aNumberOfSheets;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
// Company name
msg = aTitleBlock.GetCompany();
if( !msg.IsEmpty() )
{
sz = text_size1_5;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 49 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 25 )) * iusPerMil;
pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Title
msg = aTitleBlock.GetTitle();
if( !msg.IsEmpty() )
{
sz = text_size1_5;
wxArrayString lines;
int titleWidth = 0;
int titleHeight = (sz.y + sz.y * 0.5) / iusPerMil;
int titleFieldWidth = Mm2mils( 69 );
int titleFieldHeight = Mm2mils( 24 );
int index = 0;
wxString fullMsg = msg;
do // Reduce the height of wrapped title until the fit
{
do // Wrap the title
{
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
if( titleWidth > titleFieldWidth )
{
index = 0;
do
{
msg = msg.Left( msg.Length() - 1 );
if( msg.Length() == 0 )
{
lines.Clear();
msg = fullMsg;
sz.x -= iusPerMil;
break;
}
else
{
index++;
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
wxString ch = wxString( msg.Last() );
if( titleWidth < titleFieldWidth && ch == wxT( " " ) )
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
index += msg.Length() - dot - 2;
msg = msg.Left( dot + 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
else
{
msg = msg.Left( msg.Length() - 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
}
}
}while( 1 );
}
else
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
lines.Add( msg.Left( dot + 1 ) );
lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) );
}
else
lines.Add( msg );
break;
}
}while( 1 );
if( titleFieldHeight < titleHeight * lines.Count() )
{
sz.y -= iusPerMil;
sz.x -= iusPerMil;
msg = fullMsg;
lines.Clear();
}
else
break;
}while( 1 );
pos.x = (refx - Mm2mils( 85 )) * iusPerMil;
pos.y = (refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2)) * iusPerMil;
for( int curLn = 0; curLn < lines.Count(); curLn++ )
{
msg = lines[curLn];
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
pos.y += titleHeight * iusPerMil;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 119 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 60 )) * iusPerMil;
pos.y = (refy - Mm2mils( 47.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Developer
msg = aTitleBlock.GetComment2();
if( !msg.IsEmpty() )
{
sz = text_size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 27.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Verifier
msg = aTitleBlock.GetComment3();
if( !msg.IsEmpty() )
{
sz = text_size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 22.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Approver
msg = aTitleBlock.GetComment4();
if( !msg.IsEmpty() )
{
sz = text_size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 2.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
else // other pages
{
for( Ki_WorkSheetData* WsItem = &WS_Osn2a_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * iusPerMil;
pos.y = (refy - WsItem->m_Posy) * iusPerMil;
end.x = (refx - WsItem->m_Endx) * iusPerMil;
end.y = (refy - WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn2a_Text1 )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size0_8,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
else
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
}
}
// Sheet number
pos.x = (refx - Mm2mils( 5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 4 )) * iusPerMil;
msg.Empty();
msg << aSheetNumber;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 109 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 65 )) * iusPerMil;
pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
// Format
pos.x = (refx - Mm2mils( 23 )) * iusPerMil;
pos.y = (refy + Mm2mils( 2.5 )) * iusPerMil;
msg.Empty();
msg << aPageInfo.GetType();
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
// Lower left corner
refx = ref.x;
refy = yg;
for( Ki_WorkSheetData* WsItem = &WS_DopLeft_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( yg - WsItem->m_Posy ) * iusPerMil;
msg.Empty();
if( aSheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posx) * iusPerMil;
pos.y = (refy - WsItem->m_Posy) * iusPerMil;
end.x = (refx - WsItem->m_Endx) * iusPerMil;
end.y = (refy - WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_CADRE:
break;
case WS_PODPIS_LU:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
case WS_SEGMENT_LU:
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
pos.y = ( yg - WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
}
}
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
WsItem != NULL;
WsItem = WsItem->Pnext )
if( aPageInfo.GetType() == PAGE_INFO::A4 || !aPageInfo.IsPortrait() ) // A4 or Landscape
{
pos.x = ( ref.x + WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y + WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
// Left Top corner
refx = ref.x;
refy = ref.y;
for( Ki_WorkSheetData* WsItem = &WS_DopTop_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
case WS_SEGMENT_LT:
plotter->MoveTo( pos );
pos.x = ( ref.x + WsItem->m_Endx ) * iusPerMil;
pos.y = ( ref.y + WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 )// Some fields for first page only
break;
pos.x = (refx + WsItem->m_Posx) * iusPerMil;
pos.y = (refy + WsItem->m_Posy) * iusPerMil;
end.x = (refx + WsItem->m_Endx) * iusPerMil;
end.y = (refy + WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx + Mm2mils( 35 )) * iusPerMil;
pos.y = (refy + Mm2mils( 7 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, 1800, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
else // Portrait
{
// Right Top corner
// Lines are used from the upper left corner by the change of coordinates
refx = xg;
refy = ref.y;
for( Ki_WorkSheetData* WsItem = &WS_DopTop_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 )// Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posy) * iusPerMil;
pos.y = (refy + WsItem->m_Posx) * iusPerMil;
end.x = (refx - WsItem->m_Endy) * iusPerMil;
end.y = (refy + WsItem->m_Endx) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 7 )) * iusPerMil;
pos.y = (refy + Mm2mils( 35 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_VERT, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
#else
text_size.x = WSTEXTSIZE * iusPerMil;
text_size.y = WSTEXTSIZE * iusPerMil;
// Plot legend along the X axis.
int ipas = ( xg - ref.x ) / PAS_REF;
int gxpas = ( xg - ref.x ) / ipas;
@ -271,220 +741,10 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
#endif
// Plot the worksheet.
text_size.x = SIZETEXT * iusPerMil;
text_size.y = SIZETEXT * iusPerMil;
#if defined(KICAD_GOST)
text_size2.x = SIZETEXT * iusPerMil * 2;
text_size2.y = SIZETEXT * iusPerMil * 2;
text_size3.x = SIZETEXT * iusPerMil * 3;
text_size3.y = SIZETEXT * iusPerMil * 3;
text_size1_5.x = SIZETEXT * iusPerMil * 1.5;
text_size1_5.y = SIZETEXT * iusPerMil * 1.5;
ref.x = pageSize.x - aPageInfo.GetRightMarginMils();
ref.y = pageSize.y - aPageInfo.GetBottomMarginMils();
if( aSheetNumber == 1 )
{
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
break;
case WS_REV:
break;
case WS_KICAD_VERSION:
break;
case WS_PODPIS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
case WS_SIZESHEET:
break;
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
if( aNumberOfSheets > 1 )
msg << aSheetNumber;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
case WS_SHEETS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << aNumberOfSheets;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
case WS_COMPANY_NAME:
msg = aTitleBlock.GetCompany();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_TITLE:
msg = aTitleBlock.GetTitle();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_COMMENT1:
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil;
pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil;
plotter->Text( pos, plotClr,
msg.GetData(), 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_COMMENT2:
msg = aTitleBlock.GetComment2();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_COMMENT3:
msg = aTitleBlock.GetComment3();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_COMMENT4:
msg = aTitleBlock.GetComment4();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_UPPER_SEGMENT:
case WS_LEFT_SEGMENT:
case WS_SEGMENT:
plotter->MoveTo( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
}
}
}
else
{
for( Ki_WorkSheetData* WsItem = &WS_CADRE_D;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_CADRE:
// Begin list number > 1
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil;
pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil;
plotter->Text( pos, plotClr,
msg, 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_PODPIS_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
case WS_IDENTSHEET_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << aSheetNumber;
plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D:
plotter->MoveTo( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
}
}
}
#else
ref.x = pageSize.x - GRID_REF_W - aPageInfo.GetRightMarginMils();
ref.y = pageSize.y - GRID_REF_W - aPageInfo.GetBottomMarginMils();
@ -603,4 +863,5 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
}
#endif
}

View File

@ -1,6 +1,6 @@
/*
/**
* @file confirm.cpp
* utilities to display some error, warning and info short messges
* @brief utilities to display some error, warning and info short messges
*/
#include <fctsys.h>

View File

@ -109,8 +109,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
dc.SetClippingRegion( DrawArea );
}
const int maskLayer = 0xFFFFFFFF;
aFrame->PrintPage( &dc, maskLayer, false );
aFrame->PrintPage( &dc, FULL_LAYERS, false );
screen->m_IsPrinting = false;
aFrame->GetCanvas()->SetClipBox( tmp );
wxMetafile* mf = dc.Close();

View File

@ -63,9 +63,9 @@ const wxString pageFmts[] =
_("C 17x22in"),
_("D 22x34in"),
_("E 34x44in"),
_("USLetter 8.5x11in"),
_("USLegal 8.5x14in"),
_("USLedger 11x17in"),
_("US Letter 8.5x11in"),
_("US Legal 8.5x14in"),
_("US Ledger 11x17in"),
_("User (Custom)"),
wxT("") // end of list
};
@ -609,12 +609,20 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
wxPoint pointLeftTop( pageDUMMY.GetLeftMarginMils(), pageDUMMY.GetTopMarginMils() );
wxPoint pointRightBottom( pageDUMMY.GetRightMarginMils(), pageDUMMY.GetBottomMarginMils() );
// Get page type
int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
wxString paperType = m_pageFmt[idx].Left( m_pageFmt[idx].Index( wxT( " " ) ) );
// Draw layout preview.
wxString emptyString;
GRResetPenAndBrush( ( wxDC* ) &memDC );
m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom,
emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreens,
paperType, emptyString, m_tb, m_Screen->m_NumberOfScreens,
m_Screen->m_ScreenNumber, 1, appScale, LIGHTGRAY, RED );
memDC.SelectObject( wxNullBitmap );

View File

@ -166,9 +166,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
m_messagePanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) );
m_messagePanel->SetBackgroundColour( MakeColour( LIGHTGRAY ) );
}
@ -324,7 +322,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
}
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask, bool aPrintMirrorMode, void* aData )
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
}

View File

@ -40,16 +40,18 @@
#include <class_base_screen.h>
#define EDA_DRAWBASE
#include <newstroke_font.h>
#include <plot_common.h>
/* factor used to calculate actual size of shapes from hershey fonts (could be adjusted depending on the font name)
* Its value is choosen in order to have letters like M, P .. vertical size equal to the vertical char size parameter
* Of course some shapes can be bigger or smaller than the vertical char size parameter
/* factor used to calculate actual size of shapes from hershey fonts
* (could be adjusted depending on the font name)
* Its value is choosen in order to have letters like M, P .. vertical size
* equal to the vertical char size parameter
* Of course some shapes can be bigger or smaller than the vertical char size
* parameter
*/
#define HERSHEY_SCALE_FACTOR 1 / 21.0
double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;
double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR;
/* Helper function for texts with over bar
@ -59,6 +61,7 @@ int OverbarPositionY( int size_v, int thickness )
return KiROUND( ( (double) size_v * 1.1 ) + ( (double) thickness * 1.5 ) );
}
/**
* Function GetPensizeForBold
* @return the "best" value for a pen size to draw/plot a bold text
@ -84,12 +87,13 @@ int GetPenSizeForBold( int aTextSize )
*/
int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold )
{
int penSize = aPenSize;
double scale = aBold ? 4.0 : 6.0;
int maxWidth = KiROUND( std::abs( aSize ) / scale );
int penSize = aPenSize;
double scale = aBold ? 4.0 : 6.0;
int maxWidth = KiROUND( std::abs( aSize ) / scale );
if( penSize > maxWidth )
penSize = maxWidth;
return penSize;
}
@ -112,17 +116,23 @@ int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold )
/**
* Function NegableTextLength
* Return the text length of a negable string, excluding the ~ markers */
* Return the text length (char count) of a negable string,
* excluding the ~ markers
*/
int NegableTextLength( const wxString& aText )
{
int char_count = aText.length();
/* Fix the character count, removing the ~ found */
// Fix the character count, removing the ~ found
for( int i = char_count - 1; i >= 0; i-- )
{
if( aText[i] == '~' )
{
char_count--;
// '~~' draw as '~' and count as two chars
if( i > 0 && aText[i - 1] == '~' )
i--;
else
char_count--;
}
}
@ -138,13 +148,15 @@ int NegableTextLength( const wxString& aText )
*/
static const char* GetHersheyShapeDescription( int AsciiCode )
{
/* calculate font length */
// calculate font length
int font_length_max = newstroke_font_bufsize;
if( AsciiCode >= (32 + font_length_max) )
AsciiCode = '?';
if( AsciiCode < 32 )
AsciiCode = 32; /* Clamp control chars */
AsciiCode = 32; /* Clamp control chars */
AsciiCode -= 32;
return newstroke_font[AsciiCode];
@ -158,44 +170,50 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo
for( int i = 0; i < char_count; i++ )
{
int AsciiCode = aText[i];
int asciiCode = aText[i];
if( AsciiCode == '~' ) /* Skip the negation marks */
/* Skip the negation marks
* and first '~' char of '~~'
* ('~~' draw as '~')
*/
if( asciiCode == '~' )
{
continue;
if( i == 0 || aText[i - 1] != '~' )
continue;
}
const char* ptcar = GetHersheyShapeDescription( AsciiCode );
/* Get metrics */
int xsta = *ptcar++ - 'R';
int xsto = *ptcar++ - 'R';
tally += KiROUND( aXSize * (xsto - xsta) * s_HerscheyScaleFactor );
const char* shape_ptr = GetHersheyShapeDescription( asciiCode );
// Get metrics
int xsta = *shape_ptr++ - 'R';
int xsto = *shape_ptr++ - 'R';
tally += KiROUND( aXSize * (xsto - xsta) * s_HersheyScaleFactor );
}
/* Italic correction, 1/8em */
// For italic correction, add 1/8 size
if( aItalic )
{
tally += KiROUND( aXSize * 0.125 );
}
return tally;
}
/* Helper function for drawing character polygons */
static void DrawGraphicTextPline(
EDA_RECT* aClipBox,
wxDC* aDC,
EDA_COLOR_T aColor,
int aWidth,
bool aSketchMode,
int point_count,
wxPoint* coord,
void (* aCallback)(int x0, int y0, int xf, int yf ),
PLOTTER* aPlotter )
// Helper function for drawing character polylines
static void DrawGraphicTextPline( EDA_RECT* aClipBox,
wxDC* aDC,
EDA_COLOR_T aColor,
int aWidth,
bool aSketchMode,
int point_count,
wxPoint* coord,
void (* aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER* aPlotter )
{
if( aPlotter )
{
aPlotter->MoveTo( coord[0] );
for( int ik = 1; ik < point_count; ik++ )
{
aPlotter->LineTo( coord[ik] );
@ -260,26 +278,26 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
void (* aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER* aPlotter )
{
int AsciiCode;
int x0, y0;
int size_h, size_v;
unsigned ptr;
int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
wxPoint current_char_pos; // Draw coordinates for the current char
wxPoint overbar_pos; // Start point for the current overbar
int overbar_italic_comp; // Italic compensation for overbar
EDA_RECT* clipBox; // Clip box used in basic draw functions
int AsciiCode;
int x0, y0;
int size_h, size_v;
unsigned ptr;
int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
wxPoint current_char_pos; // Draw coordinates for the current char
wxPoint overbar_pos; // Start point for the current overbar
int overbar_italic_comp; // Italic compensation for overbar
EDA_RECT* clipBox; // Clip box used in basic draw functions
clipBox = aPanel ? aPanel->GetClipBox() : NULL;
#define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false;
bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0
bool sketch_mode = false;
bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0
size_h = aSize.x; /* PLEASE NOTE: H is for HORIZONTAL not for HEIGHT */
size_v = aSize.y;
size_h = aSize.x; /* PLEASE NOTE: H is for HORIZONTAL not for HEIGHT */
size_v = aSize.y;
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
aWidth = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
if( aWidth < 0 )
@ -292,17 +310,18 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
#endif
if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis)
if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis)
italic_reverse = true;
unsigned char_count = NegableTextLength( aText );
if( char_count == 0 )
return;
current_char_pos = aPos;
dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth );
dy = size_v;
dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth );
dy = size_v;
/* Do not draw the text if out of draw area! */
if( aPanel )
@ -310,20 +329,23 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
int xm, ym, ll, xc, yc;
ll = std::abs( dx );
xc = current_char_pos.x;
yc = current_char_pos.y;
xc = current_char_pos.x;
yc = current_char_pos.y;
x0 = aPanel->GetClipBox()->GetX() - ll;
y0 = aPanel->GetClipBox()->GetY() - ll;
xm = aPanel->GetClipBox()->GetRight() + ll;
ym = aPanel->GetClipBox()->GetBottom() + ll;
x0 = aPanel->GetClipBox()->GetX() - ll;
y0 = aPanel->GetClipBox()->GetY() - ll;
xm = aPanel->GetClipBox()->GetRight() + ll;
ym = aPanel->GetClipBox()->GetBottom() + ll;
if( xc < x0 )
return;
if( yc < y0 )
return;
if( xc > xm )
return;
if( yc > ym )
return;
}
@ -396,6 +418,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aItalic )
{
overbar_italic_comp = OverbarPositionY( size_v, aWidth ) / 8;
if( italic_reverse )
{
overbar_italic_comp = -overbar_italic_comp;
@ -404,53 +427,64 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
else
{
overbar_italic_comp = 0;
};
}
int overbars = 0; // Number of '~' seen (except '~~')
ptr = 0; // ptr = text index
int overbars = 0; // Number of ~ seen
ptr = 0; /* ptr = text index */
while( ptr < char_count )
{
if( aText[ptr + overbars] == '~' )
{
/* Found an overbar, adjust the pointers */
overbars++;
if( ptr + overbars + 1 < aText.length()
&& aText[ptr + overbars + 1] == '~' ) /* '~~' draw as '~' */
ptr++; // skip first '~' char and draw second
if( overbars & 1 ) // odd overbars count
{
/* Starting the overbar */
overbar_pos = current_char_pos;
overbar_pos.x += overbar_italic_comp;
overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient );
}
else
{
/* Ending the overbar */
coord[0] = overbar_pos;
overbar_pos = current_char_pos;
overbar_pos.x += overbar_italic_comp;
overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos;
/* Plot the overbar segment */
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter );
// Found an overbar, adjust the pointers
overbars++;
if( overbars & 1 ) // odd overbars count
{
// Starting the overbar
overbar_pos = current_char_pos;
overbar_pos.x += overbar_italic_comp;
overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient );
}
else
{
// Ending the overbar
coord[0] = overbar_pos;
overbar_pos = current_char_pos;
overbar_pos.x += overbar_italic_comp;
overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos;
// Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter );
}
continue; // Skip ~ processing
}
continue; /* Skip ~ processing */
}
AsciiCode = aText.GetChar( ptr + overbars );
const char* ptcar = GetHersheyShapeDescription( AsciiCode );
/* Get metrics */
int xsta = *ptcar++ - 'R';
int xsto = *ptcar++ - 'R';
// Get metrics
int xsta = *ptcar++ - 'R';
int xsto = *ptcar++ - 'R';
int point_count = 0;
bool endcar = false;
while( !endcar )
{
int hc1, hc2;
hc1 = *ptcar++;
if( hc1 )
{
hc2 = *ptcar++;
@ -462,64 +496,103 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
hc2 = 'R';
endcar = true;
}
// Do the Hershey decode thing: coordinates values are coded as <value> + 'R'
hc1 -= 'R'; hc2 -= 'R';
/* Pen up request */
// Do the Hershey decode thing:
// coordinates values are coded as <value> + 'R'
hc1 -= 'R';
hc2 -= 'R';
// Pen up request
if( hc1 == -50 && hc2 == 0 )
{
if( point_count )
{
if( aWidth <= 1 )
aWidth = 0;
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, point_count, coord,
aCallback, aPlotter );
}
point_count = 0;
}
else
{
wxPoint currpoint;
hc1 -= xsta; hc2 -= 11; /* Align the midpoint */
hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor );
hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor );
hc1 -= xsta; hc2 -= 11; // Align the midpoint
hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor );
hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor );
// To simulate an italic font, add a x offset depending on the y offset
// To simulate an italic font,
// add a x offset depending on the y offset
if( aItalic )
hc1 -= KiROUND( italic_reverse ? -hc2 / 8.0 : hc2 / 8.0 );
currpoint.x = hc1 + current_char_pos.x;
currpoint.y = hc2 + current_char_pos.y;
RotatePoint( &currpoint, aPos, aOrient );
coord[point_count] = currpoint;
if( point_count < BUF_SIZE - 1 )
point_count++;
}
}
/* end draw 1 char */
} // end draw 1 char
ptr++;
// Apply the advance width
current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HerscheyScaleFactor );
current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HersheyScaleFactor );
}
if( overbars % 2 )
{
/* Close the last overbar */
// Close the last overbar
coord[0] = overbar_pos;
overbar_pos = current_char_pos;
overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos;
/* Plot the overbar segment */
// Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter );
}
}
void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
wxDC * aDC,
const wxPoint &aPos,
enum EDA_COLOR_T aBgColor,
enum EDA_COLOR_T aColor1,
enum EDA_COLOR_T aColor2,
const wxString &aText,
int aOrient,
const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER * aPlotter )
{
// Swap color if contrast would be better
if( ColorIsLight( aBgColor ) ) {
EDA_COLOR_T c = aColor1;
aColor1 = aColor2;
aColor2 = c;
}
DrawGraphicText( aPanel, aDC, aPos, aColor1, aText, aOrient, aSize,
aH_justify, aV_justify, aWidth, aItalic, aBold,
aCallback, aPlotter );
DrawGraphicText( aPanel, aDC, aPos, aColor2, aText, aOrient, aSize,
aH_justify, aV_justify, aWidth / 4, aItalic, aBold,
aCallback, aPlotter );
}
/**
* Function PlotGraphicText
@ -550,7 +623,7 @@ void PLOTTER::Text( const wxPoint& aPos,
{
int textPensize = aWidth;
if( textPensize == 0 && aBold ) // Use default values if aWidth == 0
if( textPensize == 0 && aBold ) // Use default values if aWidth == 0
textPensize = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
if( textPensize >= 0 )

View File

@ -29,7 +29,7 @@
#include <cstdlib> // bsearch()
#include <cctype>
#include <macros.h>
#include <dsnlexer.h>
//#include "fctsys.h"
@ -280,24 +280,25 @@ bool DSNLEXER::IsSymbol( int aTok )
void DSNLEXER::Expecting( int aTok ) throw( IO_ERROR )
{
wxString errText( _("Expecting") );
errText << wxT(" ") << GetTokenString( aTok );
wxString errText;
errText.Printf( _("Expecting '%s'"), GetChars( GetTokenString( aTok ) ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
void DSNLEXER::Expecting( const char* text ) throw( IO_ERROR )
{
wxString errText( _("Expecting") );
errText << wxT(" '") << wxString::FromUTF8( text ) << wxT("'");
wxString errText;
errText.Printf( _("Expecting '%s'"),
GetChars( wxString::FromUTF8( text ) ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR )
{
wxString errText( _("Unexpected") );
errText << wxT(" ") << GetTokenString( aTok );
wxString errText;
errText.Printf( _("Unexpected '%s'"), GetChars( GetTokenString( aTok ) ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -312,8 +313,9 @@ void DSNLEXER::Duplicate( int aTok ) throw( IO_ERROR )
void DSNLEXER::Unexpected( const char* text ) throw( IO_ERROR )
{
wxString errText( _("Unexpected") );
errText << wxT(" '") << wxString::FromUTF8( text ) << wxT("'");
wxString errText;
errText.Printf( _("Unexpected '%s'"),
GetChars( wxString::FromUTF8( text ) ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}

View File

@ -122,8 +122,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
if( !wxFileExists( fullfilename ) )
{
msg = _( "Doc File " );
msg << wxT("\"") << aDocName << wxT("\"") << _( " not found" );
msg.Printf( _( "Doc File <%s> not found" ), GetChars( aDocName ) );
DisplayError( aFrame, msg );
return false;
}

View File

@ -269,22 +269,12 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aDrawMode != -1 )
GRSetDrawMode( aDC, aDrawMode );
/* Draw text anchor, if allowed */
// Draw text anchor, if requested
if( aAnchor_color != UNSPECIFIED_COLOR )
{
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
aAnchor_color = (EDA_COLOR_T) ( aAnchor_color & MASKCOLOR );
int cX = aPos.x + aOffset.x;
int cY = aPos.y + aOffset.y;
GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY,
cX + anchor_size, cY, 0, aAnchor_color );
GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size,
cX, cY + anchor_size, 0, aAnchor_color );
GRDrawAnchor( aPanel->GetClipBox(), aDC,
aPos.x + aOffset.x, aPos.y + aOffset.y,
DIM_ANCRE_TEXTE, aAnchor_color );
}
if( aFillMode == SKETCH )

View File

@ -652,15 +652,16 @@ bool OpenPDF( const wxString& file )
if( !success )
{
wxString msg = _( "Problem while running the PDF viewer" );
msg << _( "\n command is " ) << command;
wxString msg;
msg.Printf( _( "Problem while running the PDF viewer\nCommand is '%s'" ),
GetChars( command ) );
DisplayError( NULL, msg );
}
}
else
{
wxString msg = _( "Unable to find a PDF viewer for" );
msg << wxT( " " ) << filename;
wxString msg;
msg.Printf( _( "Unable to find a PDF viewer for <%s>" ), GetChars( filename ) );
DisplayError( NULL, msg );
success = false;
}

View File

@ -1451,3 +1451,124 @@ void GRBezier( EDA_RECT* ClipBox,
std::vector<wxPoint> Points = Bezier2Poly( x1, y1, x2, y2, x3, y3, x4, y4 );
GRPoly( ClipBox, DC, Points.size(), &Points[0], false, width, Color, Color );
}
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 wxChar *aName )
{
// look for a match in the palette itself
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
{
if( 0 == wxStricmp( aName, 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 )
{
EDA_COLOR_T candidate = BLACK;
// These are ints because we will subtract them later
int r = aColor.Red();
int g = aColor.Green();
int b = aColor.Blue();
/* 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 = (r - c.m_Red) * (r - c.m_Red) +
(g - c.m_Green) * (g - c.m_Green) +
(b - c.m_Blue) * (b - c.m_Blue);
if( distance < nearest_distance && c.m_Red >= r &&
c.m_Green >= g && c.m_Blue >= b )
{
nearest_distance = distance;
candidate = trying;
}
}
return candidate;
}
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y,
int aSize, EDA_COLOR_T aColor )
{
int anchor_size = aDC->DeviceToLogicalXRel( aSize );
GRLine( aClipBox, aDC,
x - anchor_size, y,
x + anchor_size, y, 0, aColor );
GRLine( aClipBox, aDC,
x, y - anchor_size,
x, y + anchor_size, 0, aColor );
}

View File

@ -205,9 +205,7 @@ void EDA_MSG_PANEL::showItem( wxDC& aDC, const MSG_PANEL_ITEM& aItem )
if( color >= 0 )
{
color = ColorGetBase( color );
aDC.SetTextForeground( wxColour( ColorRefs[color].m_Red,
ColorRefs[color].m_Green,
ColorRefs[color].m_Blue ) );
aDC.SetTextForeground( MakeColour( color ) );
}
if( !aItem.m_UpperText.IsEmpty() )

View File

@ -123,7 +123,7 @@ const char* const newstroke_font[] =
"KYVcUcSbR`RVQTOSQRRPRFSDUCVC",
"H\\RbRD",
"KYNcOcQbR`RVSTUSSRRPRFQDOCNC",
"KZMHNGPFTHVGWF",
"KZMSNRPQTSVRWQ",
"F^K[KFYFY[K[",
/* // LATIN-1 SUPPLEMENT (0080-00FF) */
"F^K[KFYFY[K[", /* U+80 */

View File

@ -46,12 +46,12 @@ RENDER_SETTINGS::RENDER_SETTINGS()
m_outlineWidth = 60000;
// Store the predefined colors used in KiCad in format used by GAL
for( int i = 0; i < NBCOLOR; i++ )
for( int i = 0; i < NBCOLORS; i++ )
{
m_legacyColorMap[ColorRefs[i].m_Numcolor] = COLOR4D( (double) ColorRefs[i].m_Red / 255.0,
(double) ColorRefs[i].m_Green / 255.0,
(double) ColorRefs[i].m_Blue / 255.0,
m_layerOpacity );
m_legacyColorMap[g_ColorRefs[i].m_Numcolor] = COLOR4D( (double) g_ColorRefs[i].m_Red / 255.0,
(double) g_ColorRefs[i].m_Green / 255.0,
(double) g_ColorRefs[i].m_Blue / 255.0,
m_layerOpacity );
}
}

View File

@ -34,6 +34,7 @@
#include <pcbcommon.h>
#include <plot_common.h>
#include <class_board.h>
#include <class_pad.h>
#include <class_zone_settings.h>
#include <class_board_design_settings.h>
@ -42,36 +43,9 @@
class MODULE;
/* return a one bit layer mask from a layer number
* aLayerNumber = the layer number to convert (0 .. LAYER_COUNT-1)
*/
int GetLayerMask( int aLayerNumber )
{
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
#if 0
// Look up Table for conversion one layer number -> one bit layer mask:
static int tabOneLayerMask[LAYER_COUNT] =
{
0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x00000100, 0x00000200, 0x00000400, 0x00000800,
0x00001000, 0x00002000, 0x00004000, 0x00008000,
0x00010000, 0x00020000, 0x00040000, 0x00080000,
0x00100000, 0x00200000, 0x00400000, 0x00800000,
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000
};
return( tabOneLayerMask[aLayerNumber] );
#else
return 1 << aLayerNumber;
#endif
}
/* Look up Table for conversion copper layer count -> general copper layer
* mask: */
int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
0x0001, 0x8001, 0x8003, 0x8007,
0x800F, 0x801F, 0x803F, 0x807F,
0x80FF, 0x81FF, 0x83FF, 0x87FF,
@ -79,7 +53,7 @@ int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
};
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_RotationAngle;
@ -99,3 +73,156 @@ int g_PadCMPColor = RED;
*/
DLIST<TRACK> g_CurrentTrackList;
LAYER_NUM FlipLayer( LAYER_NUM oldlayer )
{
switch( oldlayer )
{
case LAYER_N_BACK:
return LAYER_N_FRONT;
case LAYER_N_FRONT:
return LAYER_N_BACK;
case SILKSCREEN_N_BACK:
return SILKSCREEN_N_FRONT;
case SILKSCREEN_N_FRONT:
return SILKSCREEN_N_BACK;
case ADHESIVE_N_BACK:
return ADHESIVE_N_FRONT;
case ADHESIVE_N_FRONT:
return ADHESIVE_N_BACK;
case SOLDERMASK_N_BACK:
return SOLDERMASK_N_FRONT;
case SOLDERMASK_N_FRONT:
return SOLDERMASK_N_BACK;
case SOLDERPASTE_N_BACK:
return SOLDERPASTE_N_FRONT;
case SOLDERPASTE_N_FRONT:
return SOLDERPASTE_N_BACK;
// No change for the other layers
default:
return oldlayer;
}
}
LAYER_MSK FlipLayerMask( LAYER_MSK aMask )
{
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
}
LAYER_NUM ExtractLayer( LAYER_MSK aMask )
{
if( aMask == NO_LAYERS )
return UNSELECTED_LAYER;
LAYER_NUM candidate = UNDEFINED_LAYER;
// Scan all the layers and take note of the first set; if other are
// then found return UNDEFINED_LAYER
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
if( aMask & GetLayerMask( i ) )
{
if( candidate == UNDEFINED_LAYER )
candidate = i;
else
return UNDEFINED_LAYER;
}
}
return candidate;
}
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
{
// Try the single or no- layer case (easy)
LAYER_NUM layer = ExtractLayer( aMask );
switch( layer )
{
case UNSELECTED_LAYER:
return _( "No layers" );
case UNDEFINED_LAYER:
break;
default:
return aBoard->GetLayerName( layer );
}
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
wxString layerInfo;
if( aMask & LAYER_FRONT )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) );
if( aMask & LAYER_BACK )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) );
if( aMask & INTERNAL_CU_LAYERS )
AccumulateDescription( layerInfo, _("Internal" ) );
if( aMask & ALL_NO_CU_LAYERS )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
}
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}

View File

@ -20,7 +20,6 @@
#define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG true
@ -29,7 +28,6 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
bool ForceUseLocalConfig )
{
wxFileName fn = fileName;
wxString defaultFileName;
// Free old config file.
if( m_projectSettings )
@ -38,9 +36,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
m_projectSettings = NULL;
}
/* Check the file name does not a KiCad project extension.
/* Force the file extension.
* This allows the user to enter a filename without extension
* or use an existing name to create te project file
* or use an existing name to create the project file
*/
if( fn.GetExt() != ProjectFileExtension )
{
@ -58,8 +56,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
// Init local config filename
if( ForceUseLocalConfig || fn.FileExists() )
{
m_CurrentOptionFile = fn.GetFullPath();
m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString,
fn.GetFullPath(), wxEmptyString );
m_CurrentOptionFile, wxEmptyString );
m_projectSettings->DontCreateOnDemand();
if( ForceUseLocalConfig )
@ -90,9 +89,10 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
}
}
wxString defaultFileName;
defaultFileName = m_libSearchPaths.FindValidPath( wxT( "kicad.pro" ) );
if( !defaultFileName )
if( defaultFileName.IsEmpty() )
{
wxLogDebug( wxT( "Template file <kicad.pro> not found." ) );
fn = wxFileName( GetTraits()->GetStandardPaths().GetDocumentsDir(),
@ -104,6 +104,7 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
}
// Create new project file using the default name.
m_CurrentOptionFile = fn.GetFullPath();
m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString,
wxEmptyString, fn.GetFullPath() );
m_projectSettings->DontCreateOnDemand();
@ -112,63 +113,6 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
}
void EDA_APP::WriteProjectConfig( const wxString& fileName,
const wxString& GroupName,
PARAM_CFG_BASE** List )
{
PARAM_CFG_BASE* pt_cfg;
wxString msg;
ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );
/* Write time (especially to avoid bug wxFileConfig that writes the
* wrong item if declaration [xx] in first line (If empty group)
*/
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
msg = DateAndTime();
m_projectSettings->Write( wxT( "update" ), msg );
msg = GetAppName();
m_projectSettings->Write( wxT( "last_client" ), msg );
/* 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 );
for( ; List != NULL && *List != NULL; List++ )
{
pt_cfg = *List;
if( pt_cfg->m_Group )
m_projectSettings->SetPath( pt_cfg->m_Group );
else
m_projectSettings->SetPath( GroupName );
if( pt_cfg->m_Setup )
continue;
if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{
if( pt_cfg->m_Ident )
m_projectSettings->DeleteGroup( pt_cfg->m_Ident );
}
else
{
pt_cfg->SaveParam( m_projectSettings );
}
}
m_projectSettings->SetPath( UNIX_STRING_DIR_SEP );
delete m_projectSettings;
m_projectSettings = NULL;
}
void EDA_APP::WriteProjectConfig( const wxString& fileName,
const wxString& GroupName,
const PARAM_CFG_ARRAY& params )
@ -213,44 +157,18 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
}
m_projectSettings->SetPath( UNIX_STRING_DIR_SEP );
delete m_projectSettings;
m_projectSettings = NULL;
}
void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
{
PARAM_CFG_BASE* pt_cfg;
if( m_settings == NULL )
return;
for( ; *aList != NULL; aList++ )
{
pt_cfg = *aList;
if( pt_cfg->m_Setup == false )
continue;
if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{
if( pt_cfg->m_Ident )
m_settings->DeleteGroup( pt_cfg->m_Ident );
}
else
{
pt_cfg->SaveParam( m_settings );
}
}
}
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 )
for( unsigned i=0; i<count; ++i )
{
const PARAM_CFG_BASE& param = List[i];
@ -269,74 +187,15 @@ void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
}
}
bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_BASE** List,
bool Load_Only_if_New )
{
PARAM_CFG_BASE* pt_cfg;
wxString timestamp;
ReCreatePrjConfig( local_config_filename, GroupName, false );
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
timestamp = m_projectSettings->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == m_CurrentOptionFileDateAndTime) )
{
return false;
}
m_CurrentOptionFileDateAndTime = timestamp;
if( !g_Prj_Default_Config_FullFilename.IsEmpty() )
{
m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
}
else
{
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
m_CurrentOptionFile = wxGetCwd() + wxFileName::GetPathSeparator()
+ g_Prj_Config_LocalFilename;
else
m_CurrentOptionFile = g_Prj_Config_LocalFilename;
}
for( ; List != NULL && *List != NULL; List++ )
{
pt_cfg = *List;
if( pt_cfg->m_Group )
m_projectSettings->SetPath( pt_cfg->m_Group );
else
m_projectSettings->SetPath( GroupName );
if( pt_cfg->m_Setup )
continue;
pt_cfg->ReadParam( m_projectSettings );
}
delete m_projectSettings;
m_projectSettings = NULL;
return true;
}
bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
const PARAM_CFG_ARRAY& params,
bool Load_Only_if_New )
{
wxString timestamp;
ReCreatePrjConfig( local_config_filename, GroupName, false );
m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
timestamp = m_projectSettings->Read( wxT( "update" ) );
wxString timestamp = m_projectSettings->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == m_CurrentOptionFileDateAndTime) )
@ -346,19 +205,6 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
m_CurrentOptionFileDateAndTime = timestamp;
if( !g_Prj_Default_Config_FullFilename.IsEmpty() )
{
m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
}
else
{
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
m_CurrentOptionFile = wxGetCwd() + wxFileName::GetPathSeparator()
+ g_Prj_Config_LocalFilename;
else
m_CurrentOptionFile = g_Prj_Config_LocalFilename;
}
BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
{
if( param.m_Group )
@ -379,22 +225,6 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
}
void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_BASE** aList )
{
PARAM_CFG_BASE* pt_cfg;
for( ; *aList != NULL; aList++ )
{
pt_cfg = *aList;
if( pt_cfg->m_Setup == false )
continue;
pt_cfg->ReadParam( m_settings );
}
}
void EDA_APP::ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List )
{
BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
@ -491,8 +321,8 @@ void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
if( m_Pt_param == NULL || aConfig == NULL )
return;
double default_value = m_Default * m_BIU_to_cfgunit;
double dtmp = aConfig->Read( m_Ident, default_value );
double dtmp = (double) m_Default * m_BIU_to_cfgunit;
aConfig->Read( m_Ident, &dtmp );
int itmp = KiROUND( dtmp / m_BIU_to_cfgunit );
@ -508,7 +338,11 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param * m_BIU_to_cfgunit );
// We cannot use aConfig->Write for a double, because
// this function uses a format with very few digits in mantissa,
// and truncature issues are frequent.
// We uses our function.
ConfigBaseWriteDouble( aConfig, m_Ident, *m_Pt_param * m_BIU_to_cfgunit );
}
@ -524,8 +358,8 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptpara
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
const wxChar* ident,
EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
@ -537,13 +371,11 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
{
static const int MAX_COLOR = 0x8001F;
if( m_Pt_param == NULL || aConfig == NULL )
return;
EDA_COLOR_T itmp = ColorFromInt( aConfig->Read( m_Ident, m_Default ) );
EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) );
if( (itmp < 0) || (itmp > MAX_COLOR) )
if( itmp == UNSPECIFIED_COLOR )
itmp = m_Default;
*m_Pt_param = itmp;
}
@ -554,7 +386,7 @@ void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, (long) *m_Pt_param );
aConfig->Write( m_Ident, ColorGetName( *m_Pt_param ) );
}
@ -592,23 +424,13 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
if( m_Pt_param == NULL || aConfig == NULL )
return;
double ftmp = 0;
wxString msg;
msg = aConfig->Read( m_Ident, wxT( "" ) );
double dtmp = m_Default;
aConfig->Read( m_Ident, &dtmp );
if( msg.IsEmpty() )
{
ftmp = m_Default;
}
else
{
msg.ToDouble( &ftmp );
if( (dtmp < m_Min) || (dtmp > m_Max) )
dtmp = m_Default;
if( (ftmp < m_Min) || (ftmp > m_Max) )
ftmp = m_Default;
}
*m_Pt_param = ftmp;
*m_Pt_param = dtmp;
}
@ -617,7 +439,11 @@ void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param );
// We cannot use aConfig->Write for a double, because
// this function uses a format with very few digits in mantissa,
// and truncature issues are frequent.
// We uses our function.
ConfigBaseWriteDouble( aConfig, m_Ident, *m_Pt_param );
}
@ -715,8 +541,9 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
wxString prm = aConfig->Read( m_Ident );
// filesnames are stored using Unix notation
// file names are stored using Unix notation
// under Window we must use \ instead of /
// mainly if there is a server name in path (something like \\server\kicad)
#ifdef __WINDOWS__
@ -765,13 +592,13 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
libname = aConfig->Read( id_lib, wxT( "" ) );
if( libname.IsEmpty() )
break;
// filesnames are stored using Unix notation
// file names are stored using Unix notation
// under Window we must use \ instead of /
// mainly if there is a server name in path (something like \\server\kicad)
#ifdef __WINDOWS__
libname.Replace(wxT("/"), wxT("\\"));
#endif
libname_list->Add( libname );
libname_list->Add( libname );
}
}

229
common/ptree.cpp Normal file
View File

@ -0,0 +1,229 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 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
*/
// Something in either <boost/property_tree/ptree.hpp> causes a bunch of compiler
// errors in <wx/msw/winundef.h> version 2.9 on MinGW.
#include <macros.h>
#include <boost/property_tree/ptree.hpp>
#include <assert.h>
#include <ptree.h>
typedef PTREE::const_iterator CITER;
typedef PTREE::iterator ITER;
#if defined(DEBUG)
#define D(x) x
#else
#define D(x)
#endif
#define CTL_OMIT_NL (1<<0)
#define CTL_IN_ATTRS (1<<1)
//-----<Scan>------------------------------------------------------------------
/**
* Function scanList
* reads a sexpr list from the input stream into a new node with key
* aLexer->CurText().
*/
inline void scanList( PTREE* aTree, DSNLEXER* aLexer )
{
assert( aLexer->CurTok() == DSN_LEFT );
int tok = aLexer->NextTok();
const char* key = aLexer->CurText();
//D(printf( "%s: '%s'\n", __func__, key );)
PTREE* list = &aTree->push_back( PTREE::value_type( key, PTREE() ) )->second;
if( tok != DSN_RIGHT )
{
while( ( tok = aLexer->NextTok() ) != DSN_RIGHT )
{
if( tok == DSN_EOF )
aLexer->Unexpected( DSN_EOF );
Scan( list, aLexer );
}
}
}
inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer )
{
const char* key = aLexer->CurText();
//D(printf( "%s: '%s'\n", __func__, key );)
aTree->push_back( PTREE::value_type( key, PTREE() ) );
}
void Scan( PTREE* aTree, DSNLEXER* aLexer ) throw( IO_ERROR )
{
int tok = aLexer->CurTok();
// conditionally read first token.
if( tok == DSN_NONE )
tok = aLexer->NextTok();
if( tok == DSN_EOF )
{
aLexer->Unexpected( DSN_EOF );
}
if( tok == DSN_LEFT )
{
scanList( aTree, aLexer );
}
else
{
scanAtom( aTree, aLexer );
}
}
//-----<Format>------------------------------------------------------------------
inline bool isAtom( CPTREE& aTree )
{
return aTree.size()==0 && aTree.data().size()==0;
}
inline bool isLast( CPTREE& aTree, CITER it )
{
CITER next = it;
++next;
return next == aTree.end();
}
inline CITER next( CITER it )
{
CITER n = it;
return ++n;
}
static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl,
const std::string& aKey, CPTREE& aTree ) throw( IO_ERROR );
static void formatList( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree )
throw( IO_ERROR )
{
for( CITER it = aTree.begin(); it != aTree.end(); ++it )
{
// Processing a tree which was read in with xml_parser?
if( it->first == "<xmlattr>" )
{
formatList( out, aNestLevel, aCtl | CTL_IN_ATTRS, it->second );
continue;
}
int ctl = 0;
#if defined(DEBUG)
if( it->first == "field" )
{
int breakhere = 1;
(void) breakhere;
}
#endif
if( isLast( aTree, it ) ) // is "it" the last one?
{
//if( !( aCtl & CTL_IN_ATTRS ) )
ctl = CTL_OMIT_NL;
}
else if( isAtom( next( it )->second ) )
{
/* if( !( aCtl & CTL_IN_ATTRS ) ) */
ctl = CTL_OMIT_NL;
}
formatNode( out, aNestLevel+1, ctl, it->first, it->second );
}
}
static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl,
const std::string& aKey, CPTREE& aTree )
throw( IO_ERROR )
{
if( !isAtom( aTree ) ) // is a list, not an atom
{
int ctl = CTL_OMIT_NL;
// aTree is list and its first child is a list
if( aTree.size() && !isAtom( aTree.begin()->second ) && !aTree.data().size() )
ctl = 0;
out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" );
if( aTree.data().size() ) // only xml typically uses "data()", not sexpr.
{
out->Print( 0, " %s%s",
out->Quotes( aTree.data() ).c_str(),
aTree.size() ? "\n" : ""
);
}
formatList( out, aNestLevel, aCtl, aTree );
out->Print( 0, ")%s", aCtl & CTL_OMIT_NL ? "" : "\n" );
}
else // is an atom, not a list
{
const char* atom = out->Quotes( aKey ).c_str();
out->Print( 0, " %s", atom );
}
}
void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ) throw( IO_ERROR )
{
if( aTree.size() == 1 && !aTree.data().size() )
{
// The topmost node is basically only a container for the document root.
// It anchors the paths which traverse the tree deeper.
CITER it = aTree.begin();
formatNode( out, aNestLevel, aCtl, it->first, it->second );
}
else
{
// This is not expected, neither for sexpr nor xml.
formatNode( out, aNestLevel, aCtl, "", aTree );
}
}

View File

@ -58,7 +58,7 @@ bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 )
SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
EDA_ITEM( aParent, aType )
{
m_Layer = 0;
m_Layer = LAYER_WIRE; // It's only a default, in fact
}

View File

@ -54,7 +54,7 @@ EDA_COLOR_T DisplayColorFrame( wxWindow* parent, int OldColor )
framepos, OldColor );
color = static_cast<EDA_COLOR_T>( frame->ShowModal() );
frame->Destroy();
if( color > NBCOLOR )
if( color > NBCOLORS )
color = UNSPECIFIED_COLOR;
return color;
}
@ -125,7 +125,7 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
wxStdDialogButtonSizer* StdDialogButtonSizer = NULL;
wxButton* Button = NULL;
int ii, butt_ID, buttcolor;
int ii, butt_ID;
int w = 20, h = 20;
bool ColorFound = false;
@ -137,17 +137,17 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
for( ii = 0; ColorRefs[ii].m_Name != NULL && ii < NBCOLOR; ii++ )
for( ii = 0; ii < NBCOLORS; ++ii )
{
// Provide a separate column for every eight buttons (and their
// Provide a separate column for every six buttons (and their
// associated text strings), so provide a FlexGrid Sizer with
// eight rows and two columns.
if( ii % 8 == 0 )
if( ii % 6 == 0 )
{
FlexColumnBoxSizer = new wxFlexGridSizer( 8, 2, 0, 0 );
FlexColumnBoxSizer = new wxFlexGridSizer( 6, 2, 0, 0 );
// Specify that all of the rows can be expanded.
for( int ii = 0; ii < 8; ii++ )
for( int ii = 0; ii < 6; ii++ )
{
FlexColumnBoxSizer->AddGrowableRow( ii );
}
@ -163,11 +163,9 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
wxBitmap ButtBitmap( w, h );
wxBrush Brush;
iconDC.SelectObject( ButtBitmap );
buttcolor = ColorRefs[ii].m_Numcolor;
EDA_COLOR_T buttcolor = g_ColorRefs[ii].m_Numcolor;
iconDC.SetPen( *wxBLACK_PEN );
Brush.SetColour( ColorRefs[buttcolor].m_Red,
ColorRefs[buttcolor].m_Green,
ColorRefs[buttcolor].m_Blue );
ColorSetBrush( &Brush, buttcolor );
Brush.SetStyle( wxSOLID );
iconDC.SetBrush( Brush );
@ -190,7 +188,7 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
BitmapButton->SetFocus();
}
Label = new wxStaticText( this, -1, ColorRefs[ii].m_Name,
Label = new wxStaticText( this, -1, ColorGetName( buttcolor ),
wxDefaultPosition, wxDefaultSize, 0 );
FlexColumnBoxSizer->Add( Label, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |

View File

@ -95,4 +95,4 @@ const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf
const wxString PSFileWildcard( _( "PostScript files (.ps)|*.ps" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" );
const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) );
const wxString Shapes3DFileWildcard( _( "Vrml and x3d files (*.wrl *.x3d)|*.wrl;*.x3d" ) );

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@
#include <wxstruct.h>
#include <dialog_helpers.h>
#include <base_units.h>
#include <macros.h>
/*******************************************************/
@ -56,7 +57,8 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
if( !Title.IsEmpty() )
{
wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit );
wxString msg;
msg.Printf( _( "Size%s" ), GetChars( ReturnUnitSymbol( m_UserUnit ) ) );
wxStaticText* text = new wxStaticText( parent, -1, msg );
BoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT, 5 );

View File

@ -27,7 +27,6 @@ const wxString RetroFileExtension( wxT( "stf" ) );
const wxString FootprintAliasFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString RetroFileWildcard( _( "KiCad retroannotation files (*.stf)|*.stf" ) );
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );
const wxString titleLibLoadError( _( "Library Load Error" ) );

View File

@ -28,7 +28,6 @@ typedef boost::ptr_vector< COMPONENT_INFO > COMPONENT_LIST;
extern const wxString FootprintAliasFileExtension;
extern const wxString RetroFileExtension;
extern const wxString RetroFileWildcard;
extern const wxString FootprintAliasFileWildcard;
extern const wxString titleLibLoadError;

View File

@ -54,7 +54,7 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) :
m_Config = wxGetApp().GetCommonSettings();
Init( );
title = _( "Project file: " ) + fn.GetFullPath();
title.Format( _( "Project file: <%s>" ), GetChars( fn.GetFullPath() ) );
SetTitle( title );
if( GetSizer() )

View File

@ -60,15 +60,16 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
if( !footprintName.IsEmpty() )
{
msg = _( "Footprint: " ) + footprintName;
msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) );
SetTitle( msg );
FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
msg = _( "Lib: " );
const wxChar *libname;
if( module_info )
msg += module_info->m_LibName;
libname = GetChars( module_info->m_LibName );
else
msg += wxT( "???" );
libname = GetChars( wxT( "???" ) );
msg.Printf( _( "Lib: %s" ), libname );
SetStatusText( msg, 0 );

View File

@ -132,7 +132,6 @@ set(EESCHEMA_SRCS
sch_line.cpp
sch_marker.cpp
sch_no_connect.cpp
sch_polyline.cpp
sch_screen.cpp
sch_sheet.cpp
sch_sheet_path.cpp

View File

@ -122,10 +122,8 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
if( aForceFieldsVisibleAttribute )
{
if( aFieldsVisibleAttributeState )
component->GetField( FOOTPRINT )->SetVisible( false );
else
component->GetField( FOOTPRINT )->SetVisible( true );
component->GetField( FOOTPRINT )
->SetVisible( aFieldsVisibleAttributeState );
}
}
}

View File

@ -41,7 +41,6 @@
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_polyline.h>
#include <sch_text.h>
#include <sch_component.h>
#include <sch_sheet.h>
@ -68,7 +67,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
return;
segment = (SCH_LINE*) s_wires.begin();
EDA_COLOR_T color = ReturnLayerColor( segment->GetLayer() );
EDA_COLOR_T color = GetLayerColor( segment->GetLayer() );
ColorChangeHighlightFlag( &color, !(color & HIGHLIGHT_FLAG) );
if( aErase )
@ -346,33 +345,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
return;
/* Cancel trace in progress */
if( screen->GetCurItem()->Type() == SCH_POLYLINE_T )
{
SCH_POLYLINE* polyLine = (SCH_POLYLINE*) screen->GetCurItem();
wxPoint endpos;
endpos = screen->GetCrossHairPosition();
int idx = polyLine->GetCornerCount() - 1;
wxPoint pt = (*polyLine)[idx];
if( GetForceHVLines() )
{
/* Coerce the line to vertical or horizontal one: */
if( std::abs( endpos.x - pt.x ) < std::abs( endpos.y - pt.y ) )
endpos.x = pt.x;
else
endpos.y = pt.y;
}
polyLine->SetPoint( idx, endpos );
polyLine->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
}
else
{
DrawSegment( m_canvas, DC, wxDefaultPosition, false );
}
DrawSegment( m_canvas, DC, wxDefaultPosition, false );
screen->Remove( screen->GetCurItem() );
m_canvas->SetMouseCaptureCallback( NULL );

View File

@ -43,33 +43,37 @@
static int s_LastShape = '\\';
SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* aDC, int aType )
SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
{
SCH_SCREEN* screen = GetScreen();
// Create and place a new bus entry at cursor position
SCH_BUS_ENTRY* busEntry = new SCH_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape,
aType );
SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC );
return busEntry;
}
SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC )
{
SCH_SCREEN* screen = GetScreen();
// Create and place a new bus entry at cursor position
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( screen->GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC );
return busEntry;
}
/* set the shape of BusEntry (shape = / or \ )
*/
void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_shape )
void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, char entry_shape )
{
if( BusEntry == NULL )
return;
if( BusEntry->Type() != SCH_BUS_ENTRY_T )
{
DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) );
return;
}
/* Put old item in undo list if it is not currently in edit */
if( BusEntry->GetFlags() == 0 )
SaveCopyInUndoList( BusEntry, UR_CHANGED );

View File

@ -391,7 +391,7 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue;
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->GetColorMode();
item.Plot( aPlotter, aOffset, fill, aTransform );

View File

@ -155,7 +155,11 @@ static bool engStrToDouble( wxString aStr, double* aDouble )
aStr.Append( wxT( "R" ) );
// Regular expression for a value string, e.g., 47k2
#if defined(KICAD_GOST)
static wxRegEx valueRegEx( wxT( "^([0-9]+)(мк|[pnumRkKMGT.,кнМГ])([0-9]*)(мк*|[pnumRkKMGTкнМГ]*)" ) );
#else
static wxRegEx valueRegEx( wxT( "^([0-9]+)([pnumRkKMGT.,])([0-9]*)([pnumRkKMGT]*)" ) );
#endif
if( !valueRegEx.Matches( aStr ) )
return false;
@ -164,7 +168,31 @@ static bool engStrToDouble( wxString aStr, double* aDouble )
+ wxT( "." )
+ valueRegEx.GetMatch( aStr, 3 ) );
wxString multiplierString = valueRegEx.GetMatch( aStr, 2 );
#if defined(KICAD_GOST)
if ( multiplierString == wxT( "мк" ) )
multiplierString = wxT( "u" );
else if ( multiplierString == wxT( "к" ) )
multiplierString = wxT( "k" );
else if ( multiplierString == wxT( "н" ) )
multiplierString = wxT( "n" );
else if ( multiplierString == wxT( "М" ) )
multiplierString = wxT( "M" );
else if ( multiplierString == wxT( "Г" ) )
multiplierString = wxT( "G" );
#endif
wxString post_multiplierString = valueRegEx.GetMatch( aStr, 4 );
#if defined(KICAD_GOST)
if ( post_multiplierString == wxT( "мк" ) )
multiplierString = wxT( "u" );
else if ( post_multiplierString == wxT( "к" ) )
multiplierString = wxT( "k" );
else if ( post_multiplierString == wxT( "н" ) )
multiplierString = wxT( "n" );
else if ( post_multiplierString == wxT( "М" ) )
multiplierString = wxT( "M" );
else if ( post_multiplierString == wxT( "Г" ) )
multiplierString = wxT( "G" );
#endif
double multiplier;
switch( (wxChar)multiplierString[0] )
@ -680,14 +708,20 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
else
tmp = wxT( "?" );
msg.Printf( _( "Item not annotated: %s%s" ),
GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) );
if( ( componentFlatList[ii].m_Unit > 0 )
&& ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) )
{
tmp.Printf( _( " (unit %d)" ), componentFlatList[ii].m_Unit );
msg << tmp;
msg.Printf( _( "Item not annotated: %s%s (unit %d)\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ),
componentFlatList[ii].m_Unit );
}
else
{
msg.Printf( _( "Item not annotated: %s%s\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ) );
}
if( aMessageList )
@ -708,16 +742,14 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
else
tmp = wxT( "?" );
msg.Printf( _( "Error item %s%s" ), GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ) );
tmp.Printf( _( " unit %d and no more than %d parts" ),
msg.Printf( _( "Error item %s%s unit %d and no more than %d parts\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ),
componentFlatList[ii].m_Unit,
componentFlatList[ii].GetLibComponent()->GetPartCount() );
msg << tmp;
if( aMessageList )
aMessageList->Add( msg + wxT( "\n" ) );
aMessageList->Add( msg );
error++;
break;
@ -747,18 +779,23 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
else
tmp = wxT( "?" );
msg.Printf( _( "Multiple item %s%s" ),
GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) );
if( ( componentFlatList[ii].m_Unit > 0 )
&& ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) )
if( ( componentFlatList[ii].m_Unit > 0 )
&& ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) )
{
tmp.Printf( _( " (unit %d)" ), componentFlatList[ii].m_Unit );
msg << tmp;
msg.Printf( _( "Multiple item %s%s (unit %d)\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ),
componentFlatList[ii].m_Unit );
}
else
{
msg.Printf( _( "Multiple item %s%s\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ) );
}
if( aMessageList )
aMessageList->Add( msg + wxT( "\n" ) );
aMessageList->Add( msg );
error++;
continue;
@ -774,18 +811,23 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
else
tmp = wxT( "?" );
msg.Printf( _( "Multiple item %s%s" ),
GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) );
if( ( componentFlatList[ii].m_Unit > 0 )
&& ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) )
if( ( componentFlatList[ii].m_Unit > 0 )
&& ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) )
{
tmp.Printf( _( " (unit %d)" ), componentFlatList[ii].m_Unit );
msg << tmp;
msg.Printf( _( "Multiple item %s%s (unit %d)\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ),
componentFlatList[ii].m_Unit );
}
else
{
msg.Printf( _( "Multiple item %s%s\n" ),
GetChars( componentFlatList[ii].GetRef() ),
GetChars( tmp ) );
}
if( aMessageList )
aMessageList->Add( msg + wxT( "\n" ));
aMessageList->Add( msg );
error++;
}

View File

@ -56,18 +56,31 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa
if( nameList.empty() )
{
msg = _( "No components found matching " );
if( !BufName.IsEmpty() )
if( !BufName.IsEmpty() )
{
msg += _( "name search criteria <" ) + BufName + wxT( "> " );
if( !Keys.IsEmpty() )
msg += _( "and " );
if( !Keys.IsEmpty() )
{
msg.Printf( _( "No components found matching name search criteria '%s' and key search criteria '%s'" ),
GetChars( BufName ), GetChars( Keys ) );
}
else
{
msg.Printf( _( "No components found matching name search criteria '%s'" ),
GetChars( BufName ) );
}
}
else
{
if( !Keys.IsEmpty() )
{
msg.Printf( _( "No components found matching key search criteria '%s'" ),
GetChars( Keys ) );
}
else
{
msg = _( "No components found matching" );
}
}
if( !Keys.IsEmpty() )
msg += _( "key search criteria <" ) + Keys + wxT( "> " );
DisplayInfoMessage( frame, msg );

View File

@ -132,16 +132,19 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
if( GetResetItems() )
{
message = _( "Clear and annotate all of the components " );
if( GetLevel() )
message += _( "Clear and annotate all of the components on the entire schematic?" );
else
message += _( "Clear and annotate all of the components on the current sheet?" );
promptUser = true;
}
else
message = _( "Annotate only the unannotated components " );
if( GetLevel() )
message += _( "on the entire schematic?" );
else
message += _( "on the current sheet?" );
{
if( GetLevel() )
message += _( "Annotate only the unannotated components on the entire schematic?" );
else
message += _( "Annotate only the unannotated components on the current sheet?" );
}
message += _( "\n\nThis operation will change the current annotation and cannot be undone." );
@ -179,11 +182,11 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event )
{
int response;
wxString message = _( "Clear the existing annotation for " );
wxString message;
if( GetLevel() )
message += _( "the entire schematic?" );
message = _( "Clear the existing annotation for the entire schematic?" );
else
message += _( "the current sheet?" );
message = _( "Clear the existing annotation for the current sheet?" );
message += _( "\n\nThis operation will clear the existing annotation and cannot be undone." );
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );

View File

@ -472,7 +472,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsShortList( )
if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL )
{
wxString msg;
msg.Printf( _( "Failed to open file '%s'" ), GetChars(m_listFileName) );
msg.Printf( _( "Failed to open file <%s>" ), GetChars(m_listFileName) );
DisplayError( this, msg );
return;
}
@ -481,7 +481,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsShortList( )
bom_lister.SetCvsFormOn( s_ExportSeparatorSymbol );
// Set the list of fields to add to list
for( int ii = FOOTPRINT; ii < FIELD8; ii++ )
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
if( IsFieldChecked( ii ) )
bom_lister.AddFieldIdToPrintList( ii );
// Write the list of components grouped by values:
@ -509,8 +509,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsFullList( bool aIncludeSubComponent
if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << m_listFileName;
msg.Printf( _( "Failed to open file <%s>" ), GetChars( m_listFileName ) );
DisplayError( this, msg );
return;
}
@ -530,7 +529,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsFullList( bool aIncludeSubComponent
aIncludeSubComponents );
// Set the list of fields to add to list
for( int ii = FOOTPRINT; ii < FIELD8; ii++ )
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
if( IsFieldChecked( ii ) )
bom_lister.AddFieldIdToPrintList( ii );
@ -553,8 +552,7 @@ void DIALOG_BUILD_BOM::CreatePartsAndLabelsFullList( bool aIncludeSubComponents
if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to open file " );
msg << m_listFileName;
msg.Printf( _( "Failed to open file <%s>" ), GetChars( m_listFileName ) );
DisplayError( this, msg );
return;
}
@ -564,7 +562,7 @@ void DIALOG_BUILD_BOM::CreatePartsAndLabelsFullList( bool aIncludeSubComponents
bom_lister.SetCvsFormOff();
bom_lister.SetPrintLocation( s_Add_Location );
// Set the list of fields to add to list
for( int ii = FOOTPRINT; ii < FIELD8; ii++ )
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
if( IsFieldChecked( ii ) )
bom_lister.AddFieldIdToPrintList( ii );

View File

@ -11,6 +11,7 @@
#include <protos.h>
#include <dialog_color_config.h>
#include <layers_id_colors_and_visibility.h>
#define ID_COLOR_SETUP 1800
@ -66,7 +67,7 @@ static ButtonIndex buttonGroups[] = {
};
static EDA_COLOR_T currentColors[ MAX_LAYER ];
static EDA_COLOR_T currentColors[ NB_SCH_LAYERS ];
IMPLEMENT_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG, wxDialog )
@ -129,7 +130,6 @@ void DIALOG_COLOR_CONFIG::Init()
void DIALOG_COLOR_CONFIG::CreateControls()
{
wxStaticText* label;
int color;
int buttonId = 1800;
ButtonIndex* groups = buttonGroups;
@ -167,12 +167,11 @@ void DIALOG_COLOR_CONFIG::CreateControls()
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( bitmap );
color = currentColors[ buttons->m_Layer ] = ReturnLayerColor( buttons->m_Layer );
EDA_COLOR_T color = GetLayerColor( LayerNumber( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color;
iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
brush.SetColour( ColorRefs[ color ].m_Red,
ColorRefs[ color ].m_Green,
ColorRefs[ color ].m_Blue );
ColorSetBrush( &brush, color );
brush.SetStyle( wxSOLID );
iconDC.SetBrush( brush );
@ -266,9 +265,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
iconDC.SelectObject( bitmap );
wxBrush brush;
iconDC.SetPen( *wxBLACK_PEN );
brush.SetColour( ColorRefs[ color ].m_Red,
ColorRefs[ color ].m_Green,
ColorRefs[ color ].m_Blue );
ColorSetBrush( &brush, color);
brush.SetStyle( wxSOLID );
iconDC.SetBrush( brush );
@ -290,17 +287,17 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
bool warning = false;
for( int ii = 0; ii < MAX_LAYERS; ii++ )
for( LayerNumber ii = LAYER_WIRE; ii < NB_SCH_LAYERS; ++ii )
{
SetLayerColor( currentColors[ ii ], ii );
if( g_DrawBgColor == ReturnLayerColor( ii ) )
if( g_DrawBgColor == GetLayerColor( ii ) )
warning = true;
}
m_Parent->SetGridColor( ReturnLayerColor( LAYER_GRID ) );
m_Parent->SetGridColor( GetLayerColor( LAYER_GRID ) );
if( g_DrawBgColor == ReturnLayerColor( LAYER_GRID ) )
if( g_DrawBgColor == GetLayerColor( LAYER_GRID ) )
warning = true;
return warning;

View File

@ -49,18 +49,17 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
return;
}
wxString title = _( "Properties for " );
wxString title;
bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0;
if( !isRoot )
{
title += m_Parent->GetAliasName() + _( " (alias of " ) + component->GetName() + wxT( ")" );
title.Printf( _( "Properties for %s (alias of %s)" ),
GetChars( m_Parent->GetAliasName() ),
GetChars( component->GetName() ) );
}
else
{
title += component->GetName();
}
title.Printf( _( "Properties for %s" ), GetChars( component->GetName() ) );
SetTitle( title );
InitPanelDoc();
@ -453,7 +452,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event )
{
if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) )
if( IsOK( this, _( "OK to delete the footprint filter list ?" ) ) )
{
m_FootprintFilterListBox->Clear();
m_ButtonDeleteAllFootprintFilter->Enable( false );

View File

@ -1,3 +1,26 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2011 KiCad Developers, see change_log.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 dialog_edit_component_in_schematic.cpp
*/
@ -79,18 +102,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
columnLabel.SetText( _( "Value" ) );
fieldListCtrl->InsertColumn( 1, columnLabel );
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit );
textSizeLabel->SetLabel( label );
label = _( "Pos " );
label += _( "X" );
label += ReturnUnitSymbol( g_UserUnit );
posXLabel->SetLabel( label );
label = _( "Pos " );
label += _( "Y" );
label += ReturnUnitSymbol( g_UserUnit );
posYLabel->SetLabel( label );
m_staticTextUnitSize->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
copySelectedFieldToPanel();
@ -142,8 +156,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
newname.Replace( wxT( " " ), wxT( "_" ) );
if( newname.IsEmpty() )
{
DisplayError( NULL, _( "No Component Name!" ) );
}
else if( newname.CmpNoCase( m_Cmp->m_ChipName ) )
{
if( CMP_LIBRARY::FindLibraryEntry( newname ) == NULL )
@ -230,12 +245,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
copyPanelToOptions();
// change all field positions from relative to absolute
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{
m_FieldsBuf[i].SetPosition( m_FieldsBuf[i].GetPosition() + m_Cmp->m_Pos );
}
// Delete any fields with no name before we copy all of m_FieldsBuf back into the component.
for( unsigned i = MANDATORY_FIELDS; i<m_FieldsBuf.size(); )
{
@ -251,9 +260,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
{
wxString msg;
msg.Printf( _( "The field name <%s> does not have a value and is not defined in \
the field template list. Empty field values are invalid an will be removed from the component. \
Do you wish to remove this and all remaining undefined fields?" ),
msg.Printf( _( "The field name <%s> does not have a value and is not defined in "
"the field template list. Empty field values are invalid an will "
"be removed from the component. Do you wish to remove this and "
"all remaining undefined fields?" ),
GetChars( m_FieldsBuf[i].GetName( false ) ) );
wxMessageDialog dlg( this, msg, _( "Remove Fields" ), wxYES_NO | wxNO_DEFAULT );
@ -271,6 +281,12 @@ Do you wish to remove this and all remaining undefined fields?" ),
++i;
}
// change all field positions from relative to absolute
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{
m_FieldsBuf[i].SetTextPosition( m_FieldsBuf[i].GetTextPosition() + m_Cmp->m_Pos );
}
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
if( entry && entry->IsPower() )
@ -440,8 +456,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
#if 0 && defined(DEBUG)
for( int i = 0; i<aComponent->GetFieldCount(); ++i )
{
printf( "Orig[%d] (x=%d, y=%d)\n", i, aComponent->m_Fields[i].m_Pos.x,
aComponent->m_Fields[i].m_Pos.y );
printf( "Orig[%d] (x=%d, y=%d)\n", i, aComponent->m_Fields[i].GetTextPosition().x,
aComponent->m_Fields[i].GetTextPosition().y );
}
#endif
@ -458,7 +474,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
m_FieldsBuf.push_back( aComponent->m_Fields[i] );
// make the editable field position relative to the component
m_FieldsBuf[i].SetPosition( m_FieldsBuf[i].GetPosition() - m_Cmp->m_Pos );
m_FieldsBuf[i].SetTextPosition( m_FieldsBuf[i].GetTextPosition() - m_Cmp->m_Pos );
}
// Add template fieldnames:
@ -491,7 +507,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
fld = *schField;
// make the editable field position relative to the component
fld.SetPosition( fld.GetPosition() - m_Cmp->m_Pos );
fld.SetTextPosition( fld.GetTextPosition() - m_Cmp->m_Pos );
}
m_FieldsBuf.push_back( fld );
@ -510,7 +526,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
m_FieldsBuf.push_back( *cmp );
// make the editable field position relative to the component
m_FieldsBuf[newNdx].SetPosition( m_FieldsBuf[newNdx].GetPosition() - m_Cmp->m_Pos );
m_FieldsBuf[newNdx].SetTextPosition( m_FieldsBuf[newNdx].GetTextPosition() -
m_Cmp->m_Pos );
}
}
@ -606,18 +623,18 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
// Select the right text justification
if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
m_FieldHJustifyCtrl->SetSelection(0);
m_FieldHJustifyCtrl->SetSelection( 0 );
else if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
m_FieldHJustifyCtrl->SetSelection(2);
m_FieldHJustifyCtrl->SetSelection( 2 );
else
m_FieldHJustifyCtrl->SetSelection(1);
m_FieldHJustifyCtrl->SetSelection( 1 );
if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
m_FieldVJustifyCtrl->SetSelection(0);
m_FieldVJustifyCtrl->SetSelection( 0 );
else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
m_FieldVJustifyCtrl->SetSelection( 2 );
else
m_FieldVJustifyCtrl->SetSelection(1);
m_FieldVJustifyCtrl->SetSelection( 1 );
fieldNameTextCtrl->SetValue( field.GetName( false ) );
@ -644,7 +661,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) );
wxPoint coord = field.GetPosition();
wxPoint coord = field.GetTextPosition();
wxPoint zero = -m_Cmp->m_Pos; // relative zero
// If the field value is empty and the position is at relative zero, we
@ -655,10 +672,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
{
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetOrientation() == TEXT_ORIENT_VERT );
coord.x = m_FieldsBuf[REFERENCE].GetPosition().x
coord.x = m_FieldsBuf[REFERENCE].GetTextPosition().x
+ ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
coord.y = m_FieldsBuf[REFERENCE].GetPosition().y
coord.y = m_FieldsBuf[REFERENCE].GetTextPosition().y
+ ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
// coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT.
@ -728,7 +745,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
wxPoint pos;
pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
field.SetPosition( pos );
field.SetTextPosition( pos );
return true;
}
@ -844,11 +861,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
// Perhaps the FOOTPRINT field should also be considered,
// but for most of components it is not set in library
LIB_FIELD& refField = entry->GetReferenceField();
m_Cmp->GetField( REFERENCE )->SetPosition( refField.GetPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( REFERENCE )->SetTextPosition( refField.GetTextPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( REFERENCE )->ImportValues( refField );
LIB_FIELD& valField = entry->GetValueField();
m_Cmp->GetField( VALUE )->SetPosition( valField.GetPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( VALUE )->SetTextPosition( valField.GetTextPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( VALUE )->ImportValues( valField );
m_Cmp->SetOrientation( CMP_NORMAL );

View File

@ -1,280 +1,298 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_component_in_schematic_fbp.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* upperSizer;
upperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
wxStaticBoxSizer* unitSizer;
unitSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Unit") ), wxVERTICAL );
wxString unitChoiceChoices[] = { _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26") };
int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString );
unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 );
unitChoice->SetSelection( 0 );
unitSizer->Add( unitChoice, 0, wxALL|wxEXPAND, 5 );
optionsSizer->Add( unitSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
wxBoxSizer* orientationSizer;
orientationSizer = new wxBoxSizer( wxHORIZONTAL );
wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") };
int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString );
orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
orientationRadioBox->SetSelection( 0 );
orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") );
orientationSizer->Add( orientationRadioBox, 1, wxALL|wxEXPAND, 8 );
optionsSizer->Add( orientationSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxBoxSizer* mirrorSizer;
mirrorSizer = new wxBoxSizer( wxHORIZONTAL );
wxString mirrorRadioBoxChoices[] = { _("Normal"), _("Mirror ---"), _("Mirror |") };
int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString );
mirrorRadioBox = new wxRadioBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
mirrorRadioBox->SetSelection( 0 );
mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 );
optionsSizer->Add( mirrorSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxStaticBoxSizer* chipnameSizer;
chipnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxHORIZONTAL );
chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
chipnameTextCtrl->SetMaxLength( 32 );
chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") );
chipnameSizer->Add( chipnameTextCtrl, 1, wxALL|wxEXPAND, 5 );
optionsSizer->Add( chipnameSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 );
convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 );
convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") );
optionsSizer->Add( convertCheckBox, 0, wxALL, 8 );
partsAreLockedLabel = new wxStaticText( this, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 );
partsAreLockedLabel->Wrap( -1 );
optionsSizer->Add( partsAreLockedLabel, 0, wxALL|wxEXPAND, 8 );
defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") );
optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 );
upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* fieldsSizer;
fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL );
wxStaticBoxSizer* gridStaticBoxSizer;
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );
addFieldButton->SetToolTip( _("Add a new custom field") );
gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 );
deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 );
deleteFieldButton->SetToolTip( _("Delete one of the optional fields") );
gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 );
moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
moveUpButton->SetToolTip( _("Move the selected optional fields up one position") );
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 3, wxEXPAND|wxRIGHT|wxLEFT, 8 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerOptions;
sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Text Justification:") ), wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 0 );
sbSizerOptions->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 2 );
sbSizerOptions->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( sbSizerOptions, 0, wxEXPAND, 5 );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
wxBoxSizer* bShowRotateSizer;
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 3 );
m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schemati") );
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND|wxTOP, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* fieldTextBoxSizer;
fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* textSizeBoxSizer;
textSizeBoxSizer = new wxBoxSizer( wxVERTICAL );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetToolTip( _("The size of the currently selected field's text in the schematic") );
textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* positionBoxSizer;
positionBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* posXBoxSizer;
posXBoxSizer = new wxBoxSizer( wxVERTICAL );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
posXBoxSizer->Add( posXLabel, 0, 0, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXTextCtrl->SetToolTip( _("The X coordinate of the text relative to the component") );
posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 );
positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* posYBoxSizer;
posYBoxSizer = new wxBoxSizer( wxVERTICAL );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
posYBoxSizer->Add( posYLabel, 0, 0, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 );
positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( positionBoxSizer, 0, wxEXPAND, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 );
upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( upperSizer, 1, wxEXPAND, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK );
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
this->SetSizer( mainSizer );
this->Layout();
// Connect Events
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP()
{
// Disconnect Events
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_component_in_schematic_fbp.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* upperSizer;
upperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Component") ), wxVERTICAL );
m_staticTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnit->Wrap( -1 );
optionsSizer->Add( m_staticTextUnit, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString unitChoiceChoices[] = { _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26") };
int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString );
unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 );
unitChoice->SetSelection( 0 );
optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* orientationSizer;
orientationSizer = new wxBoxSizer( wxHORIZONTAL );
wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") };
int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString );
orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
orientationRadioBox->SetSelection( 0 );
orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") );
orientationSizer->Add( orientationRadioBox, 1, wxALL|wxEXPAND, 8 );
optionsSizer->Add( orientationSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxBoxSizer* mirrorSizer;
mirrorSizer = new wxBoxSizer( wxHORIZONTAL );
wxString mirrorRadioBoxChoices[] = { _("Normal"), _("Mirror ---"), _("Mirror |") };
int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString );
mirrorRadioBox = new wxRadioBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
mirrorRadioBox->SetSelection( 0 );
mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 );
optionsSizer->Add( mirrorSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
m_staticTextChipname = new wxStaticText( this, wxID_ANY, _("Chip Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextChipname->Wrap( -1 );
optionsSizer->Add( m_staticTextChipname, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
chipnameTextCtrl->SetMaxLength( 32 );
chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") );
optionsSizer->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 );
convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") );
optionsSizer->Add( convertCheckBox, 0, wxALL, 8 );
partsAreLockedLabel = new wxStaticText( this, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 );
partsAreLockedLabel->Wrap( -1 );
optionsSizer->Add( partsAreLockedLabel, 0, wxALL|wxEXPAND, 8 );
defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") );
optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 );
upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* fieldsSizer;
fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL );
wxStaticBoxSizer* gridStaticBoxSizer;
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );
addFieldButton->SetToolTip( _("Add a new custom field") );
gridStaticBoxSizer->Add( addFieldButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 );
deleteFieldButton->SetToolTip( _("Delete one of the optional fields") );
gridStaticBoxSizer->Add( deleteFieldButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
moveUpButton->SetToolTip( _("Move the selected optional fields up one position") );
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 3, wxEXPAND|wxRIGHT|wxLEFT, 8 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerJustification;
bSizerJustification = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 0 );
bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 0 );
bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( bSizerJustification, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bSizerStyle;
bSizerStyle = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 );
bSizerStyle->Add( visibilitySizer, 1, wxEXPAND|wxALL, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 3 );
m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schemati") );
bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, wxTOP, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetMaxLength( 0 );
fieldNameTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxEXPAND, 5 );
wxBoxSizer* fieldTextBoxSizer;
fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldTextBoxSizer->Add( fieldValueLabel, 0, wxTOP, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetMaxLength( 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetMaxLength( 0 );
textSizeTextCtrl->SetToolTip( _("The size of the currently selected field's text in the schematic") );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXTextCtrl->SetMaxLength( 0 );
posXTextCtrl->SetToolTip( _("The X coordinate of the text relative to the component") );
fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxTOP|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetMaxLength( 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 );
upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( upperSizer, 1, wxEXPAND, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK );
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
this->SetSizer( mainSizer );
this->Layout();
// Connect Events
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP()
{
// Disconnect Events
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +1,94 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
#define __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/choice.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/listctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
{
private:
protected:
wxChoice* unitChoice;
wxRadioBox* orientationRadioBox;
wxRadioBox* mirrorRadioBox;
wxTextCtrl* chipnameTextCtrl;
wxCheckBox* convertCheckBox;
wxStaticText* partsAreLockedLabel;
wxButton* defaultsButton;
wxListCtrl* fieldListCtrl;
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,521 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
};
#endif //__DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
#define __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/radiobox.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/listctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
{
private:
protected:
wxStaticText* m_staticTextUnit;
wxChoice* unitChoice;
wxRadioBox* orientationRadioBox;
wxRadioBox* mirrorRadioBox;
wxStaticText* m_staticTextChipname;
wxTextCtrl* chipnameTextCtrl;
wxCheckBox* convertCheckBox;
wxStaticText* partsAreLockedLabel;
wxButton* defaultsButton;
wxListCtrl* fieldListCtrl;
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* m_staticTextUnitSize;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* m_staticTextUnitPosX;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,496 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
};
#endif //__DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__

View File

@ -140,7 +140,7 @@ void DIALOG_LABEL_EDITOR::InitDialog()
break;
}
int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
const int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
int max_len = 0;
@ -194,7 +194,7 @@ void DIALOG_LABEL_EDITOR::InitDialog()
m_TextStyle->SetSelection( style );
wxString units = ReturnUnitSymbol( g_UserUnit, wxT( "(%s)" ) );
msg = _( "H" ) + units + _( " x W" ) + units;
msg.Printf( _( "H%s x W%s" ), GetChars( units ), GetChars( units ) );
m_staticSizeUnits->SetLabel( msg );
msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->GetSize().x );

View File

@ -34,8 +34,8 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN
/*****************************************************************************************/
{
private:
LIB_EDIT_FRAME* m_Parent;
LIB_COMPONENT* m_LibEntry;
LIB_EDIT_FRAME* m_parent;
LIB_COMPONENT* m_libEntry;
bool m_skipCopyFromPanel;
/// a copy of the edited component's LIB_FIELDs
@ -64,10 +64,10 @@ private:
int getSelectedFieldNdx();
/**
* Function InitBuffers
* Function initBuffers
* sets up to edit the given component.
*/
void InitBuffers();
void initBuffers();
/**
* Function findField
@ -133,8 +133,8 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent )
/***********************************************************************/
{
m_Parent = aParent;
m_LibEntry = aLibEntry;
m_parent = aParent;
m_libEntry = aLibEntry;
GetSizer()->SetSizeHints( this );
Centre();
@ -163,20 +163,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
columnLabel.SetText( _( "Value" ) );
fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel );
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit );
textSizeLabel->SetLabel( label );
m_staticTextUnitSize->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
label = _( "Pos " );
label += _( "X" );
label += ReturnUnitSymbol( g_UserUnit );
posXLabel->SetLabel( label );
label = _( "Pos " );
label += _( "Y" );
label += ReturnUnitSymbol( g_UserUnit );
posYLabel->SetLabel( label );
InitBuffers();
initBuffers();
copySelectedFieldToPanel();
stdDialogButtonSizerOK->SetDefault();
@ -237,7 +228,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
* or root alias of the component */
wxString newvalue = m_FieldsBuf[VALUE].GetText();
if( m_LibEntry->HasAlias( newvalue ) && !m_LibEntry->GetAlias( newvalue )->IsRoot() )
if( m_libEntry->HasAlias( newvalue ) && !m_libEntry->GetAlias( newvalue )->IsRoot() )
{
wxString msg;
msg.Printf( _( "A new name is entered for this component\n\
@ -249,7 +240,7 @@ An alias %s already exists!\nCannot update this component" ),
/* End unused code */
/* save old cmp in undo list */
m_Parent->SaveCopyInUndoList( m_LibEntry, IS_CHANGED );
m_parent->SaveCopyInUndoList( m_libEntry, IS_CHANGED );
// delete any fields with no name or no value before we copy all of m_FieldsBuf
// back into the component
@ -274,12 +265,12 @@ An alias %s already exists!\nCannot update this component" ),
#endif
// copy all the fields back, fully replacing any previous fields
m_LibEntry->SetFields( m_FieldsBuf );
m_libEntry->SetFields( m_FieldsBuf );
// We need to keep the name and the value the same at the moment!
SetName( m_LibEntry->GetValueField().GetText() );
SetName( m_libEntry->GetValueField().GetText() );
m_Parent->OnModify();
m_parent->OnModify();
EndModal( 0 );
}
@ -445,13 +436,11 @@ LIB_FIELD* DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::findField( const wxString& aField
}
/***********************************************************/
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
/***********************************************************/
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
{
LIB_FIELDS cmpFields;
m_LibEntry->GetFields( cmpFields );
m_libEntry->GetFields( cmpFields );
#if defined(DEBUG)
for( unsigned i=0; i<cmpFields.size(); ++i )
@ -492,7 +481,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// Now copy in the template fields, in the order that they are present in the
// template field editor UI.
const TEMPLATE_FIELDNAMES& tfnames =
((SCH_EDIT_FRAME*)m_Parent->GetParent())->GetTemplateFieldNames();
((SCH_EDIT_FRAME*)m_parent->GetParent())->GetTemplateFieldNames();
for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it )
{
@ -661,7 +650,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) );
wxPoint coord = field.GetPosition();
wxPoint coord = field.GetTextPosition();
wxPoint zero;
// If the field value is empty and the position is at relative zero, we set the
@ -672,8 +661,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
{
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetOrientation() == TEXT_ORIENT_VERT );
coord.x = m_FieldsBuf[REFERENCE].GetPosition().x + (fieldNdx - MANDATORY_FIELDS + 1) * 100;
coord.y = m_FieldsBuf[REFERENCE].GetPosition().y + (fieldNdx - MANDATORY_FIELDS + 1) * 100;
coord.x = m_FieldsBuf[REFERENCE].GetTextPosition().x +
(fieldNdx - MANDATORY_FIELDS + 1) * 100;
coord.y = m_FieldsBuf[REFERENCE].GetTextPosition().y +
(fieldNdx - MANDATORY_FIELDS + 1) * 100;
// coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT.
// That is ok, we basically don't want all the new empty fields on
@ -761,7 +752,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
// and the screen axis is top to bottom: we must change the y coord sign for editing
NEGATE( pos.y );
field.SetPosition( pos );
field.SetTextPosition( pos );
return true;
}

View File

@ -1,208 +1,227 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_libentry_fields_in_lib_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* fieldsSizer;
fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL );
wxStaticBoxSizer* gridStaticBoxSizer;
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );
addFieldButton->SetToolTip( _("Add a new custom field") );
gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 );
deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 );
deleteFieldButton->SetToolTip( _("Delete one of the optional fields") );
gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 );
moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
moveUpButton->SetToolTip( _("Move the selected optional fields up one position") );
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 5, wxEXPAND|wxRIGHT, 8 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Text Justification:") ), wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
optionsSizer->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 8 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 0 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
optionsSizer->Add( m_FieldVJustifyCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 8 );
fieldEditBoxSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxEXPAND|wxBOTTOM, 5 );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
wxBoxSizer* bShowRotateSizer;
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 1 );
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* fieldTextBoxSizer;
fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* textSizeBoxSizer;
textSizeBoxSizer = new wxBoxSizer( wxVERTICAL );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") );
textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* positionBoxSizer;
positionBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* posXBoxSizer;
posXBoxSizer = new wxBoxSizer( wxVERTICAL );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
posXBoxSizer->Add( posXLabel, 0, 0, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 );
positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* posYBoxSizer;
posYBoxSizer = new wxBoxSizer( wxVERTICAL );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
posYBoxSizer->Add( posYLabel, 0, 0, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 );
positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( positionBoxSizer, 1, wxEXPAND, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 3, wxEXPAND, 5 );
mainSizer->Add( fieldsSizer, 1, wxEXPAND|wxALL, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK );
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
this->SetSizer( mainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );
}
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_libentry_fields_in_lib_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerFieldsSetup;
bSizerFieldsSetup = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerFiledsList;
bSizerFiledsList = new wxBoxSizer( wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
bSizerFiledsList->Add( fieldListCtrl, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );
addFieldButton->SetToolTip( _("Add a new custom field") );
bSizerFiledsList->Add( addFieldButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 );
deleteFieldButton->SetToolTip( _("Delete one of the optional fields") );
bSizerFiledsList->Add( deleteFieldButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
moveUpButton->SetToolTip( _("Move the selected optional fields up one position") );
bSizerFiledsList->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
bSizerFieldsSetup->Add( bSizerFiledsList, 1, wxEXPAND, 5 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerJustify;
bSizerJustify = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 0 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bSizerAspect;
bSizerAspect = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 );
bSizerAspect->Add( visibilitySizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 0 );
bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND|wxTOP, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetMaxLength( 0 );
fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* fieldTextBoxSizer;
fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetMaxLength( 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetMaxLength( 0 );
textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXTextCtrl->SetMaxLength( 0 );
fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetMaxLength( 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
bSizerFieldsSetup->Add( fieldEditBoxSizer, 0, wxEXPAND, 5 );
mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK );
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
this->SetSizer( mainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );
}
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +1,86 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
#define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/listctrl.h>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
{
private:
protected:
wxListCtrl* fieldListCtrl;
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};
#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
#define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/listctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
{
private:
protected:
wxListCtrl* fieldListCtrl;
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* m_staticTextUnitSize;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* m_staticTextUnitPosX;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,456 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};
#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__

View File

@ -54,7 +54,7 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame,
Init();
msg = _( "from " ) + wxGetApp().GetCurrentOptionFile();
msg.Printf( _( "from <%s>" ), GetChars( wxGetApp().GetCurrentOptionFile() ) );
SetTitle( msg );
if( GetSizer() )

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -16,14 +16,21 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbLibsChoiceSizer;
sbLibsChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Component library files") ), wxHORIZONTAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxVERTICAL );
m_staticTextLibsList = new wxStaticText( this, wxID_ANY, _("Component library files"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLibsList->Wrap( -1 );
bSizerUpper->Add( m_staticTextLibsList, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerLibsChoice;
bSizerLibsChoice = new wxBoxSizer( wxHORIZONTAL );
m_ListLibr = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Eeschema.\nThe order of this list is important:\nEeschema searchs for a given component using this list order priority.") );
m_ListLibr->SetMinSize( wxSize( 400,250 ) );
sbLibsChoiceSizer->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerLibsChoice->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
@ -49,18 +56,30 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
m_buttonDown = new wxButton( this, wxID_ANY, _("Down"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonDown, 0, wxALL|wxEXPAND, 5 );
sbLibsChoiceSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bMainSizer->Add( sbLibsChoiceSizer, 2, wxALL|wxEXPAND, 5 );
bSizerLibsChoice->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User defined search path") ), wxHORIZONTAL );
bSizerUpper->Add( bSizerLibsChoice, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerUpper, 2, wxEXPAND, 5 );
wxBoxSizer* bSizerMiddle;
bSizerMiddle = new wxBoxSizer( wxVERTICAL );
m_staticTextPaths = new wxStaticText( this, wxID_ANY, _("User defined search path"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPaths->Wrap( -1 );
bSizerMiddle->Add( m_staticTextPaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerPathsChoice;
bSizerPathsChoice = new wxBoxSizer( wxHORIZONTAL );
m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is higher than default KiCad paths.") );
m_listUserPaths->SetMinSize( wxSize( 400,90 ) );
sbSizer4->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerPathsChoice->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bUserPathsButtonsSizer;
bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
@ -74,19 +93,29 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
m_buttonRemovePath = new wxButton( this, wxID_REMOVE_PATH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxALL|wxEXPAND, 5 );
sbSizer4->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bMainSizer->Add( sbSizer4, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerPathsChoice->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxStaticBoxSizer* sbLibPathSizer;
sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current search path list") ), wxVERTICAL );
bSizerMiddle->Add( bSizerPathsChoice, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerMiddle, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerLower;
bSizerLower = new wxBoxSizer( wxVERTICAL );
m_staticTextPathlist = new wxStaticText( this, wxID_ANY, _("Current search path list"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPathlist->Wrap( -1 );
bSizerLower->Add( m_staticTextPathlist, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB );
m_DefaultLibraryPathslistBox->SetToolTip( _("System and user paths used to search and load library files and component doc files.\nSorted by decreasing priority order.") );
sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 1, wxALL|wxEXPAND, 5 );
bSizerLower->Add( m_DefaultLibraryPathslistBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( sbLibPathSizer, 1, wxALL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bMainSizer->Add( bSizerLower, 1, wxEXPAND, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@ -97,8 +126,10 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,25 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_eeschema_config_fbp__
#define __dialog_eeschema_config_fbp__
#ifndef __DIALOG_EESCHEMA_CONFIG_FBP_H__
#define __DIALOG_EESCHEMA_CONFIG_FBP_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/listbox.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/listbox.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/dialog.h>
@ -38,19 +39,22 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
ID_REMOVE_LIB,
ID_LIB_PATH_SEL,
wxID_INSERT_PATH,
wxID_REMOVE_PATH,
wxID_REMOVE_PATH
};
wxStaticText* m_staticTextLibsList;
wxListBox* m_ListLibr;
wxButton* m_buttonAddLib;
wxButton* m_buttonIns;
wxButton* m_buttonRemoveLib;
wxButton* m_buttonUp;
wxButton* m_buttonDown;
wxStaticText* m_staticTextPaths;
wxListBox* m_listUserPaths;
wxButton* m_buttonAddPath;
wxButton* m_buttonInsPath;
wxButton* m_buttonRemovePath;
wxStaticText* m_staticTextPathlist;
wxListBox* m_DefaultLibraryPathslistBox;
wxStaticLine* m_staticline3;
@ -72,9 +76,9 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_CONFIG_FBP();
};
#endif //__dialog_eeschema_config_fbp__
#endif //__DIALOG_EESCHEMA_CONFIG_FBP_H__

View File

@ -44,7 +44,7 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
m_plotOriginOpt->SetSelection( 0 );
m_paperHPGLSizer->Add( m_plotOriginOpt, 0, wxALL, 5 );
m_penHPLGWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_penHPLGWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen width"), wxDefaultPosition, wxDefaultSize, 0 );
m_penHPLGWidthTitle->Wrap( -1 );
m_paperHPGLSizer->Add( m_penHPLGWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
@ -67,7 +67,7 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
wxStaticBoxSizer* sbSizerPlotFormat;
sbSizerPlotFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General Options") ), wxVERTICAL );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default Line Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle->Wrap( -1 );
sbSizerPlotFormat->Add( m_defaultLineWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );

View File

@ -45,7 +45,7 @@
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Plot</property>
<property name="title">Plot Schematic</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -507,7 +507,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pen Width:</property>
<property name="label">Pen width</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -787,7 +787,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default Line Thickness:</property>
<property name="label">Default line thickness</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>

View File

@ -77,7 +77,7 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
public:
DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_BASE();
};

View File

@ -85,7 +85,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
dirty.Inflate( 4 ); // Give a margin
aPanel->SetMouseCapture( NULL, NULL ); // Avoid loop in redraw panel
int flgs = image->GetFlags();
STATUS_FLAGS flgs = image->GetFlags();
image->ClearFlags();
aPanel->RefreshDrawingRect( dirty );
image->SetFlags( flgs );

View File

@ -68,12 +68,11 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
}
// Loaded library statusbar message
msg = _( "Library " ) + tmp;
fn = tmp;
if( CMP_LIBRARY::AddLibrary( fn, errMsg ) )
{
msg += _( " loaded" );
msg.Printf( _( "Library <%s> loaded" ), GetChars( tmp ) );
sortOrder.Add( fn.GetName() );
}
else
@ -84,7 +83,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
GetChars( fn.GetFullPath() ),
GetChars( errMsg ) );
DisplayError( this, prompt );
msg += _( " error!" );
msg.Printf( _( "Library <%s> error!" ), GetChars( tmp ) );
}
PrintMsg( msg );

View File

@ -118,7 +118,7 @@ bool EDA_APP::OnInit()
// Give a default colour for all layers
// (actual color will beinitialized by config)
for( int ii = 0; ii < MAX_LAYERS; ii++ )
for( int ii = 0; ii < NB_SCH_LAYERS; ii++ )
SetLayerColor( DARKGRAY, ii );
// read current setup and reopen last directory if no filename to open in

View File

@ -53,7 +53,7 @@
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
static EDA_COLOR_T s_layerColor[MAX_LAYERS];
static EDA_COLOR_T s_layerColor[NB_SCH_LAYERS];
// The width to draw busses that do not have a specific width
static int s_defaultBusThickness;
@ -65,7 +65,7 @@ int GetDefaultBusThickness()
void SetDefaultBusThickness( int aThickness)
{
if( aThickness >=1 )
if( aThickness >= 1 )
s_defaultBusThickness = aThickness;
else
s_defaultBusThickness = 1;
@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness)
s_drawDefaultLineThickness = 1;
}
EDA_COLOR_T ReturnLayerColor( int aLayer )
EDA_COLOR_T GetLayerColor( LayerNumber aLayer )
{
return s_layerColor[aLayer];
}
@ -460,80 +460,77 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorWireEx" ),
&s_layerColor[LAYER_WIRE],
GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBus" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBusEx" ),
&s_layerColor[LAYER_BUS],
BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConn" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConnEx" ),
&s_layerColor[LAYER_JUNCTION],
GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLlab" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLLabelEx" ),
&s_layerColor[LAYER_LOCLABEL],
BLACK ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHlab" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHLabelEx" ),
&s_layerColor[LAYER_HIERLABEL],
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGbllab" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGLabelEx" ),
&s_layerColor[LAYER_GLOBLABEL],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinF" ),
&s_layerColor[LAYER_PINFUN],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColPinN" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinNumEx" ),
&s_layerColor[LAYER_PINNUM],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPNam" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinNameEx" ),
&s_layerColor[LAYER_PINNAM],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorField" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorFieldEx" ),
&s_layerColor[LAYER_FIELDS],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRef" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorReferenceEx" ),
&s_layerColor[LAYER_REFERENCEPART],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValue" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValueEx" ),
&s_layerColor[LAYER_VALUEPART],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNote" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoteEx" ),
&s_layerColor[LAYER_NOTES],
LIGHTBLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBody" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyEx" ),
&s_layerColor[LAYER_DEVICE],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBg" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBgEx" ),
&s_layerColor[LAYER_DEVICE_BACKGROUND],
LIGHTYELLOW ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetN" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetNameEx" ),
&s_layerColor[LAYER_NETNAM],
DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPin" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinEx" ),
&s_layerColor[LAYER_PIN],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheet" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetEx" ),
&s_layerColor[LAYER_SHEET],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "ColorSheetFileName" ),
wxT( "ColorSheetFileNameEx" ),
&s_layerColor[LAYER_SHEETFILENAME],
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetName" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetNameEx" ),
&s_layerColor[LAYER_SHEETNAME],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLab" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLabelEx" ),
&s_layerColor[LAYER_SHEETLABEL],
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoCo" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoConnectEx" ),
&s_layerColor[LAYER_NOCONNECT],
BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcW" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcWEx" ),
&s_layerColor[LAYER_ERC_WARN],
GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcEEx" ),
&s_layerColor[LAYER_ERC_ERR],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ),
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGridEx" ),
&s_layerColor[LAYER_GRID],
DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintMonochrome" ),
@ -558,7 +555,7 @@ void SCH_EDIT_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
// This is required until someone gets rid of the global variable s_layerColor.
m_GridColor = ReturnLayerColor( LAYER_GRID );
m_GridColor = GetLayerColor( LAYER_GRID );
SetDefaultBusThickness( cfg->Read( DefaultBusWidthEntry, 12l ) );
SetDefaultLineThickness( cfg->Read( DefaultDrawLineWidthEntry, 6l ) );

View File

@ -336,7 +336,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
}
// Reloading configuration.
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
msg.Printf( _( "Ready\nWorking dir: <%s>\n" ), GetChars( wxGetCwd() ) );
PrintMsg( msg );
LoadProjectFile( wxEmptyString, false );

View File

@ -122,7 +122,6 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
wxPoint pos, curpos;
bool centerAndRedraw = false;
bool notFound = true;
wxString msg;
LIB_PIN* pin;
SCH_SHEET_LIST sheetList;
@ -236,28 +235,29 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
/* Print diag */
wxString msg_item;
msg = aReference;
wxString msg;
switch( aSearchType )
{
default:
case FIND_COMPONENT_ONLY: // Find component only
msg_item = _( "component" );
break;
case FIND_PIN: // find a pin
msg_item = _( "Pin " ) + aSearchText;
msg_item.Printf( _( "pin %s" ), GetChars( aSearchText ) );
break;
case FIND_REFERENCE: // find reference
msg_item = _( "Ref " ) + aSearchText;
msg_item.Printf( _( "reference %s" ), GetChars( aSearchText ) );
break;
case FIND_VALUE: // find value
msg_item = _( "Value " ) + aSearchText;
msg_item.Printf( _( "value" ), GetChars( aSearchText ) );
break;
case FIND_FIELD: // find field. todo
msg_item = _( "Field " ) + aSearchText;
msg_item.Printf( _( "field" ), GetChars( aSearchText ) );
break;
}
@ -265,27 +265,19 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
{
if( !notFound )
{
if( !msg_item.IsEmpty() )
msg += wxT( " " ) + msg_item;
msg += _( " found" );
msg.Printf( _( "%s %s found" ),
GetChars( aReference ), GetChars( msg_item ) );
}
else
{
msg += _( " found" );
if( !msg_item.IsEmpty() )
{
msg += wxT( " but " ) + msg_item + _( " not found" );
}
msg.Printf( _( "%s found but %s not found" ),
GetChars( aReference ), GetChars( msg_item ) );
}
}
else
{
if( !msg_item.IsEmpty() )
msg += wxT( " " ) + msg_item;
msg += _( " not found" );
msg.Printf( _( "Component %s not found" ),
GetChars( aReference ) );
}
SetStatusText( msg );

View File

@ -18,8 +18,8 @@ class TRANSFORM;
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers.
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers
#define DEFAULT_TEXT_SIZE 50 // Default size for field texts
#define GR_DEFAULT_DRAWMODE GR_COPY
@ -33,7 +33,6 @@ typedef enum {
LAYER_LOCLABEL,
LAYER_GLOBLABEL,
LAYER_HIERLABEL,
LAYER_PINFUN,
LAYER_PINNUM,
LAYER_PINNAM,
LAYER_REFERENCEPART,
@ -52,12 +51,15 @@ typedef enum {
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
LAYER_GRID,
LAYER_ITEM_SELECTED,
LAYER_INVISIBLE_ITEM,
MAX_LAYER // end of list
NB_SCH_LAYERS
} LayerNumber;
inline LayerNumber operator++( LayerNumber& a )
{
a = LayerNumber( int( a ) + 1 );
return a;
}
/* Rotation, mirror of graphic items in components bodies are handled by a
* transform matrix. The default matrix is useful to draw lib entries with
@ -67,8 +69,6 @@ typedef enum {
*/
extern TRANSFORM DefaultTransform;
#define MAX_LAYERS (int) MAX_LAYER
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness);
int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness );
EDA_COLOR_T ReturnLayerColor( int aLayer );
EDA_COLOR_T GetLayerColor( LayerNumber aLayer );
// Color to draw selected items
EDA_COLOR_T GetItemSelectedColor();

View File

@ -117,8 +117,8 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
}
}
/* Ask for a component name or key words */
msg.Printf( _( "component selection (%d items loaded):" ), CmpCount );
// Ask for a component name or key words
msg.Printf( _( "Component selection (%d items loaded):" ), CmpCount );
DIALOG_GET_COMPONENT dlg( this, aHistoryList, msg, aUseLibBrowser );
@ -360,7 +360,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
if( unit > unitCount )
unit = unitCount;
int flags = component->GetFlags();
STATUS_FLAGS flags = component->GetFlags();
if( !flags ) // No command in progress: save in undo list
SaveCopyInUndoList( component, UR_CHANGED );
@ -405,7 +405,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
return;
}
int flags = DrawComponent->GetFlags();
STATUS_FLAGS flags = DrawComponent->GetFlags();
if( DrawComponent->GetFlags() )
DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );

View File

@ -101,7 +101,7 @@ class HIERARCHY_NAVIG_DLG : public wxDialog
{
public:
SCH_EDIT_FRAME* m_Parent;
HIERARCHY_TREE* m_Tree;
HIERARCHY_TREE* m_Tree;
int m_nbsheets;
wxDC* m_DC;

View File

@ -131,7 +131,7 @@ bool LIB_ARC::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
&m_Convert, &m_Width, tmp, &startx, &starty, &endx, &endy );
if( cnt < 8 )
{
aErrorMsg.Printf( _( "arc only had %d parameters of the required 8" ), cnt );
aErrorMsg.Printf( _( "Arc only had %d parameters of the required 8" ), cnt );
return false;
}
@ -370,12 +370,12 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Arc( pos, -t2, -t1, m_Radius, FILLED_SHAPE, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) );
aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
@ -416,7 +416,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
return;
wxPoint pos1, pos2, posc;
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
@ -452,8 +452,8 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
{
GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2,
m_Radius, GetPenSize( ),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
(m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ),
GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
}
else if( fill == FILLED_SHAPE && !aData )
{
@ -574,7 +574,7 @@ wxString LIB_ARC::GetSelectMenuText() const
}
void LIB_ARC::BeginEdit( int aEditMode, const wxPoint aPosition )
void LIB_ARC::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_ARC object." ) );

View File

@ -110,7 +110,7 @@ public:
int GetPenSize() const;
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint );

View File

@ -270,12 +270,12 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
@ -293,7 +293,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
wxPoint pos1;
std::vector<wxPoint> PolyPointsTraslated;
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE );
m_PolyPoints = Bezier2Poly( m_BezierPoints[0],
m_BezierPoints[1],
@ -326,8 +326,8 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
(m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ),
GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, GetPenSize(), color, color );

View File

@ -74,7 +74,7 @@ bool LIB_CIRCLE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
if( cnt < 6 )
{
aErrorMsg.Printf( _( "circle only had %d parameters of the required 6" ), cnt );
aErrorMsg.Printf( _( "Circle only had %d parameters of the required 6" ), cnt );
return false;
}
@ -194,12 +194,12 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Circle( pos, m_Radius * 2, FILLED_SHAPE, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) );
aPlotter->Circle( pos, m_Radius * 2, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
@ -216,7 +216,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
{
wxPoint pos1;
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
@ -237,8 +237,8 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
(m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ),
GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, 0, color, color );
else
@ -296,7 +296,7 @@ wxString LIB_CIRCLE::GetSelectMenuText() const
}
void LIB_CIRCLE::BeginEdit( int aEditMode, const wxPoint aPosition )
void LIB_CIRCLE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_CIRCLE object." ) );

View File

@ -71,7 +71,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint );

View File

@ -156,5 +156,5 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
EDA_COLOR_T LIB_ITEM::GetDefaultColor()
{
return ReturnLayerColor( LAYER_DEVICE );
return GetLayerColor( LAYER_DEVICE );
}

View File

@ -175,7 +175,7 @@ public:
* started. This may or may not be required depending on the item
* being edited and the edit mode.
*/
virtual void BeginEdit( int aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {}
virtual void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {}
/**
* Continue an edit in progress at \a aPosition.

View File

@ -149,19 +149,19 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
{
if( createLib )
{
msg = fn.GetFullPath() + _( " - OK" );
msg.Printf( _( "<%s> - OK" ), GetChars( fn.GetFullPath() ) );
DisplayInfoMessage( this, _( "This library will not be available \
until it is loaded by Eeschema.\n\nModify the Eeschema library configuration \
if you want to include it as part of this project." ) );
}
else
{
msg = fn.GetFullPath() + _( " - Export OK" );
msg.Printf( _( "<%s> - Export OK" ), GetChars( fn.GetFullPath() ) );
}
} // Error
else
{
msg = _( "Error creating " ) + fn.GetFullName();
msg.Printf( _( "Error creating <%s>" ), GetChars( fn.GetFullName() ) );
}
SetStatusText( msg );

View File

@ -523,15 +523,15 @@ EDA_COLOR_T LIB_FIELD::GetDefaultColor()
switch( m_id )
{
case REFERENCE:
color = ReturnLayerColor( LAYER_REFERENCEPART );
color = GetLayerColor( LAYER_REFERENCEPART );
break;
case VALUE:
color = ReturnLayerColor( LAYER_VALUEPART );
color = GetLayerColor( LAYER_VALUEPART );
break;
default:
color = ReturnLayerColor( LAYER_FIELDS );
color = GetLayerColor( LAYER_FIELDS );
break;
}
@ -659,7 +659,7 @@ wxString LIB_FIELD::GetSelectMenuText() const
}
void LIB_FIELD::BeginEdit( int aEditMode, const wxPoint aPosition )
void LIB_FIELD::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0,
wxT( "Invalid edit mode for LIB_FIELD object." ) );

View File

@ -207,7 +207,7 @@ public:
EDA_COLOR_T GetDefaultColor();
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint );

View File

@ -179,7 +179,7 @@ const wxChar* MsgPinElectricType[] =
wxT( "openCol" ),
wxT( "openEm" ),
wxT( "NotConnected" ),
wxT( "?????" )
wxT( "???" )
};
@ -262,9 +262,7 @@ void LIB_PIN::SetNumber( const wxString& number )
SetPinNumFromString( tmp );
if( m_number != oldNumber )
{
m_Flags |= IS_CHANGED;
}
SetFlags( IS_CHANGED );
/* Others pin numbers marked by EnableEditMode() are not modified
* because each pin has its own number
@ -437,7 +435,7 @@ void LIB_PIN::SetConversion( int style )
return;
m_Convert = style;
m_Flags |= IS_CHANGED;
SetFlags( IS_CHANGED );
if( style == 0 )
{
@ -514,9 +512,9 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
&& !IsNew()
&& editPinByPin == false
&& enable )
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;
pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
else
pinList[i]->m_Flags &= ~( IS_LINKED | IN_EDIT );
pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
}
}
@ -650,7 +648,7 @@ bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
if( aFormatter.Print( 0, "\n" ) < 0 )
return false;
m_Flags &= ~IS_CHANGED;
ClearFlags( IS_CHANGED );
return true;
}
@ -862,7 +860,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
EDA_COLOR_T color = ReturnLayerColor( LAYER_PIN );
EDA_COLOR_T color = GetLayerColor( LAYER_PIN );
if( aColor < 0 ) // Used normal color or selected color
{
@ -1092,9 +1090,9 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
Color = GetItemSelectedColor();
NameColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ?
ReturnLayerColor( LAYER_PINNAM ) : Color );
GetLayerColor( LAYER_PINNAM ) : Color );
NumColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ?
ReturnLayerColor( LAYER_PINNUM ) : Color );
GetLayerColor( LAYER_PINNUM ) : Color );
/* Create the pin num string */
ReturnPinStringNum( StringPinNum );
@ -1273,7 +1271,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
{
int MapX1, MapY1, x1, y1;
EDA_COLOR_T color = ReturnLayerColor( LAYER_PIN );
EDA_COLOR_T color = GetLayerColor( LAYER_PIN );
aPlotter->SetColor( color );
@ -1387,8 +1385,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
/* Get the num and name colors */
NameColor = ReturnLayerColor( LAYER_PINNAM );
NumColor = ReturnLayerColor( LAYER_PINNUM );
NameColor = GetLayerColor( LAYER_PINNAM );
NumColor = GetLayerColor( LAYER_PINNUM );
/* Create the pin num string */
ReturnPinStringNum( StringPinNum );
@ -1854,7 +1852,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), Text, DARKGREEN ) );
/* Display pin length */
// Display pin length
Text = ReturnStringFromValue( g_UserUnit, m_length, true );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), Text, MAGENTA ) );

View File

@ -36,7 +36,7 @@
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */
#if defined(KICAD_GOST)
#define INVERT_PIN_RADIUS 20 /* Radius of inverted pin circle. */
#define INVERT_PIN_RADIUS 30 /* Radius of inverted pin circle. */
#else
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */
#endif

Some files were not shown because too many files have changed in this diff Show More