Commit 0ebc3f06 authored by jean-pierre charras's avatar jean-pierre charras

3D-viewer: code cleanup.

Eeschema: annotate and netlist dialogs: enhancements.
Minor  coding policy fixes and  changes.
parent 898275fa
/*
* 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;
......
/////////////////////////////////////////////////////////////////////////////
// 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;
......
This diff is collapsed.
......@@ -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 ),
......
/*
* 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];
......
......@@ -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 );
};
......
/*
* 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__ */
......@@ -55,13 +55,22 @@
#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
{
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_COMMENTS, FL_DRAWINGS, FL_ECO1, FL_ECO2,
FL_GRID,
......@@ -73,7 +82,7 @@ public:
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;
S3D_COLOR m_BgColor;
bool m_DrawFlags[FL_LAST]; // show these special items
wxPoint m_BoardPos;
wxSize m_BoardSize;
......@@ -88,7 +97,6 @@ public:
* 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();
};
......
......@@ -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
......
......@@ -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 );
......
......@@ -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." );
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 );
}
}
}
......
/*
* 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
......
///////////////////////////////////////////////////////////////////////////
// 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();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// 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__
///////////////////////////////////////////////////////////////////////////
// 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()
{
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// 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__
......@@ -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
};
......
This diff is collapsed.
/*****************************************************************************
/**
* @file netlist_control.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* 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.
*
* netlist_control.h
* 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>
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
/* 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,
// 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_ */
......@@ -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,24 +359,25 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
// add left rounded end:
for( int ii = 0; ii < 1800; ii += delta )
{
corner = wxPoint( 0, -radius );
RotatePoint( &corner, ii );
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 )
{
corner = wxPoint( 0, -radius );
RotatePoint( &corner, ii );
// 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;
}
......
......@@ -335,9 +335,9 @@ 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,
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() )
......
......@@ -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 );
......
......@@ -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 );
......
<?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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment