3D-viewer: code cleanup.

Eeschema: annotate and netlist dialogs: enhancements.
Minor  coding policy fixes and  changes.
This commit is contained in:
jean-pierre charras 2012-08-21 12:45:54 +02:00
parent 898275fa43
commit 0ebc3f063e
26 changed files with 4230 additions and 852 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
@ -29,10 +29,6 @@
#include <fctsys.h>
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include <common.h>
#include <trigo.h>
#include <wxBasePcbFrame.h>
@ -49,7 +45,7 @@
#include <trackball.h>
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_Vertex >& aVertices )
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
{
unsigned ii;
@ -79,7 +75,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_Vertex >& aVertices )
}
void Set_Object_Data( std::vector< S3D_Vertex >& aVertices )
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices )
{
unsigned ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
@ -271,9 +267,9 @@ VERTEX_VALUE_CTRL::~VERTEX_VALUE_CTRL()
}
S3D_Vertex VERTEX_VALUE_CTRL::GetValue()
S3D_VERTEX VERTEX_VALUE_CTRL::GetValue()
{
S3D_Vertex value;
S3D_VERTEX value;
double dtmp;
m_XValueCtrl->GetValue().ToDouble( &dtmp );
@ -286,7 +282,7 @@ S3D_Vertex VERTEX_VALUE_CTRL::GetValue()
}
void VERTEX_VALUE_CTRL::SetValue( S3D_Vertex vertex )
void VERTEX_VALUE_CTRL::SetValue( S3D_VERTEX vertex )
{
wxString text;

View File

@ -1,6 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_class.cpp
/////////////////////////////////////////////////////////////////////////////
/**
* @file 3d_class.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
@ -55,7 +79,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
S3D_MASTER:: ~S3D_MASTER()
{
Struct3D_Shape* next;
STRUCT_3D_SHAPE* next;
S3D_MATERIAL* nextmat;
for( ; m_3D_Drawings != NULL; m_3D_Drawings = next )
@ -72,7 +96,7 @@ S3D_MASTER:: ~S3D_MASTER()
}
Struct3D_Shape::Struct3D_Shape( EDA_ITEM* aParent ) :
STRUCT_3D_SHAPE::STRUCT_3D_SHAPE( EDA_ITEM* aParent ) :
EDA_ITEM( aParent, NOT_USED )
{
m_3D_Coord = NULL;
@ -81,7 +105,7 @@ Struct3D_Shape::Struct3D_Shape( EDA_ITEM* aParent ) :
}
Struct3D_Shape:: ~Struct3D_Shape()
STRUCT_3D_SHAPE:: ~STRUCT_3D_SHAPE()
{
delete m_3D_Coord;
delete m_3D_CoordIndex;

File diff suppressed because it is too large Load Diff

View File

@ -431,7 +431,7 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
*/
void EDA_3D_FRAME::Set3DBgColor()
{
S3D_Color color;
S3D_COLOR color;
wxColour newcolor, oldcolor;
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 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.
*
@ -35,6 +35,8 @@
#include <3d_viewer.h>
// separator chars
static const char* sep_chars = " \t\n\r";
int S3D_MASTER::ReadData()
{
@ -85,13 +87,13 @@ int S3D_MASTER::ReadData()
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
text = strtok( line, sep_chars );
if( stricmp( text, "DEF" ) == 0 )
{
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
text = strtok( line, sep_chars );
if( text == NULL )
continue;
@ -119,8 +121,8 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
wxString mat_name;
S3D_MATERIAL* material = NULL;
command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" );
command = strtok( NULL, sep_chars );
text = strtok( NULL, sep_chars );
mat_name = FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 )
@ -134,7 +136,7 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
}
}
printf( "ReadMaterial error: material not found\n" );
D( printf( "ReadMaterial error: material not found\n" ) );
return 0;
}
@ -146,7 +148,7 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
text = strtok( line, sep_chars );
if( text == NULL )
continue;
@ -159,44 +161,44 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
if( stricmp( text, "diffuseColor" ) == 0 )
{
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.x = atof( text );
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.y = atof( text );
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_DiffuseColor.z = atof( text );
}
else if( stricmp( text, "emissiveColor" ) == 0 )
{
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.x = atof( text );
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.y = atof( text );
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_EmissiveColor.z = atof( text );
}
else if( strnicmp( text, "specularColor", 13 ) == 0 )
{
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.x = atof( text );
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.y = atof( text );
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_SpecularColor.z = atof( text );
}
else if( strnicmp( text, "ambientIntensity", 16 ) == 0 )
{
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_AmbientIntensity = atof( text );
}
else if( strnicmp( text, "transparency", 12 ) == 0 )
{
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_Transparency = atof( text );
}
else if( strnicmp( text, "shininess", 9 ) == 0 )
{
text = strtok( NULL, " \t\n\r" );
text = strtok( NULL, sep_chars );
material->m_Shininess = atof( text );
}
}
@ -212,7 +214,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
text = strtok( line, sep_chars );
if( *text == ']' )
return 0;
@ -226,7 +228,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
}
else
{
printf( "ReadChildren error line %d <%s> \n", *LineNum, text );
D( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) );
break;
}
}
@ -242,7 +244,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
text = strtok( line, sep_chars );
if( *text == '}' )
{
@ -260,7 +262,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
}
else
{
printf( "ReadShape error line %d <%s> \n", *LineNum, text );
D( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) );
break;
}
}
@ -276,7 +278,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
text = strtok( line, sep_chars );
if( *text == '}' )
{
@ -289,7 +291,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
}
else
{
printf( "ReadAppearance error line %d <%s> \n", *LineNum, text );
D( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) );
break;
}
}
@ -402,7 +404,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) )
{
strcpy( buffer, line );
text = strtok( buffer, " \t\n\r" );
text = strtok( buffer, sep_chars );
if( *text == '}' )
{
@ -507,7 +509,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
}
std::vector< int > coordIndex;
std::vector< S3D_Vertex > vertices;
std::vector< S3D_VERTEX > vertices;
while( GetLine( file, line, LineNum, 512 ) )
{
@ -535,7 +537,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
break;
}
S3D_Vertex vertex;
S3D_VERTEX vertex;
vertex.x = points[kk];
vertex.y = points[kk + 1];
vertex.z = points[kk + 2];
@ -572,7 +574,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
}
int Struct3D_Shape::ReadData( FILE* file, int* LineNum )
int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
{
char line[512];

View File

@ -41,32 +41,21 @@
class S3D_MASTER;
class Struct3D_Shape;
class STRUCT_3D_SHAPE;
class S3D_Color /* 3D color (R, G, G) 3 floats range 0 to 1.0*/
{
public:
double m_Red, m_Green, m_Blue;
public: S3D_Color()
{
m_Red = m_Green = m_Blue = 0;
}
};
/* S3D_Vertex manage a 3D coordinate (3 float numbers: x,y,z coordinates)*/
class S3D_Vertex
/* S3D_VERTEX manages a 3D coordinate (3 float numbers: x,y,z coordinates)*/
class S3D_VERTEX
{
public:
double x, y, z;
public:
S3D_Vertex()
S3D_VERTEX()
{
x = y = z = 0.0;
}
S3D_Vertex( double px, double py, double pz)
S3D_VERTEX( double px, double py, double pz)
{
x = px;
y = py;
@ -78,9 +67,9 @@ class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/
{
public:
wxString m_Name;
S3D_Vertex m_DiffuseColor;
S3D_Vertex m_EmissiveColor;
S3D_Vertex m_SpecularColor;
S3D_VERTEX m_DiffuseColor;
S3D_VERTEX m_EmissiveColor;
S3D_VERTEX m_SpecularColor;
float m_AmbientIntensity;
float m_Transparency;
float m_Shininess;
@ -104,10 +93,10 @@ class S3D_MASTER : public EDA_ITEM
{
public:
wxString m_Shape3DName; /* 3D shape name in 3D library */
S3D_Vertex m_MatScale;
S3D_Vertex m_MatRotation;
S3D_Vertex m_MatPosition;
Struct3D_Shape* m_3D_Drawings;
S3D_VERTEX m_MatScale;
S3D_VERTEX m_MatRotation;
S3D_VERTEX m_MatPosition;
STRUCT_3D_SHAPE* m_3D_Drawings;
S3D_MATERIAL* m_Materials;
public:
@ -146,7 +135,7 @@ public:
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 );
void Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
@ -155,19 +144,19 @@ public:
/* Describes a complex 3D */
class Struct3D_Shape : public EDA_ITEM
class STRUCT_3D_SHAPE : public EDA_ITEM
{
public:
S3D_Vertex* m_3D_Coord;
S3D_VERTEX* m_3D_Coord;
int* m_3D_CoordIndex;
int m_3D_Points;
public:
Struct3D_Shape( EDA_ITEM* aParent );
~Struct3D_Shape();
STRUCT_3D_SHAPE( EDA_ITEM* aParent );
~STRUCT_3D_SHAPE();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
Struct3D_Shape* Back() const { return (Struct3D_Shape*) Pback; }
STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }
int ReadData( FILE* file, int* LineNum );
@ -197,8 +186,8 @@ public:
* Function GetValue
* @return the vertex in internal units.
*/
S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex );
S3D_VERTEX GetValue();
void SetValue( S3D_VERTEX vertex );
void Enable( bool enbl );
void SetToolTip( const wxString& text );
};

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
@ -63,10 +63,8 @@ class ZONE_CONTAINER;
#define LIB3D_PATH wxT( "packages3d" )
class EDA_3D_CANVAS;
class EDA_3D_FRAME;
class S3D_Vertex;
class S3D_VERTEX;
class SEGVIA;
@ -126,11 +124,37 @@ public:
void DrawGrid( double aGriSizeMM );
void Draw3D_Track( TRACK* track );
/**
* Function Draw3D_Track
* @param aTrack = the aTrack to draw
*/
void Draw3D_Track( TRACK* aTrack );
/**
* Function Draw3D_Via
* draws 3D via as a cylinder and filled circles.
*/
void Draw3D_Via( SEGVIA* via );
/**
* Function Draw3D_DrawSegment
* draws a 3D segment (line, arc or circle).
*/
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
/**
* Function Draw3D_Zone
* draw all solid areas in aZone
* @param aZone = the zone to draw
*/
void Draw3D_Zone( ZONE_CONTAINER* aZone );
/**
* Function Draw3D_SolidPolygonsInZones
* draw all solid polygons used as filled areas in a zone
* Function used by Draw3D_Zone
* Note: polygons are drawn, but not the thick polygon outlines
* Use Draw3D_Zone to draw aZone
* @param aZone = the zone to draw
*/
void Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone );
@ -143,13 +167,6 @@ public:
*/
void Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double aZpos );
/**
* Function Draw3D_Via
* draws 3D via as a cylinder and filled circles.
*/
void Draw3D_Via( SEGVIA* via );
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
/**
* Function Draw3D_DrawText
* draws 3D segments to create text objects.
@ -242,6 +259,6 @@ private:
};
void SetGLColor( int color );
void Set_Object_Data( std::vector< S3D_Vertex >& aVertices );
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices );
#endif /* __3D_VIEWER_H__ */

View File

@ -30,7 +30,7 @@
#ifndef __INFO3D_VISU_H__
#define __INFO3D_VISU_H__
#include <wxBasePcbFrame.h> // m_auimanager member.
#include <wxBasePcbFrame.h> // m_auimanager member.
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#if !wxUSE_GLCANVAS
@ -51,44 +51,52 @@
#include <3d_struct.h>
#define m_ROTX m_Rot[0]
#define m_ROTY m_Rot[1]
#define m_ROTZ m_Rot[2]
#define m_ROTX m_Rot[0]
#define m_ROTY m_Rot[1]
#define m_ROTZ m_Rot[2]
class S3D_COLOR /* 3D color (R, G, B) 3 floats range 0 to 1.0*/
{
public:
double m_Red, m_Green, m_Blue;
public: S3D_COLOR()
{
m_Red = m_Green = m_Blue = 0;
}
};
/* information needed to display 3D board */
class INFO3D_VISU
{
public:
enum DISPLAY3D_FLG
{
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_COMMENTS, FL_DRAWINGS, FL_ECO1, FL_ECO2,
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_COMMENTS, FL_DRAWINGS, FL_ECO1, FL_ECO2,
FL_GRID,
FL_LAST
};
double m_Beginx, m_Beginy; // position of mouse
double m_Quat[4]; // orientation of object
double m_Rot[4]; // man rotation of object
double m_Zoom; // field of view in degrees
double m_3D_Grid; // 3D grid valmue, in mm
S3D_Color m_BgColor;
bool m_DrawFlags[FL_LAST]; // show these special items
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_CopperLayersCount; // Number of copper layers actually used by the board
double m_Beginx, m_Beginy; // position of mouse
double m_Quat[4]; // orientation of object
double m_Rot[4]; // man rotation of object
double m_Zoom; // field of view in degrees
double m_3D_Grid; // 3D grid valmue, in mm
S3D_COLOR m_BgColor;
bool m_DrawFlags[FL_LAST]; // show these special items
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_CopperLayersCount; // Number of copper layers actually used by the board
const BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design settings
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized)
double m_ActZpos;
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized)
double m_ActZpos;
public: INFO3D_VISU();
~INFO3D_VISU();
};
@ -96,4 +104,4 @@ public: INFO3D_VISU();
extern INFO3D_VISU g_Parm_3D_Visu;
extern double DataScale3D; // 3D scale units.
#endif /* __INFO3D_VISU_H__ */
#endif /* __INFO3D_VISU_H__ */

View File

@ -10,25 +10,7 @@ include_directories(
${INC_AFTER}
)
set(EESCHEMA_SRCS
annotate.cpp
backanno.cpp
block.cpp
block_libedit.cpp
build_BOM.cpp
busentry.cpp
bus-wire-junction.cpp
class_drc_erc_item.cpp
class_libentry.cpp
class_library.cpp
class_netlist_object.cpp
cmp_library_keywords.cpp
cmp_library_lexer.cpp
component_references_lister.cpp
controle.cpp
cross-probing.cpp
dangling_ends.cpp
database.cpp
set(EESCHEMA_DLGS
dialogs/dialog_color_config.cpp
dialogs/dialog_plot_schematic_DXF.cpp
dialogs/dialog_plot_schematic_DXF_base.cpp
@ -67,6 +49,7 @@ set(EESCHEMA_SRCS
dialogs/dialog_lib_edit_pin_base.cpp
dialogs/dialog_lib_new_component.cpp
dialogs/dialog_lib_new_component_base.cpp
dialogs/dialog_netlist_base.cpp
dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_print_using_printer.cpp
dialogs/dialog_sch_edit_sheet_pin.cpp
@ -77,6 +60,28 @@ set(EESCHEMA_SRCS
dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.cpp
)
set(EESCHEMA_SRCS
annotate.cpp
backanno.cpp
block.cpp
block_libedit.cpp
build_BOM.cpp
busentry.cpp
bus-wire-junction.cpp
class_drc_erc_item.cpp
class_libentry.cpp
class_library.cpp
class_netlist_object.cpp
cmp_library_keywords.cpp
cmp_library_lexer.cpp
component_references_lister.cpp
controle.cpp
cross-probing.cpp
dangling_ends.cpp
database.cpp
${EESCHEMA_DLGS}
edit_component_in_schematic.cpp
edit_bitmap.cpp
edit_label.cpp

View File

@ -204,6 +204,10 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false;
// Cursor is left off grid only if no block in progress
if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
snapToGrid = true;
if( snapToGrid )
pos = screen->GetNearestGridPosition( pos );
@ -298,6 +302,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false;
// Cursor is left off grid only if no block in progress
if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
snapToGrid = true;
if( snapToGrid )
pos = screen->GetNearestGridPosition( pos );

View File

@ -6,8 +6,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2012 jean-pierre Charras <jean-pierre.charras@ujf-grenoble.fr>
* Copyright (C) 1992-2012 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
@ -37,6 +37,8 @@
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
#define KEY_ANNOTATE_ALGO_OPTION wxT("AnnotateAlgoOption")
#define KEY_ANNOTATE_AUTOCLOSE_OPTION wxT("AnnotateAutoCloseOption")
#define KEY_ANNOTATE_USE_SILENTMODE wxT("AnnotateSilentMode")
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
@ -92,6 +94,14 @@ void DIALOG_ANNOTATE::InitValues()
m_rbStartSheetNumLarge->SetValue(1);
break;
}
m_Config->Read(KEY_ANNOTATE_AUTOCLOSE_OPTION, &option, 0l);
if( option )
m_cbAutoCloseDlg->SetValue(1);
m_Config->Read(KEY_ANNOTATE_USE_SILENTMODE, &option, 0l);
if( option )
m_cbUseSilentMode->SetValue(1);
}
annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) );
@ -112,10 +122,19 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
{
m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder());
m_Config->Write(KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo());
m_Config->Write(KEY_ANNOTATE_AUTOCLOSE_OPTION, GetAnnotateAutoCloseOpt());
m_Config->Write(KEY_ANNOTATE_USE_SILENTMODE, GetAnnotateSilentMode());
}
// Display a message info in verbose mode,
// or if a reset of the previous annotation is asked.
bool promptUser = ! GetAnnotateSilentMode();
if( GetResetItems() )
{
message = _( "Clear and annotate all of the components " );
promptUser = true;
}
else
message = _( "Annotate only the unannotated components " );
@ -125,10 +144,14 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
message += _( "on the current sheet?" );
message += _( "\n\nThis operation will change the current annotation and cannot be undone." );
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL)
return;
if( promptUser )
{
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL)
return;
}
m_Parent->AnnotateComponents( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(),
(ANNOTATE_OPTION_T) GetAnnotateAlgo(),
@ -136,6 +159,17 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
m_Parent->GetCanvas()->Refresh();
m_btnClear->Enable();
if( GetAnnotateAutoCloseOpt() )
{
if( IsModal() )
EndModal( wxID_OK );
else
{
SetReturnCode( wxID_OK );
this->Show( false );
}
}
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2009 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2012 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
@ -45,6 +45,7 @@ public:
DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent );
~DIALOG_ANNOTATE(){};
private:
/// Initialises member variables
void InitValues();
void OnCancelClick( wxCommandEvent& event );
@ -56,6 +57,14 @@ public:
bool GetResetItems( void );
int GetSortOrder( void );
int GetAnnotateAlgo( void );
bool GetAnnotateAutoCloseOpt()
{
return m_cbAutoCloseDlg->GetValue();
}
bool GetAnnotateSilentMode()
{
return m_cbUseSilentMode->GetValue();
}
};
#endif

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
@ -43,6 +43,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
m_rbResetAnnotation = new wxRadioButton( this, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 );
bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 3 );
bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT|wxALIGN_RIGHT, 25 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
@ -69,6 +70,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
annotate_down_right_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerXpos->Add( annotate_down_right_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 12 );
b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerYpos;
@ -83,8 +85,10 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
annotate_right_down_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerYpos->Add( annotate_right_down_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 );
bupperSizer->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 25 );
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
@ -111,6 +115,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bSizerChoiceInc->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceInc, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerChoiceIncBySheet;
@ -122,6 +127,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bSizerChoiceIncBySheet->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceIncBySheet, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerChoiceIncBySheetLarge;
@ -133,15 +139,63 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bSizerChoiceIncBySheetLarge->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceIncBySheetLarge, 1, wxEXPAND, 5 );
bSizerAnnotAlgo->Add( bSizer1AlgoChoice, 1, wxEXPAND|wxLEFT, 25 );
bupperSizer->Add( bSizerAnnotAlgo, 0, wxEXPAND|wxRIGHT, 5 );
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bupperSizer->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerDldOptions;
bSizerDldOptions = new wxBoxSizer( wxVERTICAL );
m_staticTextDlgOpts = new wxStaticText( this, wxID_ANY, _("Dialog"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDlgOpts->Wrap( -1 );
m_staticTextDlgOpts->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizerDldOptions->Add( m_staticTextDlgOpts, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerDlgChoices;
bSizerDlgChoices = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerChoiceClose;
bSizerChoiceClose = new wxBoxSizer( wxHORIZONTAL );
m_cbAutoCloseDlg = new wxCheckBox( this, wxID_ANY, _("Automatically close this dialog"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerChoiceClose->Add( m_cbAutoCloseDlg, 0, wxALL, 5 );
bSizerChoiceClose->Add( 0, 0, 1, wxEXPAND, 5 );
bSizerDlgChoices->Add( bSizerChoiceClose, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerChoiceSilentMode;
bSizerChoiceSilentMode = new wxBoxSizer( wxHORIZONTAL );
m_cbUseSilentMode = new wxCheckBox( this, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerChoiceSilentMode->Add( m_cbUseSilentMode, 0, wxALL, 5 );
bSizerChoiceSilentMode->Add( 0, 0, 1, wxEXPAND, 5 );
bSizerDlgChoices->Add( bSizerChoiceSilentMode, 1, wxEXPAND, 5 );
bSizerDldOptions->Add( bSizerDlgChoices, 1, wxEXPAND|wxLEFT, 25 );
m_staticline41 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerDldOptions->Add( m_staticline41, 0, wxEXPAND | wxALL, 5 );
bupperSizer->Add( bSizerDldOptions, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
@ -154,10 +208,13 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
m_btnApply = new wxButton( this, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 6 );
bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 );
this->SetSizer( bmainSizer );
this->Layout();

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,17 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_annotate_base__
#define __dialog_annotate_base__
#ifndef __DIALOG_ANNOTATE_BASE_H__
#define __DIALOG_ANNOTATE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
@ -23,6 +25,7 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -39,7 +42,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ANNOTATE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_ANNOTATE_BASE : public wxDialog
class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM
{
private:
@ -53,20 +56,19 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
wxStaticLine* m_staticline2;
wxStaticText* m_staticTextOrder;
wxRadioButton* m_rbSortBy_X_Position;
wxStaticBitmap* annotate_down_right_bitmap;
wxRadioButton* m_rbSortBy_Y_Position;
wxStaticBitmap* annotate_right_down_bitmap;
wxStaticLine* m_staticline5;
wxStaticText* m_staticTextAnnotateAlgo;
wxRadioButton* m_rbUseIncremental;
wxRadioButton* m_rbUseSheetNum;
wxRadioButton* m_rbStartSheetNumLarge;
wxStaticLine* m_staticline4;
wxStaticText* m_staticTextDlgOpts;
wxCheckBox* m_cbAutoCloseDlg;
wxCheckBox* m_cbUseSilentMode;
wxStaticLine* m_staticline41;
wxButton* m_btnClose;
wxButton* m_btnClear;
wxButton* m_btnApply;
@ -79,9 +81,9 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
public:
DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,382 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,454 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_ANNOTATE_BASE();
};
#endif //__dialog_annotate_base__
#endif //__DIALOG_ANNOTATE_BASE_H__

View File

@ -0,0 +1,148 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_netlist_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( NETLIST_DIALOG_BASE, DIALOG_SHIM )
EVT_NOTEBOOK_PAGE_CHANGED( ID_CHANGE_NOTEBOOK_PAGE, NETLIST_DIALOG_BASE::_wxFB_OnNetlistTypeSelection )
EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG_BASE::_wxFB_GenNetlist )
EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( ID_ADD_PLUGIN, NETLIST_DIALOG_BASE::_wxFB_OnAddPlugin )
EVT_BUTTON( ID_DEL_PLUGIN, NETLIST_DIALOG_BASE::_wxFB_OnDelPlugin )
END_EVENT_TABLE()
NETLIST_DIALOG_BASE::NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_NoteBook = new wxNotebook( this, ID_CHANGE_NOTEBOOK_PAGE, wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_NoteBook, 1, wxEXPAND | wxALL, 5 );
bUpperSizer->Add( bRightSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
bLeftSizer->Add( 0, 0, 0, wxTOP, 15 );
m_buttonNetlist = new wxButton( this, ID_CREATE_NETLIST, _("Netlist"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_buttonNetlist, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonAddPlugin = new wxButton( this, ID_ADD_PLUGIN, _("Add Plugin"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_buttonAddPlugin, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonDelPlugin = new wxButton( this, ID_DEL_PLUGIN, _("Remove Plugin"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_buttonDelPlugin, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bLeftSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_cbUseDefaultNetlistName = new wxCheckBox( this, wxID_ANY, _("Use default netname"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_cbUseDefaultNetlistName, 0, wxALL, 5 );
bUpperSizer->Add( bLeftSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_staticTextDefaultFN = new wxStaticText( this, wxID_ANY, _("Default Netlist Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDefaultFN->Wrap( -1 );
bMainSizer->Add( m_staticTextDefaultFN, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlDefaultFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bMainSizer->Add( m_textCtrlDefaultFileName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
this->Centre( wxBOTH );
}
NETLIST_DIALOG_BASE::~NETLIST_DIALOG_BASE()
{
}
BEGIN_EVENT_TABLE( NETLIST_DIALOG_ADD_PLUGIN_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_OK, NETLIST_DIALOG_ADD_PLUGIN_BASE::_wxFB_OnOKClick )
EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG_ADD_PLUGIN_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_BROWSE_PLUGINS, NETLIST_DIALOG_ADD_PLUGIN_BASE::_wxFB_OnBrowsePlugins )
END_EVENT_TABLE()
NETLIST_DIALOG_ADD_PLUGIN_BASE::NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Netlist command:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCmd->Wrap( -1 );
bSizerLeft->Add( m_staticTextCmd, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlCommand = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlCommand->SetMinSize( wxSize( 300,-1 ) );
bSizerLeft->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextName->Wrap( -1 );
bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLeft->Add( m_textCtrlName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMain->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
bSizerRight->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
m_buttonPlugin = new wxButton( this, wxID_BROWSE_PLUGINS, _("Browse Plugins"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonPlugin, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerRight, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
}
NETLIST_DIALOG_ADD_PLUGIN_BASE::~NETLIST_DIALOG_ADD_PLUGIN_BASE()
{
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,122 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_NETLIST_BASE_H__
#define __DIALOG_NETLIST_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/gdicmn.h>
#include <wx/notebook.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class NETLIST_DIALOG_BASE
///////////////////////////////////////////////////////////////////////////////
class NETLIST_DIALOG_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnNetlistTypeSelection( wxNotebookEvent& event ){ OnNetlistTypeSelection( event ); }
void _wxFB_GenNetlist( wxCommandEvent& event ){ GenNetlist( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnAddPlugin( wxCommandEvent& event ){ OnAddPlugin( event ); }
void _wxFB_OnDelPlugin( wxCommandEvent& event ){ OnDelPlugin( event ); }
protected:
enum
{
ID_CHANGE_NOTEBOOK_PAGE = 1000,
ID_CREATE_NETLIST,
ID_ADD_PLUGIN,
ID_DEL_PLUGIN
};
wxNotebook* m_NoteBook;
wxButton* m_buttonNetlist;
wxButton* m_buttonCancel;
wxButton* m_buttonAddPlugin;
wxButton* m_buttonDelPlugin;
wxStaticLine* m_staticline1;
wxCheckBox* m_cbUseDefaultNetlistName;
wxStaticText* m_staticTextDefaultFN;
wxTextCtrl* m_textCtrlDefaultFileName;
// Virtual event handlers, overide them in your derived class
virtual void OnNetlistTypeSelection( wxNotebookEvent& event ) { event.Skip(); }
virtual void GenNetlist( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddPlugin( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDelPlugin( wxCommandEvent& event ) { event.Skip(); }
public:
NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 404,334 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~NETLIST_DIALOG_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class NETLIST_DIALOG_ADD_PLUGIN_BASE
///////////////////////////////////////////////////////////////////////////////
class NETLIST_DIALOG_ADD_PLUGIN_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnOKClick( wxCommandEvent& event ){ OnOKClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnBrowsePlugins( wxCommandEvent& event ){ OnBrowsePlugins( event ); }
protected:
enum
{
wxID_BROWSE_PLUGINS = 1000
};
wxStaticText* m_staticTextCmd;
wxTextCtrl* m_textCtrlCommand;
wxStaticText* m_staticTextName;
wxTextCtrl* m_textCtrlName;
wxButton* m_buttonOK;
wxButton* m_buttonCancel;
wxButton* m_buttonPlugin;
// Virtual event handlers, overide them in your derived class
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowsePlugins( wxCommandEvent& event ) { event.Skip(); }
public:
NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugins:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 312,144 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~NETLIST_DIALOG_ADD_PLUGIN_BASE();
};
#endif //__DIALOG_NETLIST_BASE_H__

View File

@ -248,7 +248,9 @@ enum id_eeschema_frm
ID_LIBVIEW_LIBWINDOW,
ID_LIBVIEW_CMPWINDOW,
ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
ID_SET_RELATIVE_OFFSET
ID_SET_RELATIVE_OFFSET,
ID_END_EESCHEMA_ID_LIST
};

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 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.
* Copyright (C) 1992-2012 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
@ -54,6 +54,15 @@
#include <wildcards_and_files_ext.h>
#include <wildcards_and_files_ext.h>
#include <eeschema_id.h>
/* Event id for notebook page buttons: */
enum id_netlist {
ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_RUN_SIMULATOR,
ID_ADD_SUBCIRCUIT_PREFIX
};
//Imported function:
int TestDuplicateSheetNames( bool aCreateMarker );
@ -61,44 +70,14 @@ int TestDuplicateSheetNames( bool aCreateMarker );
// ID for configuration:
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
#define NETLIST_USE_DEFAULT_NETNAME wxT( "NetlistUseDefaultNetname" )
/**
* Function ReturnUserNetlistTypeName
* to retrieve user netlist type names
* @param first_item = true: return first name of the list, false = return next
* @return a wxString : name of the type netlist or empty string
* this function must be called first with "first_item" = true
* and after with "first_item" = false to get all the other existing netlist names
*/
wxString ReturnUserNetlistTypeName( bool first_item )
{
static int index;
wxString name, msg;
if( first_item )
index = 0;
else
index++;
msg = CUSTOM_NETLIST_TITLE;
msg << index + 1;
if( wxGetApp().GetSettings() )
name = wxGetApp().GetSettings()->Read( msg );
return name;
}
BEGIN_EVENT_TABLE( NETLIST_DIALOG, wxDialog )
EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG::OnCancelClick )
BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG::GenNetlist )
EVT_BUTTON( ID_SETUP_PLUGIN, NETLIST_DIALOG::AddNewPluginPanel )
EVT_BUTTON( ID_DELETE_PLUGIN, NETLIST_DIALOG::DeletePluginPanel )
EVT_BUTTON( ID_VALIDATE_PLUGIN, NETLIST_DIALOG::ValidatePluginPanel )
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
NETLIST_DIALOG::SelectNetlistType )
NETLIST_DIALOG::SelectDefaultNetlistType )
EVT_CHECKBOX( ID_ADD_SUBCIRCUIT_PREFIX,
NETLIST_DIALOG::EnableSubcircuitPrefix )
EVT_BUTTON( ID_RUN_SIMULATOR, NETLIST_DIALOG::RunSimulator )
@ -115,9 +94,7 @@ END_EVENT_TABLE()
*/
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
const wxString& title,
int id_NetType,
int idCheckBox,
int idCreateFile ) :
NETLIST_TYPE_ID id_NetType ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN )
{
m_IdNetType = id_NetType;
@ -162,15 +139,13 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
if( idCheckBox )
{
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
m_IsCurrentFormat = new wxCheckBox( this, idCheckBox, _( "Default format" ) );
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
m_IsCurrentFormat->SetValue( selected );
}
m_IsCurrentFormat = new wxCheckBox( this, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
m_IsCurrentFormat->SetValue( selected );
if( id_NetType == NET_TYPE_PCBNEW )
{
@ -182,39 +157,6 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_NetOption->SetSelection( fmtOption );
m_LeftBoxSizer->Add( m_NetOption, 0, wxGROW | wxALL, 5 );
}
/* Create the buttons: Create Netlist or browse Plugin and Cancel
* and a third button for plugins : Remove or Ok button */
if( idCreateFile )
{
wxButton* Button;
if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel */
Button = new wxButton( this, idCreateFile, _( "&Browse Plugin" ) );
else
Button = new wxButton( this, idCreateFile, _( "&Netlist" ) );
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button->SetDefault();
m_ButtonCancel = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
m_RightBoxSizer->Add( m_ButtonCancel, 0, wxGROW | wxALL, 5 );
/* Add special buttons to plugin panels:
* for panel plugins: added the "delete" button
* for the last panel (add plugin) a Ok button is added
*/
if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel: add Ok button */
{
Button = new wxButton( this, ID_VALIDATE_PLUGIN, _( "&Ok" ) );
m_RightOptionsBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
}
else if( id_NetType >= PANELCUSTOMBASE ) /* This is a plugin panel: add delete button */
{
Button = new wxButton( this, ID_DELETE_PLUGIN, _( "&Delete" ) );
m_RightOptionsBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
}
}
}
const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
@ -232,53 +174,39 @@ const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
NETLIST_DIALOG_BASE( parent )
{
int ii;
m_Parent = parent;
m_Config = wxGetApp().GetSettings();
long tmp;
m_Config->Read( NETLIST_USE_DEFAULT_NETNAME, &tmp, 0l );
m_cbUseDefaultNetlistName->SetValue( tmp );
m_NetFmtName = m_Parent->GetNetListFormatName();
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
for( int ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
{
m_PanelNetType[ii] = NULL;
}
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( GeneralBoxSizer );
m_NoteBook = new wxNotebook( this, ID_NETLIST_NOTEBOOK,
wxDefaultPosition, wxDefaultSize,
wxNB_TOP ); // @todo: tabs on top are being hidden on linux
GeneralBoxSizer->Add( m_NoteBook, 0, wxGROW | wxALL, 5 );
// Add notebook pages:
// Add Panel FORMAT PCBNEW
m_PanelNetType[PANELPCBNEW] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "Pcbnew" ),
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Pcbnew" ),
NET_TYPE_PCBNEW );
// Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2 );
// Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "CadStar" ),
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
NET_TYPE_CADSTAR );
// Add Panel spice
InstallPageSpice();
@ -286,13 +214,38 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
// Add custom panels:
InstallCustomPages();
// GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Centre();
}
/**
* Function ReturnUserNetlistTypeName
* to retrieve user netlist type names
* @param first_item = true: return first name of the list, false = return next
* @return a wxString : name of the type netlist or empty string
* this function must be called first with "first_item" = true
* and after with "first_item" = false to get all the other existing netlist names
*/
const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
{
static int index;
wxString name, msg;
if( first_item )
index = 0;
else
index++;
msg = CUSTOM_NETLIST_TITLE;
msg << index + 1;
name = m_Config->Read( msg );
return name;
}
void NETLIST_DIALOG::InstallPageSpice()
{
wxButton* Button;
@ -300,15 +253,8 @@ void NETLIST_DIALOG::InstallPageSpice()
wxString title = wxT( "Spice" );
page = m_PanelNetType[PANELSPICE] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
title,
NET_TYPE_SPICE,
0, 0 );
new NETLIST_PAGE_DIALOG( m_NoteBook, title, NET_TYPE_SPICE );
page->m_IsCurrentFormat = new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
page->m_IsCurrentFormat->SetValue( m_NetFmtName == title );
page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 1, wxGROW | wxALL, 5 );
page->m_AddSubPrefix = new wxCheckBox( page, ID_ADD_SUBCIRCUIT_PREFIX,
_( "Prefix references 'U' and 'IC' with 'X'" ) );
@ -340,15 +286,8 @@ void NETLIST_DIALOG::InstallPageSpice()
5 );
// Add buttons
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button->SetDefault();
Button = new wxButton( page, ID_RUN_SIMULATOR, _( "&Run Simulator" ) );
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( page, wxID_CANCEL, _( "&Cancel" ) );
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
}
@ -356,147 +295,109 @@ void NETLIST_DIALOG::InstallPageSpice()
*/
void NETLIST_DIALOG::InstallCustomPages()
{
int ii, CustomCount;
wxString title, previoustitle, msg;
NETLIST_PAGE_DIALOG* CurrPage;
int ii;
wxString title, msg;
NETLIST_PAGE_DIALOG* currPage;
CustomCount = CUSTOMPANEL_COUNTMAX;
previoustitle = wxT( "dummy_title" );
for( ii = 0; ii < CustomCount; ii++ )
for( ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
{
title = ReturnUserNetlistTypeName( ii == 0 ? true : false );
if( title.IsEmpty() && previoustitle.IsEmpty() )
if( title.IsEmpty() )
break; // No more panel to install
/* Install the panel "Add Plugin" after
* the last initialized panel */
previoustitle = title;
if( title.IsEmpty() )
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
_( "Add Plugin" ),
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_SETUP_PLUGIN );
else /* Install a plugin panel */
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
title,
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
// Install a plugin panel
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
wxString Command = wxGetApp().GetSettings()->Read( msg );
wxString command = m_Config->Read( msg );
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Netlist command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
CurrPage->m_CommandStringCtrl = new wxTextCtrl( CurrPage, -1, Command,
wxDefaultPosition, wxDefaultSize );
CurrPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
CurrPage->m_LowBoxSizer->Add( CurrPage->m_CommandStringCtrl,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Title:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
CurrPage->m_TitleStringCtrl = new wxTextCtrl( CurrPage, -1, title,
wxDefaultPosition, wxDefaultSize );
CurrPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
CurrPage->m_LowBoxSizer->Add( CurrPage->m_TitleStringCtrl,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
currPage = AddOneCustomPage( title, command,
(NETLIST_TYPE_ID)(NET_TYPE_CUSTOM1 + ii) );
m_PanelNetType[PANELCUSTOMBASE + ii] = currPage;
}
}
/*
* Browse plugin files, add a new panel
* and set m_CommandStringCtrl field
*/
void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
const wxString & aCommandString,
NETLIST_TYPE_ID aNetTypeId )
{
wxString FullFileName, Mask, Path;
NETLIST_PAGE_DIALOG* currPage;
Mask = wxT( "*" );
Path = wxGetApp().GetExecutablePath();
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path,
FullFileName,
wxEmptyString,
Mask,
this,
wxFD_OPEN,
true
);
if( FullFileName.IsEmpty() )
return;
currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL )
return;
currPage->m_LowBoxSizer->Add( new wxStaticText( currPage,
-1, _( "Netlist command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
// Creates a default command line, suitable for external tool xslproc:
// try to build a default command line depending on plugin extension
wxString cmdLine;
wxFileName fn( FullFileName );
wxString ext = fn.GetExt();
currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
wxDefaultPosition, wxDefaultSize );
if( ext == wxT("xsl" ) )
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
else if( ext == wxT("exe" ) || ext.IsEmpty() )
cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
else
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
CurrPage->m_CommandStringCtrl->SetValue( cmdLine );
currPage->m_LowBoxSizer->Add( new wxStaticText( currPage,
-1, _( "Title:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
/* Get a title for this page */
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
wxDefaultPosition, wxDefaultSize );
if( title.IsEmpty() )
DisplayInfoMessage( this,
_( "Do not forget to choose a title for this netlist control page" ) );
currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
return currPage;
}
/* Called when the check box "default format" is clicked
*/
void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
{
int ii;
NETLIST_PAGE_DIALOG* CurrPage;
NETLIST_PAGE_DIALOG* currPage;
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
if( m_PanelNetType[ii] )
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( false );
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL )
if( currPage == NULL )
return;
m_Parent->SetNetListFormatName( CurrPage->GetPageNetFmtName() );
CurrPage->m_IsCurrentFormat->SetValue( true );
m_Parent->SetNetListFormatName( currPage->GetPageNetFmtName() );
currPage->m_IsCurrentFormat->SetValue( true );
}
/* Called when a netlist type is selected.
* Enable/disable relevant/irrelevant widgets, and display the default
* netlist name, for known types
*/
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
{
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( currPage == NULL )
return;
m_buttonDelPlugin->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
m_cbUseDefaultNetlistName->Enable( currPage->m_IdNetType < NET_TYPE_CUSTOM1 );
wxString fileExt;
if( ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, NULL ) )
{
wxFileName fn = g_RootSheet->GetScreen()->GetFileName();
fn.SetExt( fileExt );
m_textCtrlDefaultFileName->SetValue( fn.GetFullName() );
}
else
m_textCtrlDefaultFileName->Clear();
}
/* Called when the check box m_AddSubPrefix
* "default format" is clicked
@ -505,14 +406,14 @@ void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
{
NETLIST_PAGE_DIALOG* CurrPage;
NETLIST_PAGE_DIALOG* currPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL || CurrPage->m_AddSubPrefix == NULL )
if( currPage == NULL || currPage->m_AddSubPrefix == NULL )
return;
m_Parent->SetAddReferencePrefix( CurrPage->m_AddSubPrefix->IsChecked() );
m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
}
void NETLIST_DIALOG::NetlistUpdateOpt()
@ -553,24 +454,92 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
NetlistUpdateOpt();
NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
NETLIST_PAGE_DIALOG* currPage;
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
unsigned netlist_opt = 0;
/* Calculate the netlist filename */
fn = g_RootSheet->GetScreen()->GetFileName();
ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
switch( CurrPage->m_IdNetType )
// Set some parameters
switch( currPage->m_IdNetType )
{
case NET_TYPE_SPICE:
// Set spice netlist options:
if( g_OptNetListUseNames )
netlist_opt |= NET_USE_NETNAMES;
if( currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX;
break;
case NET_TYPE_CADSTAR:
break;
case NET_TYPE_PCBNEW:
if( currPage->m_NetOption->GetSelection() != 0 )
netlist_opt = NET_PCBNEW_USE_NEW_FORMAT;
break;
case NET_TYPE_ORCADPCB2:
break;
default: // custom, NET_TYPE_CUSTOM1 and greater
title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() );
}
fn.SetExt( fileExt );
wxString fullfilname = fn.GetFullName();
if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
{
wxFileDialog dlg( this, title, fn.GetPath(),
fullfilname, fileWildcard,
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fullfilname = dlg.GetPath();
}
m_Parent->ClearMsgPanel();
if( currPage->m_CommandStringCtrl )
m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
else
m_Parent->SetNetListerCommand( wxEmptyString );
m_Parent->CreateNetlist( currPage->m_IdNetType, fullfilname, netlist_opt );
WriteCurrentNetlistSetup();
EndModal( wxID_OK );
}
/**
* Function ReturnFilenamePrms
* returns the filename extension and the wildcard string for this curr
* or a void name if there is no default name
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
* @param aExt = a reference to a wxString to return the defaut file ext.
* @param aWildCard = reference to a wxString to return the defaut wildcard.
* @return true for known netlist type, false for custom formats
*/
bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
wxString * aExt, wxString * aWildCard )
{
wxString fileExt;
wxString fileWildcard;
bool ret = true;
switch( aNetTypeId )
{
case NET_TYPE_SPICE:
fileExt = wxT( "cir" );
fileWildcard = _( "SPICE netlist file (.cir)|*.cir" );
// Set spice netlist options:
if( g_OptNetListUseNames )
netlist_opt |= NET_USE_NETNAMES;
if( CurrPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX;
break;
case NET_TYPE_CADSTAR:
@ -579,47 +548,25 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
break;
case NET_TYPE_PCBNEW:
if( CurrPage->m_NetOption->GetSelection() != 0 )
netlist_opt = NET_PCBNEW_USE_NEW_FORMAT;
fileExt = NetlistFileExtension;
fileWildcard = NetlistFileWildcard;
break;
case NET_TYPE_ORCADPCB2:
fileExt = NetlistFileExtension;
fileWildcard = NetlistFileWildcard;
break;
default: // custom, NET_TYPE_CUSTOM1 and greater
fileExt = wxEmptyString;
fileWildcard = AllFilesWildcard;
title.Printf( _( "%s Export" ), CurrPage->m_TitleStringCtrl->GetValue().GetData() );
ret = false;
}
fn.SetExt( fileExt );
if( aExt )
*aExt = fileExt;
wxFileDialog dlg( this, title, fn.GetPath(),
fn.GetFullName(), fileWildcard,
wxFD_SAVE );
if( aWildCard )
*aWildCard = fileWildcard;
if( dlg.ShowModal() == wxID_CANCEL )
return;
m_Parent->ClearMsgPanel();
if( CurrPage->m_CommandStringCtrl )
m_Parent->SetNetListerCommand( CurrPage->m_CommandStringCtrl->GetValue() );
else
m_Parent->SetNetListerCommand( wxEmptyString );
m_Parent->CreateNetlist( CurrPage->m_IdNetType, dlg.GetPath(), netlist_opt );
WriteCurrentNetlistSetup();
EndModal( NET_OK );
return ret;
}
/* Function CreateNetlist
* > test for some issues (missing or duplicate references and sheet names)
* > build netlist info
@ -670,7 +617,7 @@ Do you want to annotate schematic?" ) ) )
void NETLIST_DIALOG::OnCancelClick( wxCommandEvent& event )
{
EndModal( NET_ABORT );
EndModal( wxID_CANCEL );
}
@ -691,19 +638,19 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
fn.SetExt( wxT( "cir" ) );
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
g_OptNetListUseNames = CurrPage->m_NetOption->GetSelection() == 0;
NETLIST_PAGE_DIALOG* currPage;
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
g_OptNetListUseNames = currPage->m_NetOption->GetSelection() == 0;
// Set spice netlist options:
unsigned netlist_opt = 0;
if( g_OptNetListUseNames )
netlist_opt |= NET_USE_NETNAMES;
if( CurrPage->m_AddSubPrefix && CurrPage->m_AddSubPrefix->GetValue() )
if( currPage->m_AddSubPrefix && currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX;
if( ! m_Parent->CreateNetlist( CurrPage->m_IdNetType, fn.GetFullPath(),
if( ! m_Parent->CreateNetlist( currPage->m_IdNetType, fn.GetFullPath(),
netlist_opt ) )
return;
@ -718,59 +665,60 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
{
wxString msg, Command;
wxConfig* config = wxGetApp().GetSettings();
NetlistUpdateOpt();
m_Config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() );
// Update the new titles
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
{
NETLIST_PAGE_DIALOG* CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE];
NETLIST_PAGE_DIALOG* currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
if( CurrPage == NULL )
if( currPage == NULL )
break;
msg = wxT( "Custom" );
msg << ii + 1;
if( CurrPage->m_TitleStringCtrl )
if( currPage->m_TitleStringCtrl )
{
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
CurrPage->SetPageNetFmtName( title );
wxString title = currPage->m_TitleStringCtrl->GetValue();
currPage->SetPageNetFmtName( title );
if( msg != title ) // Title has changed, Update config
{
msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1;
config->Write( msg, title );
m_Config->Write( msg, title );
}
}
if( CurrPage->m_CommandStringCtrl )
if( currPage->m_CommandStringCtrl )
{
Command = CurrPage->m_CommandStringCtrl->GetValue();
Command = currPage->m_CommandStringCtrl->GetValue();
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
config->Write( msg, Command );
m_Config->Write( msg, Command );
}
}
}
/**
* Function DeletePluginPanel
* Function OnDelPlugin
* Remove a panel relative to a netlist plugin
*/
void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event )
void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
{
NETLIST_PAGE_DIALOG* CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString );
CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString );
currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
if( CurrPage->m_IsCurrentFormat->IsChecked() )
if( currPage->m_IsCurrentFormat->IsChecked() )
{
CurrPage->m_IsCurrentFormat->SetValue( false );
currPage->m_IsCurrentFormat->SetValue( false );
m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
}
@ -778,27 +726,119 @@ void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event )
EndModal( NET_PLUGIN_CHANGE );
}
/**
* Function ValidatePluginPanel
* Validate the panel info relative to a new netlist plugin
* Function OnAddPlugin
* Add a new panel for a new netlist plugin
*/
void NETLIST_DIALOG::ValidatePluginPanel( wxCommandEvent& event )
void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
{
NETLIST_PAGE_DIALOG* CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString )
{
DisplayError( this, _( "Error. You must provide a command String" ) );
return;
}
if( CurrPage->m_TitleStringCtrl->GetValue() == wxEmptyString )
{
DisplayError( this, _( "Error. You must provide a Title" ) );
NETLIST_DIALOG_ADD_PLUGIN dlg( this );
if( dlg.ShowModal() != wxID_OK )
return;
// Creates a new custom plugin page
wxString title = dlg.GetPluginTitle();
// Verify it does not exists
int netTypeId = PANELCUSTOMBASE; // the first not used type id
NETLIST_PAGE_DIALOG* currPage;
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
{
netTypeId = PANELCUSTOMBASE + ii;
currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
if( currPage == NULL )
break;
if( currPage->GetPageNetFmtName() == title )
{
wxMessageBox( _("This plugin already exists. Abort") );
return;
}
}
wxString cmd = dlg.GetPluginTCommandLine();
currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId );
m_PanelNetType[netTypeId] = currPage;
WriteCurrentNetlistSetup();
// Close and reopen dialog to rebuild the dialog after changes
EndModal( NET_PLUGIN_CHANGE );
}
NETLIST_DIALOG_ADD_PLUGIN::NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ) :
NETLIST_DIALOG_ADD_PLUGIN_BASE( parent )
{
m_Parent = parent;
GetSizer()->SetSizeHints( this );
}
/**
* Function OnOKClick
* Validate info relative to a new netlist plugin
*/
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
{
if( m_textCtrlCommand->GetValue() == wxEmptyString )
{
wxMessageBox( _( "Error. You must provide a command String" ) );
return;
}
if( m_textCtrlName->GetValue() == wxEmptyString )
{
wxMessageBox( _( "Error. You must provide a Title" ) );
return;
}
EndModal( wxID_OK );
}
void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
/*
* Browse plugin files, and set m_CommandStringCtrl field
*/
void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
{
wxString FullFileName, Mask, Path;
Mask = wxT( "*" );
Path = wxGetApp().GetExecutablePath();
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path,
FullFileName,
wxEmptyString,
Mask,
this,
wxFD_OPEN,
true
);
if( FullFileName.IsEmpty() )
return;
// Creates a default command line, suitable for external tool xslproc:
// try to build a default command line depending on plugin extension
wxString cmdLine;
wxFileName fn( FullFileName );
wxString ext = fn.GetExt();
if( ext == wxT("xsl" ) )
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
else if( ext == wxT("exe" ) || ext.IsEmpty() )
cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
else
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
m_textCtrlCommand->SetValue( cmdLine );
/* Get a title for this page */
wxString title = m_textCtrlName->GetValue();
if( title.IsEmpty() )
wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
}

View File

@ -1,24 +1,52 @@
/*****************************************************************************
/**
* @file netlist_control.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* netlist_control.h
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
*****************************************************************************/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _NETLIST_CONTROL_H_
#define _NETLIST_CONTROL_H_
#include <dialogs/dialog_netlist_base.h>
/* Event id for notebook page buttons: */
enum id_netlist {
ID_CREATE_NETLIST = 1550,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_RUN_SIMULATOR,
ID_SETUP_PLUGIN,
ID_VALIDATE_PLUGIN,
ID_DELETE_PLUGIN,
ID_NETLIST_NOTEBOOK,
ID_CHANGE_NOTEBOOK_PAGE,
ID_ADD_SUBCIRCUIT_PREFIX,
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
// Id to select netlist type
enum NETLIST_TYPE_ID {
NET_TYPE_UNINIT = 0,
NET_TYPE_PCBNEW,
NET_TYPE_ORCADPCB2,
NET_TYPE_CADSTAR,
NET_TYPE_SPICE,
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
* is the first id for user netlist format
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
* is the last id for user netlist format
*/
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
};
/* panel (notebook page) identifiers */
@ -31,19 +59,17 @@ enum panel_netlist_index {
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
};
/* Values returned when the netlist dialog is demiss */
enum gen_netlist_diag {
NET_OK,
NET_ABORT,
NET_PLUGIN_CHANGE
};
// Values returned when the netlist dialog is demiss
#define NET_PLUGIN_CHANGE 1
// other values in use are wxID_OK and wxID_CANCEL
/* wxPanels for creating the NoteBook pages for each netlist format: */
class NETLIST_PAGE_DIALOG : public wxPanel
{
public:
int m_IdNetType;
NETLIST_TYPE_ID m_IdNetType;
wxCheckBox* m_IsCurrentFormat;
wxCheckBox* m_AddSubPrefix;
wxTextCtrl* m_CommandStringCtrl;
@ -63,11 +89,9 @@ public:
* @param parent = wxNotebook * parent
* @param title = title (name) of the notebook page
* @param id_NetType = netlist type id
* @param idCheckBox = event ID attached to the "format is default" check box
* @param idCreateFile = event ID attached to the "create netlist" button
*/
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
int id_NetType, int idCheckBox, int idCreateFile );
NETLIST_TYPE_ID id_NetType );
~NETLIST_PAGE_DIALOG() { };
/**
@ -79,27 +103,10 @@ public:
*/
const wxString GetPageNetFmtName();
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName =aName; }
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName = aName; }
};
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
// Id to select netlist type
enum TypeNetForm {
NET_TYPE_UNINIT = 0,
NET_TYPE_PCBNEW,
NET_TYPE_ORCADPCB2,
NET_TYPE_CADSTAR,
NET_TYPE_SPICE,
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
* is the first id for user netlist format
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
* is the last id for user netlist format
*/
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
};
// Options for Spice netlist generation (OR'ed bits
enum netlistOptions {
NET_USE_NETNAMES = 1, // for Spice netlist : use netnames instead of numbers
@ -108,14 +115,16 @@ enum netlistOptions {
};
/* Dialog frame for creating netlists */
class NETLIST_DIALOG : public wxDialog
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
{
public:
SCH_EDIT_FRAME* m_Parent;
wxString m_NetFmtName;
wxNotebook* m_NoteBook;
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
private:
wxConfig* m_Config;
public:
// Constructor and destructor
@ -124,20 +133,73 @@ public:
private:
void InstallCustomPages();
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
const wxString & aCommandString,
NETLIST_TYPE_ID aNetTypeId );
void InstallPageSpice();
void GenNetlist( wxCommandEvent& event );
void RunSimulator( wxCommandEvent& event );
void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event );
void OnNetlistTypeSelection( wxNotebookEvent& event );
void SelectDefaultNetlistType( wxCommandEvent& event );
void EnableSubcircuitPrefix( wxCommandEvent& event );
void AddNewPluginPanel( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event );
void OnAddPlugin( wxCommandEvent& event );
void OnDelPlugin( wxCommandEvent& event );
void WriteCurrentNetlistSetup( void );
bool GetUseDefaultNetlistName()
{
return m_cbUseDefaultNetlistName->IsChecked();
}
/**
* Function ReturnUserNetlistTypeName
* to retrieve user netlist type names
* @param first_item = true: return first name of the list, false = return next
* @return a wxString : name of the type netlist or empty string
* this function must be called first with "first_item" = true
* and after with "first_item" = false to get all the other existing netlist names
*/
const wxString ReturnUserNetlistTypeName( bool first_item );
/**
* Function ReturnFilenamePrms
* returns the filename extension and the wildcard string for this curr
* or a void name if there is no default name
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
* @param aExt = a reference to a wxString to return the defaut file ext.
* @param aWildCard = reference to a wxString to return the defaut wildcard.
* @return true for known netlist type, false for custom formats
*/
bool ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
wxString * aExt, wxString * aWildCard );
DECLARE_EVENT_TABLE()
};
class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE
{
private:
NETLIST_DIALOG* m_Parent;
public:
NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent );
const wxString GetPluginTitle()
{
return m_textCtrlName->GetValue();
}
const wxString GetPluginTCommandLine()
{
return m_textCtrlCommand->GetValue();
}
private:
void OnOKClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnBrowsePlugins( wxCommandEvent& event );
};
#endif /* _NETLIST_CONTROL_H_ */

View File

@ -338,22 +338,8 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
// Compute the outlines of the segment, and creates a polygon
corner = wxPoint( 0, radius );
RotatePoint( &corner, -delta_angle );
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
corner = wxPoint( seg_len, radius );
RotatePoint( &corner, -delta_angle );
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
// add right rounded end:
for( int ii = delta; ii < 1800; ii += delta )
for( int ii = 0; ii < 1800; ii += delta )
{
corner = wxPoint( 0, radius );
RotatePoint( &corner, ii );
@ -365,6 +351,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
aCornerBuffer.push_back( polypoint );
}
// Finish arc:
corner = wxPoint( seg_len, -radius );
RotatePoint( &corner, -delta_angle );
corner += startp;
@ -372,15 +359,8 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
corner = wxPoint( 0, -radius );
RotatePoint( &corner, -delta_angle );
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
// add left rounded end:
for( int ii = delta; ii < 1800; ii += delta )
for( int ii = 0; ii < 1800; ii += delta )
{
corner = wxPoint( 0, -radius );
RotatePoint( &corner, ii );
@ -391,6 +371,14 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
aCornerBuffer.push_back( polypoint );
}
// Finish arc:
corner = wxPoint( 0, radius );
RotatePoint( &corner, -delta_angle );
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
aCornerBuffer.back().end_contour = true;
}

View File

@ -335,10 +335,10 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
{
// If there's no intrusion and DRC is active, we pass the cursor
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment
|| (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem()
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) )
if( !Drc_On || !g_CurrentTrackSegment ||
(BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
!LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) )
{
GetScreen()->SetCrossHairPosition( curs_pos, snapToGrid );
}
@ -350,7 +350,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos, false );
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -5,7 +5,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Jean-Pierre Charras
* Copyright (C) 2012 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
@ -267,15 +267,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text );
m_ValueCtrl->SetValue( m_ValueCopy->m_Text );
#if wxCHECK_VERSION( 2, 8, 0 )
m_AttributsCtrl->SetItemToolTip( 0,
_( "Use this attribute for most non smd components" ) );
m_AttributsCtrl->SetItemToolTip( 1,
_( "Use this attribute for smd components.\nOnly components with this option are put in the footprint position list file" ) );
m_AttributsCtrl->SetItemToolTip( 2,
_( "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) );
#endif
/* Controls on right side of the dialog */
switch( m_CurrentModule->m_Attributs & 255 )
@ -299,12 +296,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_AutoPlaceCtrl->SetSelection(
(m_CurrentModule->m_ModuleStatus & MODULE_is_LOCKED) ? 1 : 0 );
#if wxCHECK_VERSION( 2, 8, 0 )
m_AutoPlaceCtrl->SetItemToolTip( 0,
_( "Enable hotkey move commands and Auto Placement" ) );
m_AutoPlaceCtrl->SetItemToolTip( 1,
_( "Disable hotkey move commands and Auto Placement" ) );
#endif
m_CostRot90Ctrl->SetValue( m_CurrentModule->m_CntRot90 );
m_CostRot180Ctrl->SetValue( m_CurrentModule->m_CntRot180 );
@ -349,7 +346,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay(
}
else
{
S3D_Vertex dummy_vertex;
S3D_VERTEX dummy_vertex;
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
m_3D_Scale->SetValue( dummy_vertex );
}
@ -474,6 +471,10 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
}
S3D_MASTER* new3DShape = new S3D_MASTER( NULL );
#ifdef __WINDOWS__
// Store filename in Unix notation
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
new3DShape->m_Shape3DName = shortfilename;
m_Shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename );

View File

@ -4,6 +4,32 @@
* @brief Dialog for editing a module properties in module editor (modedit)
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 Dick Hollenbeck, dick@softplc.com
* 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
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
@ -199,7 +225,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStru
}
else
{
S3D_Vertex dummy_vertex;
S3D_VERTEX dummy_vertex;
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
m_3D_Scale->SetValue( dummy_vertex );
}
@ -316,6 +342,11 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
}
S3D_MASTER* new3DShape = new S3D_MASTER(NULL);
#ifdef __WINDOWS__
// Store filename in Unix notation
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
new3DShape->m_Shape3DName = shortfilename;
m_Shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration" />
<property name="code_generation">C++</property>