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. * 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) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -29,10 +29,6 @@ ...@@ -29,10 +29,6 @@
#include <fctsys.h> #include <fctsys.h>
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include <common.h> #include <common.h>
#include <trigo.h> #include <trigo.h>
#include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h>
...@@ -49,7 +45,7 @@ ...@@ -49,7 +45,7 @@
#include <trackball.h> #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; unsigned ii;
...@@ -79,7 +75,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_Vertex >& aVertices ) ...@@ -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; unsigned ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r; GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
...@@ -271,9 +267,9 @@ VERTEX_VALUE_CTRL::~VERTEX_VALUE_CTRL() ...@@ -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; double dtmp;
m_XValueCtrl->GetValue().ToDouble( &dtmp ); m_XValueCtrl->GetValue().ToDouble( &dtmp );
...@@ -286,7 +282,7 @@ S3D_Vertex VERTEX_VALUE_CTRL::GetValue() ...@@ -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; 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> #include <fctsys.h>
...@@ -55,7 +79,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) : ...@@ -55,7 +79,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
S3D_MASTER:: ~S3D_MASTER() S3D_MASTER:: ~S3D_MASTER()
{ {
Struct3D_Shape* next; STRUCT_3D_SHAPE* next;
S3D_MATERIAL* nextmat; S3D_MATERIAL* nextmat;
for( ; m_3D_Drawings != NULL; m_3D_Drawings = next ) for( ; m_3D_Drawings != NULL; m_3D_Drawings = next )
...@@ -72,7 +96,7 @@ S3D_MASTER:: ~S3D_MASTER() ...@@ -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 ) EDA_ITEM( aParent, NOT_USED )
{ {
m_3D_Coord = NULL; m_3D_Coord = NULL;
...@@ -81,7 +105,7 @@ Struct3D_Shape::Struct3D_Shape( EDA_ITEM* aParent ) : ...@@ -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_Coord;
delete m_3D_CoordIndex; delete m_3D_CoordIndex;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <trigo.h> #include <trigo.h>
#include <pcbstruct.h> #include <pcbstruct.h>
#include <drawtxt.h> #include <drawtxt.h>
#include <confirm.h> //include <confirm.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <class_board.h> #include <class_board.h>
...@@ -41,33 +41,89 @@ ...@@ -41,33 +41,89 @@
#include <class_drawsegment.h> #include <class_drawsegment.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
#include <class_marker_pcb.h> //#include <class_marker_pcb.h>
#include <colors_selection.h> #include <colors_selection.h>
#include <3d_viewer.h> #include <3d_viewer.h>
#include <info3d_visu.h> #include <info3d_visu.h>
#include <trackball.h> #include <trackball.h>
// angle increment to draw a circle, approximated by segments
#define ANGLE_INC(x) (3600/(x))
extern void CheckGLError(); extern void CheckGLError();
static void Draw3D_FilledCircle( double posx, double posy, double radius, /* draw a segment using 3D primitives, in a XY plane
double hole_radius, double zpos ); * aStartPos = 3D position of the starting point (3D units)
static void Draw3D_FilledSegment( double startx, double starty, * aEndx, aEndy = 3D position of the ending point (3D units)
double endx, double endy, * aWidth = width of the segment (3D units)
double width, double zpos ); */
static void Draw3D_ZaxisCylinder( const S3D_Vertex& aPos, double aRadius, double aHeight ); static void Draw3D_FilledSegment( const S3D_VERTEX& aStartPos,
double aEndx, double aEndy, double aWidth );
static void Draw3D_FilledSegmentWithHole( double startx, double starty, static void Draw3D_SegmentWithHole( double startx, double starty,
double endx, double endy, double endx, double endy,
double width, double holex, double width, double holex,
double holey, double holeradius, double holey, double holeradius,
double zpos ); double zpos );
static void Draw3D_ArcSegment( double startx, double starty, double centrex,
double centrey, double arc_angle, double width, double zpos ); /* draw an arc using 3D primitives, in a plane parallel to the XY plane
static void Draw3D_CircleSegment( double startx, double starty, double endx, * aCenterPos = 3D position of the center
double endy, double width, double zpos ); * aStartPointX, aStartPointY = start point coordinate of arc (3D units)
static int Get3DLayerEnable( int act_layer ); * aWidth = width of the circle (3D units)
static GLfloat Get3DLayerSide( int act_layer ); * aArcAngle = arc angle in 1/10 degrees
* aWidth = thickness of arc
*/
static void Draw3D_ArcSegment( const S3D_VERTEX& aCenterPos,
double aStartPointX, double aStartPointY,
double aArcAngle, double aWidth );
/* draw a circle with hole using 3D primitives, in a XY plane
* aCenterPos = 3D position of the center
* aRadius = radius of the circle (3D units)
* aHoleRadius = radius of the hole (3D units)
* Used to draw vias and round pads with round hole
*/
static void Draw3D_FilledCircleWithHole( const S3D_VERTEX& aPos, double aRadius, double aHoleRadius );
/* draw a circle using 3D primitives, in a plane parallel to the XY plane
* aCenterPos = 3D position of the center
* aRadius = radius of the circle (3D units)
* aWidth = width of the circle (3D units)
* Does the same think as Draw3D_FilledCircleWithHole, just does not use the same parmeters
* Used to draw circular segments
*/
static void Draw3D_ThickCircle( const S3D_VERTEX& aCenterPos, double aRadius, double aWidth );
/* returns true if aLayer should be displayed, false otherwise
*/
static bool Is3DLayerEnabled( int aLayer );
/* returns the Z orientation parmeter 1.0 or -1.0 for aLayer
* Z orientation is 1.0 for all layers but "back" layers:
* LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
* used to calculate the Z orientation parmeter for glNormal3f
*/
static GLfloat Get3DLayer_Z_Orientation( int aLayer );
/* draw a cylinder using 3D primitives.
* the cylinder axis is parallel to the Z axis
* aCenterPos = 3D position of the axis cylinder
* aRadius = radius of the cylinder (3D units)
* aHeight = height of the cylinder (3D units)
*/
static void Draw3D_ZaxisCylinder( const S3D_VERTEX& aPos, double aRadius, double aHeight );
/* draw an oblong cylinder (oblong hole) using 3D primitives.
* the cylinder axis are parallel to the Z axis
* aCenterPos = 3D position of the first axis cylinder
* aEndx, aEndy = 3D position of the second axis cylinder
* aRadius = radius of the cylinder (3D units)
* aHeight = height of the cylinder (3D units)
*/
static void Draw3D_ZaxisOblongCylinder( const S3D_VERTEX& aCenterPos,
double aEndx, double aEndy,
double aRadius, double aHeight );
#ifndef CALLBACK #ifndef CALLBACK
...@@ -138,9 +194,6 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -138,9 +194,6 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{ {
PCB_BASE_FRAME* pcbframe = Parent()->Parent(); PCB_BASE_FRAME* pcbframe = Parent()->Parent();
BOARD* pcb = pcbframe->GetBoard(); BOARD* pcb = pcbframe->GetBoard();
TRACK* track;
SEGZONE* segzone;
int ii;
wxBusyCursor dummy; wxBusyCursor dummy;
...@@ -171,19 +224,21 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -171,19 +224,21 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
// Init Z position of each layer // Init Z position of each layer
// calculate z position for each copper layer // calculate z position for each copper layer
for( ii = 0; ii < g_Parm_3D_Visu.m_CopperLayersCount; ii++ ) int layer;
int copper_layers_cnt = g_Parm_3D_Visu.m_CopperLayersCount;
for( layer = 0; layer < copper_layers_cnt; layer++ )
{ {
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_EpoxyThickness g_Parm_3D_Visu.m_LayerZcoord[layer] =
* ii / (g_Parm_3D_Visu.m_CopperLayersCount - 1); g_Parm_3D_Visu.m_EpoxyThickness * layer / (copper_layers_cnt - 1);
} }
double zpos_copper_back = g_Parm_3D_Visu.m_LayerZcoord[0]; double zpos_copper_back = g_Parm_3D_Visu.m_LayerZcoord[0];
double zpos_copper_front = g_Parm_3D_Visu.m_EpoxyThickness; double zpos_copper_front = g_Parm_3D_Visu.m_EpoxyThickness;
// Fill remaining unused copper layers and front layer zpos // Fill remaining unused copper layers and front layer zpos
// with g_Parm_3D_Visu.m_EpoxyThickness // with g_Parm_3D_Visu.m_EpoxyThickness
for( ; ii <= LAST_COPPER_LAYER; ii++ ) for( ; layer <= LAST_COPPER_LAYER; layer++ )
{ {
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_EpoxyThickness; g_Parm_3D_Visu.m_LayerZcoord[layer] = g_Parm_3D_Visu.m_EpoxyThickness;
} }
// calculate z position for each non copper layer // calculate z position for each non copper layer
...@@ -275,112 +330,27 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -275,112 +330,27 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
// draw tracks and vias : // draw tracks and vias :
for( track = pcb->m_Track; track != NULL; track = track->Next() ) for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
{ {
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
Draw3D_Via( (SEGVIA*) track ); Draw3D_Via( (SEGVIA*) track );
else else
Draw3D_Track( track );
}
if (g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE])
{
// Draw segments used to fill copper areas. outdated!
for( segzone = pcb->m_Zone; segzone != NULL; segzone = segzone->Next() )
{ {
if( segzone->Type() == PCB_ZONE_T ) int layer = track->GetLayer();
Draw3D_Track( segzone );
}
// Draw new segments
for( ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* curr_zone = pcb->GetArea( ii );
if( curr_zone->m_FillMode == 0 ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
{ Draw3D_Track( track );
// solid polygons only are used to fill areas
if( curr_zone->GetFilledPolysList().size() > 3 )
{
Draw3D_SolidPolygonsInZones( curr_zone );
}
}
else
{
// segments are used to fill areas
for( unsigned iseg = 0; iseg < curr_zone->m_FillSegmList.size(); iseg++ )
{
SEGZONE dummysegment( pcb );
dummysegment.SetLayer( curr_zone->GetLayer() );
dummysegment.m_Width = curr_zone->m_ZoneMinThickness;
dummysegment.m_Start.x = curr_zone->m_FillSegmList[iseg].m_Start.x;
dummysegment.m_Start.y = curr_zone->m_FillSegmList[iseg].m_Start.y;
dummysegment.m_End.x = curr_zone->m_FillSegmList[iseg].m_End.x;
dummysegment.m_End.y = curr_zone->m_FillSegmList[iseg].m_End.y;
Draw3D_Track( &dummysegment );
}
}
} }
}
// Draw copper areas outlines if (g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE])
for( ii = 0; ii < pcb->GetAreaCount(); ii++ ) {
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = pcb->GetArea( ii ); int layer = pcb->GetArea( ii )->GetLayer();
std::vector<CPolyPt> polysList = zone->GetFilledPolysList();
if( polysList.size() == 0 )
continue;
if( zone->m_ZoneMinThickness <= 1 )
continue;
int imax = polysList.size() - 1;
CPolyPt* firstcorner = &polysList[0];
CPolyPt* begincorner = firstcorner;
SEGZONE dummysegment( pcb );
dummysegment.SetLayer( zone->GetLayer() );
dummysegment.m_Width = zone->m_ZoneMinThickness;
for( int ic = 1; ic <= imax; ic++ )
{
CPolyPt* endcorner = &polysList[ic];
if( begincorner->m_utility == 0 ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
{ Draw3D_Zone( pcb->GetArea( ii ) );
// Draw only basic outlines, not extra segments
dummysegment.m_Start.x = begincorner->x;
dummysegment.m_Start.y = begincorner->y;
dummysegment.m_End.x = endcorner->x;
dummysegment.m_End.y = endcorner->y;
Draw3D_Track( &dummysegment );
}
if( (endcorner->end_contour) || (ic == imax) )
{
// the last corner of a filled area is found: draw it
if( endcorner->m_utility == 0 )
{
// Draw only basic outlines, not extra segments
dummysegment.m_Start.x = endcorner->x;
dummysegment.m_Start.y = endcorner->y;
dummysegment.m_End.x = firstcorner->x;
dummysegment.m_End.y = firstcorner->y;
Draw3D_Track( &dummysegment );
}
ic++;
if( ic < imax - 1 )
begincorner = firstcorner = &polysList[ic];
}
else
{
begincorner = endcorner;
}
}
} }
} }
...@@ -392,11 +362,19 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -392,11 +362,19 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case PCB_LINE_T: case PCB_LINE_T:
Draw3D_DrawSegment( (DRAWSEGMENT*) PtStruct ); {
DRAWSEGMENT* segment = (DRAWSEGMENT*) PtStruct;
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( segment->GetLayer() ) )
Draw3D_DrawSegment( segment );
}
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
Draw3D_DrawText( (TEXTE_PCB*) PtStruct ); {
TEXTE_PCB* text = (TEXTE_PCB*) PtStruct;
if( Is3DLayerEnabled( text->GetLayer() ) )
Draw3D_DrawText( text );
}
break; break;
default: default:
...@@ -422,6 +400,98 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -422,6 +400,98 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
return m_gllist; return m_gllist;
} }
/* Draw a zone (solid copper areas in aZone)
*/
void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
{
int layer = aZone->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
if( layer == LAST_COPPER_LAYER )
layer = g_Parm_3D_Visu.m_CopperLayersCount - 1;
double zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
double width = aZone->m_ZoneMinThickness * g_Parm_3D_Visu.m_BoardScale;
SetGLColor( color );
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
if( aZone->m_FillMode == 0 )
{
// solid polygons only are used to fill areas
if( aZone->GetFilledPolysList().size() > 3 )
{
Draw3D_SolidPolygonsInZones( aZone );
}
}
else
{
// segments are used to fill areas
for( unsigned iseg = 0; iseg < aZone->m_FillSegmList.size(); iseg++ )
{
double ox = aZone->m_FillSegmList[iseg].m_Start.x * g_Parm_3D_Visu.m_BoardScale;
double oy = aZone->m_FillSegmList[iseg].m_Start.y * g_Parm_3D_Visu.m_BoardScale;
double fx = aZone->m_FillSegmList[iseg].m_End.x * g_Parm_3D_Visu.m_BoardScale;
double fy = aZone->m_FillSegmList[iseg].m_End.y * g_Parm_3D_Visu.m_BoardScale;
S3D_VERTEX pos( ox, -oy, zpos );
Draw3D_FilledSegment( pos, fx, -fy, width );
}
}
// Draw copper area outlines
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
if( polysList.size() == 0 )
return;
if( aZone->m_ZoneMinThickness <= 1 )
return;
int imax = polysList.size() - 1;
CPolyPt* firstcorner = &polysList[0];
CPolyPt* begincorner = firstcorner;
for( int ic = 1; ic <= imax; ic++ )
{
CPolyPt* endcorner = &polysList[ic];
if( begincorner->m_utility == 0 )
{
// Draw only basic outlines, not extra segments
double ox = begincorner->x * g_Parm_3D_Visu.m_BoardScale;
double oy = begincorner->y * g_Parm_3D_Visu.m_BoardScale;
double fx = endcorner->x * g_Parm_3D_Visu.m_BoardScale;
double fy = endcorner->y * g_Parm_3D_Visu.m_BoardScale;
S3D_VERTEX pos( ox, -oy, zpos );
Draw3D_FilledSegment( pos, fx, -fy, width );
}
if( (endcorner->end_contour) || (ic == imax) )
{
// the last corner of a filled area is found: draw it
if( endcorner->m_utility == 0 )
{
// Draw only basic outlines, not extra segments
double ox = endcorner->x * g_Parm_3D_Visu.m_BoardScale;
double oy = endcorner->y * g_Parm_3D_Visu.m_BoardScale;
double fx = firstcorner->x * g_Parm_3D_Visu.m_BoardScale;
double fy = firstcorner->y * g_Parm_3D_Visu.m_BoardScale;
S3D_VERTEX pos( ox, -oy, zpos );
Draw3D_FilledSegment( pos, fx, -fy, width );
}
ic++;
if( ic < imax - 1 )
begincorner = firstcorner = &polysList[ic];
}
else
{
begincorner = endcorner;
}
}
}
// draw mm grid.. // draw mm grid..
void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM ) void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
...@@ -554,13 +624,9 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM ) ...@@ -554,13 +624,9 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
} }
void EDA_3D_CANVAS::Draw3D_Track( TRACK* track ) void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack )
{ {
int layer = track->GetLayer(); int layer = aTrack->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_ColorsSettings.GetLayerColor( layer ); int color = g_ColorsSettings.GetLayerColor( layer );
if( layer == LAST_COPPER_LAYER ) if( layer == LAST_COPPER_LAYER )
...@@ -571,12 +637,14 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* track ) ...@@ -571,12 +637,14 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* track )
SetGLColor( color ); SetGLColor( color );
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
double w = track->m_Width * g_Parm_3D_Visu.m_BoardScale; double w = aTrack->m_Width * g_Parm_3D_Visu.m_BoardScale;
double ox = track->m_Start.x * g_Parm_3D_Visu.m_BoardScale; double ox = aTrack->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
double oy = track->m_Start.y * g_Parm_3D_Visu.m_BoardScale; double oy = aTrack->m_Start.y * g_Parm_3D_Visu.m_BoardScale;
double fx = track->m_End.x * g_Parm_3D_Visu.m_BoardScale; double fx = aTrack->m_End.x * g_Parm_3D_Visu.m_BoardScale;
double fy = track->m_End.y * g_Parm_3D_Visu.m_BoardScale; double fy = aTrack->m_End.y * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledSegment( ox, -oy, fx, -fy, w, zpos );
S3D_VERTEX pos( ox, -oy, zpos );
Draw3D_FilledSegment( pos, fx, -fy, w );
} }
...@@ -585,9 +653,6 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -585,9 +653,6 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
double zpos; double zpos;
int layer = aZone->GetLayer(); int layer = aZone->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_ColorsSettings.GetLayerColor( layer ); int color = g_ColorsSettings.GetLayerColor( layer );
if( layer == LAST_COPPER_LAYER ) if( layer == LAST_COPPER_LAYER )
...@@ -596,7 +661,6 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -596,7 +661,6 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
g_Parm_3D_Visu.m_ActZpos = zpos; g_Parm_3D_Visu.m_ActZpos = zpos;
SetGLColor( color ); SetGLColor( color );
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
...@@ -677,7 +741,6 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) ...@@ -677,7 +741,6 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
SetGLColor( color ); SetGLColor( color );
// SetGLColor( LIGHTGRAY );
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
if( layer == LAYER_N_BACK ) if( layer == LAYER_N_BACK )
...@@ -685,7 +748,8 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) ...@@ -685,7 +748,8 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
else else
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale; zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledCircle( x, -y, r, hole, zpos ); S3D_VERTEX pos( x, -y, zpos);
Draw3D_FilledCircleWithHole( pos, r, hole );
if( layer >= top_layer ) if( layer >= top_layer )
break; break;
...@@ -695,75 +759,84 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) ...@@ -695,75 +759,84 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->m_Shape ); color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->m_Shape );
SetGLColor( color ); SetGLColor( color );
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer]; height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
S3D_Vertex position( x, -y, g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] ); S3D_VERTEX position( x, -y, g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
Draw3D_ZaxisCylinder( position, hole, height ); Draw3D_ZaxisCylinder( position, hole, height );
} }
void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
{ {
double x, y, xf, yf;
double zpos, w;
int layer = segment->GetLayer(); int layer = segment->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_ColorsSettings.GetLayerColor( layer ); int color = g_ColorsSettings.GetLayerColor( layer );
SetGLColor( color ); SetGLColor( color );
w = segment->GetWidth() * g_Parm_3D_Visu.m_BoardScale; double w = segment->GetWidth() * g_Parm_3D_Visu.m_BoardScale;
double x = segment->GetStart().x * g_Parm_3D_Visu.m_BoardScale;
x = segment->GetStart().x * g_Parm_3D_Visu.m_BoardScale; double y = segment->GetStart().y * g_Parm_3D_Visu.m_BoardScale;
y = segment->GetStart().y * g_Parm_3D_Visu.m_BoardScale; double xf = segment->GetEnd().x * g_Parm_3D_Visu.m_BoardScale;
double yf = segment->GetEnd().y * g_Parm_3D_Visu.m_BoardScale;
xf = segment->GetEnd().x * g_Parm_3D_Visu.m_BoardScale;
yf = segment->GetEnd().y * g_Parm_3D_Visu.m_BoardScale;
if( layer == EDGE_N ) if( layer == EDGE_N )
{ {
for( layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ ) for( layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
{ {
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; double zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
switch( segment->GetShape() ) switch( segment->GetShape() )
{ {
case S_ARC: case S_ARC:
Draw3D_ArcSegment( x, -y, xf, -yf, segment->GetAngle(), w, zpos ); {
S3D_VERTEX pos( xf, -yf, zpos );
Draw3D_ArcSegment( pos, x, -y, segment->GetAngle(), w );
}
break; break;
case S_CIRCLE: case S_CIRCLE:
Draw3D_CircleSegment( x, -y, xf, -yf, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_ThickCircle( pos, hypot( x - xf, y - yf ), w );
}
break; break;
default: default:
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_FilledSegment( pos, xf, -yf, w );
}
break; break;
} }
} }
} }
else else
{ {
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) ); glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; double zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( Get3DLayerEnable( layer ) ) if( Is3DLayerEnabled( layer ) )
{ {
switch( segment->GetShape() ) switch( segment->GetShape() )
{ {
case S_ARC: case S_ARC:
Draw3D_ArcSegment( x, -y, xf, -yf, segment->GetAngle(), w, zpos ); {
S3D_VERTEX pos( xf, -yf, zpos );
Draw3D_ArcSegment( pos, x, -y, segment->GetAngle(), w );
}
break; break;
case S_CIRCLE: case S_CIRCLE:
Draw3D_CircleSegment( x, -y, xf, -yf, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_ThickCircle( pos, hypot( x - xf, y - yf ), w );
}
break; break;
default: default:
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_FilledSegment( pos , xf, -yf, w );
}
break; break;
} }
} }
...@@ -771,7 +844,12 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -771,7 +844,12 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
} }
// These variables are used in Draw3dTextSegm.
// But Draw3dTextSegm is a call back function, so we cannot send them as arguments,
// so they are static.
static double s_Text3DWidth, s_Text3DZPos; static double s_Text3DWidth, s_Text3DZPos;
// This is a call back function, used by DrawGraphicText to draw the 3D text shape:
static void Draw3dTextSegm( int x0, int y0, int xf, int yf ) static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
{ {
double startx = x0 * g_Parm_3D_Visu.m_BoardScale; double startx = x0 * g_Parm_3D_Visu.m_BoardScale;
...@@ -779,23 +857,20 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf ) ...@@ -779,23 +857,20 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
double endx = xf * g_Parm_3D_Visu.m_BoardScale; double endx = xf * g_Parm_3D_Visu.m_BoardScale;
double endy = yf * g_Parm_3D_Visu.m_BoardScale; double endy = yf * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledSegment( startx, -starty, endx, -endy, s_Text3DWidth, s_Text3DZPos ); S3D_VERTEX pos( startx, -starty, s_Text3DZPos );
Draw3D_FilledSegment( pos, endx, -endy, s_Text3DWidth );
} }
void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
{ {
int layer = text->GetLayer(); int layer = text->GetLayer();
if( !Get3DLayerEnable( layer ) )
return;
int color = g_ColorsSettings.GetLayerColor( layer ); int color = g_ColorsSettings.GetLayerColor( layer );
SetGLColor( color ); SetGLColor( color );
s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer]; s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer];
s_Text3DWidth = text->GetThickness() * g_Parm_3D_Visu.m_BoardScale; s_Text3DWidth = text->GetThickness() * g_Parm_3D_Visu.m_BoardScale;
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) ); glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
wxSize size = text->m_Size; wxSize size = text->m_Size;
if( text->m_Mirror ) if( text->m_Mirror )
...@@ -946,15 +1021,24 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -946,15 +1021,24 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
switch( m_Shape ) switch( m_Shape )
{ {
case S_SEGMENT: case S_SEGMENT:
Draw3D_FilledSegment( x, -y, fx, -fy, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_FilledSegment( pos, fx, -fy, w );
}
break; break;
case S_CIRCLE: case S_CIRCLE:
Draw3D_CircleSegment( x, -y, fx, -fy, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_ThickCircle( pos, hypot( x - fx, y - fy ), w);
}
break; break;
case S_ARC: case S_ARC:
Draw3D_ArcSegment( x, -y, fx, -fy, (double) m_Angle, w, zpos ); {
S3D_VERTEX pos( fx, -fy, zpos );
Draw3D_ArcSegment( pos, x, -y, (double) m_Angle, w );
}
break; break;
case S_POLYGON: case S_POLYGON:
...@@ -994,15 +1078,24 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -994,15 +1078,24 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
switch( m_Shape ) switch( m_Shape )
{ {
case S_SEGMENT: case S_SEGMENT:
Draw3D_FilledSegment( x, -y, fx, -fy, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_FilledSegment( pos, fx, -fy, w );
}
break; break;
case S_CIRCLE: case S_CIRCLE:
Draw3D_CircleSegment( x, -y, fx, -fy, w, zpos ); {
S3D_VERTEX pos( x, -y, zpos );
Draw3D_ThickCircle( pos, hypot( x - fx, y - fy ), w );
}
break; break;
case S_ARC: case S_ARC:
Draw3D_ArcSegment( x, -y, fx, -fy, (double) m_Angle, w, zpos ); {
S3D_VERTEX pos( fx, -fy, zpos );
Draw3D_ArcSegment( pos, x, -y, (double) m_Angle, w );
}
break; break;
case S_POLYGON: case S_POLYGON:
...@@ -1045,21 +1138,18 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -1045,21 +1138,18 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
delta_cx, delta_cy, delta_cx, delta_cy,
xc, yc; xc, yc;
int angle; int angle;
double scale;
double zpos; double zpos;
wxPoint shape_pos; double x, y, r, w;
double x, y, r, w, hole, holeX, holeY;
double drillx, drilly;
bool Oncu, Oncmp, Both; bool Oncu, Oncmp, Both;
int color; int color;
scale = g_Parm_3D_Visu.m_BoardScale; double scale = g_Parm_3D_Visu.m_BoardScale;
holeX = (double) m_Drill.x * scale / 2; double holeX = (double) m_Drill.x * scale / 2;
holeY = (double) m_Drill.y * scale / 2; double holeY = (double) m_Drill.y * scale / 2;
hole = fmin( holeX, holeY ); double hole = fmin( holeX, holeY );
// Calculate the center of the pad. // Calculate the center of the pad.
shape_pos = ReturnShapePos(); wxPoint shape_pos = ReturnShapePos();
ux0 = shape_pos.x; ux0 = shape_pos.x;
uy0 = shape_pos.y; uy0 = shape_pos.y;
xc = ux0; xc = ux0;
...@@ -1069,17 +1159,48 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -1069,17 +1159,48 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
dy = dy0 = m_Size.y >> 1; dy = dy0 = m_Size.y >> 1;
angle = m_Orient; angle = m_Orient;
drillx = m_Pos.x * scale; double drillx = m_Pos.x * scale;
drilly = m_Pos.y * scale; double drilly = m_Pos.y * scale;
double height = g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_FRONT] -
g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_BACK];
// Draw the pad hole (TODO: draw OBLONG hole) // Draw the pad hole
if( holeX && holeY ) if( holeX && holeY )
{ {
SetGLColor( DARKGRAY ); SetGLColor( DARKGRAY );
S3D_Vertex position( drillx, -drilly, g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_BACK] ); S3D_VERTEX position( drillx, -drilly, g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_BACK] );
double height = g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_FRONT] -
g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_BACK]; if( holeX == holeY ) // usual round hole
Draw3D_ZaxisCylinder( position, hole, height ); Draw3D_ZaxisCylinder( position, hole, height );
else // Oval hole
{
double ldx, ldy;
if( holeX > holeY ) // Horizontal oval
{
ldx = holeX - holeY;
ldy = 0;
w = m_Size.y * scale;
}
else // Vertical oval
{
ldx = 0;
ldy = holeY - holeX;
w = m_Size.x * scale;
}
RotatePoint( &ldx, &ldy, angle );
{
double ox = ux0 * scale + ldx;
double oy = uy0 * scale + ldy;
double fx = ux0 * scale - ldx;
double fy = uy0 * scale - ldy;
S3D_VERTEX position( ox, -oy, g_Parm_3D_Visu.m_LayerZcoord[LAYER_N_BACK] );
Draw3D_ZaxisOblongCylinder( position, fx, -fy, hole, height );
}
}
} }
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
...@@ -1123,7 +1244,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -1123,7 +1244,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
else else
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale; zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledCircle( x, -y, r, hole, zpos ); S3D_VERTEX position( x, -y, zpos );
Draw3D_FilledCircleWithHole( position, r, hole );
} }
break; break;
...@@ -1179,7 +1301,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -1179,7 +1301,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
else else
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale; zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos ); Draw3D_SegmentWithHole( ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos );
} }
} }
...@@ -1282,34 +1404,33 @@ void SetGLColor( int color ) ...@@ -1282,34 +1404,33 @@ void SetGLColor( int color )
} }
static void Draw3D_FilledCircle( double posx, double posy, void Draw3D_FilledCircleWithHole( const S3D_VERTEX& aPos, double radius, double hole_radius )
double radius, double hole, double zpos )
{ {
const int slice = 16; const int slice = 16;
const int rot_angle = 3600/16; const int rot_angle = ANGLE_INC(slice);
glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP );
for( int ii = 0; ii <= slice; ii++ ) for( int ii = 0; ii <= slice; ii++ )
{ {
double x = hole; double x = hole_radius;
double y = 0.0; double y = 0.0;
RotatePoint( &x, &y, ii * rot_angle ); RotatePoint( &x, &y, ii * rot_angle );
glVertex3f( x + posx, y + posy, zpos ); glVertex3f( x + aPos.x, y + aPos.y, aPos.z );
x = radius; x = radius;
y = 0.0; y = 0.0;
RotatePoint( &x, &y, ii * rot_angle ); RotatePoint( &x, &y, ii * rot_angle );
glVertex3f( x + posx, y + posy, zpos ); glVertex3f( x + aPos.x, y + aPos.y, aPos.z );
} }
glEnd(); glEnd();
} }
static void Draw3D_ZaxisCylinder( const S3D_Vertex& aPos, double aRadius, double aHeight ) static void Draw3D_ZaxisCylinder( const S3D_VERTEX& aPos, double aRadius, double aHeight )
{ {
const int slice = 12; const int slice = 12;
std::vector< S3D_Vertex > coords; std::vector< S3D_VERTEX > coords;
coords.resize( 4 ); coords.resize( 4 );
double tmp = DataScale3D; double tmp = DataScale3D;
...@@ -1324,7 +1445,7 @@ static void Draw3D_ZaxisCylinder( const S3D_Vertex& aPos, double aRadius, double ...@@ -1324,7 +1445,7 @@ static void Draw3D_ZaxisCylinder( const S3D_Vertex& aPos, double aRadius, double
{ {
double x = aRadius; double x = aRadius;
double y = 0.0; double y = 0.0;
RotatePoint( &x, &y, ii * (3600 / slice) ); RotatePoint( &x, &y, ii * ANGLE_INC(slice) );
coords[2].x = coords[3].x = aPos.x + x; coords[2].x = coords[3].x = aPos.x + x;
coords[2].y = coords[3].y = aPos.y + y; coords[2].y = coords[3].y = aPos.y + y;
Set_Object_Data( coords ); Set_Object_Data( coords );
...@@ -1340,20 +1461,20 @@ static void Draw3D_ZaxisCylinder( const S3D_Vertex& aPos, double aRadius, double ...@@ -1340,20 +1461,20 @@ static void Draw3D_ZaxisCylinder( const S3D_Vertex& aPos, double aRadius, double
// Draw a polygon similar to a segment has rounded tips // Draw a polygon similar to a segment has rounded tips
static void Draw3D_FilledSegment( double startx, double starty, double endx, static void Draw3D_FilledSegment( const S3D_VERTEX& aStartPos,
double endy, double width, double zpos ) double aEndx, double aEndy, double aWidth )
{ {
double dx, dy, x, y, firstx = 0, firsty = 0; double dx, dy, x, y, firstx = 0, firsty = 0;
int ii, angle; int ii, angle;
// Calculate the coordinates of the segment assumed horizontal. // Calculate the coordinates of the segment assumed horizontal.
// Then turn the strips of the desired angle. // Then turn the strips of the desired angle.
dx = endx - startx; dx = aEndx - aStartPos.x;
dy = endy - starty; dy = aEndy - aStartPos.y;
angle = (int) ( ( atan2( dy, dx ) * 1800 / M_PI ) + 0.5 ); angle = (int) ( ( atan2( dy, dx ) * 1800 / M_PI ) + 0.5 );
RotatePoint( &dx, &dy, angle ); RotatePoint( &dx, &dy, angle );
width /= 2; aWidth /= 2;
glBegin( GL_POLYGON ); glBegin( GL_POLYGON );
...@@ -1362,37 +1483,37 @@ static void Draw3D_FilledSegment( double startx, double starty, double endx, ...@@ -1362,37 +1483,37 @@ static void Draw3D_FilledSegment( double startx, double starty, double endx,
for( ii = 0; ii <= slice/2; ii++ ) for( ii = 0; ii <= slice/2; ii++ )
{ {
x = 0.0; x = 0.0;
y = -width; y = -aWidth;
RotatePoint( &x, &y, -ii * 3600/slice ); RotatePoint( &x, &y, -ii * ANGLE_INC(slice) );
x += dx; x += dx;
RotatePoint( &x, &y, -angle ); RotatePoint( &x, &y, -angle );
glVertex3f( startx + x, starty + y, zpos ); glVertex3f( aStartPos.x + x, aStartPos.y + y, aStartPos.z );
if( ii == 0 ) if( ii == 0 )
{ {
firstx = startx + x; firstx = aStartPos.x + x;
firsty = starty + y; firsty = aStartPos.y + y;
} }
} }
// Rounding the left (2nd half polygon is the origin of the segment) // Rounding the left (2nd half polygon is the origin of the segment)
for( ii = 0; ii <= slice/2; ii++ ) for( ii = 0; ii <= slice/2; ii++ )
{ {
int jj = ii * 3600/slice; int jj = ii * ANGLE_INC(slice);
x = 0.0; x = 0.0;
y = width; y = aWidth;
RotatePoint( &x, &y, -angle - jj ); RotatePoint( &x, &y, -angle - jj );
glVertex3f( startx + x, starty + y, zpos ); glVertex3f( aStartPos.x + x, aStartPos.y + y, aStartPos.z );
} }
glVertex3f( firstx, firsty, zpos ); glVertex3f( firstx, firsty, aStartPos.z );
glEnd(); glEnd();
} }
/* Draw a polygon similar to a segment ends with round hole /* Draw a polygon similar to a segment ends with round hole
*/ */
static void Draw3D_FilledSegmentWithHole( double startx, double starty, static void Draw3D_SegmentWithHole( double startx, double starty,
double endx, double endy, double endx, double endy,
double width, double holex, double width, double holex,
double holey, double holeradius, double holey, double holeradius,
...@@ -1467,18 +1588,20 @@ static void Draw3D_FilledSegmentWithHole( double startx, double starty, ...@@ -1467,18 +1588,20 @@ static void Draw3D_FilledSegmentWithHole( double startx, double starty,
} }
static void Draw3D_ArcSegment( double startx, double starty, double centrex, static void Draw3D_ArcSegment( const S3D_VERTEX& aCenterPos,
double centrey, double arc_angle, double width, double zpos ) double aStartPointX, double aStartPointY,
double aArcAngle, double aWidth )
{ {
const int slice = 36; // Number of segments to approximate a circle by segments const int slice = 16; // Number of segments to approximate a circle by segments
double arcStart_Angle; double arcStart_Angle;
arcStart_Angle = (atan2( startx - centrex, starty - centrey ) * 1800 / M_PI ); arcStart_Angle = (atan2( aStartPointX - aCenterPos.x, aStartPointY - aCenterPos.y ) * 1800 / M_PI );
double radius = hypot( startx - centrex, starty - centrey ) + ( width / 2); double radius = hypot( aStartPointX - aCenterPos.x, aStartPointY - aCenterPos.y )
double hole = radius - width; + ( aWidth / 2);
double hole = radius - aWidth;
// Calculate the number of segments to approximate this arc // Calculate the number of segments to approximate this arc
int imax = (int) ( (double) arc_angle * slice / 3600.0 ); int imax = (int) ( (double) aArcAngle / ANGLE_INC(slice) );
if( imax < 0 ) if( imax < 0 )
imax = -imax; imax = -imax;
...@@ -1488,7 +1611,7 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex, ...@@ -1488,7 +1611,7 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex,
// Adjust delta_angle to have exactly imax segments in arc_angle // Adjust delta_angle to have exactly imax segments in arc_angle
// i.e. arc_angle = imax delta_agnle. // i.e. arc_angle = imax delta_agnle.
double delta_angle = (double) arc_angle / imax; double delta_angle = (double) aArcAngle / imax;
glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP );
...@@ -1499,39 +1622,100 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex, ...@@ -1499,39 +1622,100 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex,
double dx = hole; double dx = hole;
double dy = 0.0; double dy = 0.0;
RotatePoint( &dx, &dy, (int) angle ); RotatePoint( &dx, &dy, (int) angle );
glVertex3f( dx + startx, dy + starty, zpos ); glVertex3f( dx + aStartPointX, dy + aStartPointY, aCenterPos.z );
dx = radius; dx = radius;
dy = 0.0; dy = 0.0;
RotatePoint( &dx, &dy, (int) angle ); RotatePoint( &dx, &dy, (int) angle );
glVertex3f( dx + startx, dy + starty, zpos ); glVertex3f( dx + aStartPointX, dy + aStartPointY, aCenterPos.z );
} }
glEnd(); glEnd();
} }
static void Draw3D_CircleSegment( double startx, double starty, double endx, static void Draw3D_ThickCircle( const S3D_VERTEX& aCenterPos, double aRadius, double aWidth )
double endy, double width, double zpos )
{ {
const int slice = 36; double outer_radius = aRadius + ( aWidth / 2);
double x, y, hole, radius; double inner_radius = outer_radius - aWidth;
radius = hypot( startx - endx, starty - endy ) + ( width / 2); Draw3D_FilledCircleWithHole( aCenterPos, outer_radius, inner_radius );
hole = radius - width; }
glBegin( GL_QUAD_STRIP ); /*
* Function Draw3D_ZaxisOblongCylinder:
* draw a segment with an oblong hole.
* Used to draw oblong holes
*/
void Draw3D_ZaxisOblongCylinder( const S3D_VERTEX& aCenterPos,
double aEndx, double aEndy,
double aRadius, double aHeight )
{
const int slice = 16;
std::vector<S3D_VERTEX> coords;
for( int ii = 0; ii <= slice; ii++ ) coords.resize( 4 );
double tmp = DataScale3D;
DataScale3D = 1.0; // Coordinate is already in range for Set_Object_Data();
double dx = aEndx - aCenterPos.x;
double dy = aEndy - aCenterPos.y;
double angle = atan2( dy, dx ) * 1800 / M_PI;
dx = 0;
dy = aRadius;
// draws the first rectangle between half cylinders
RotatePoint( &dx, &dy, angle );
coords[0].x = coords[1].x = aCenterPos.x + dx;
coords[0].y = coords[1].y = aCenterPos.y - dy;
coords[2].x = coords[3].x = aEndx + dx;
coords[2].y = coords[3].y = aEndy - dy;
coords[0].z = coords[3].z = aCenterPos.z;
coords[1].z = coords[2].z = aCenterPos.z + aHeight;
Set_Object_Data( coords );
// Draw the first half cylinder
for( int ii = 1; ii <= slice/2; ii++ )
{ {
x = hole; y = 0.0; double ddx = dx;
RotatePoint( &x, &y, ii * 3600 / slice ); double ddy = -dy;
glVertex3f( x + startx, y + starty, zpos ); RotatePoint( &ddx, &ddy, -ii * ANGLE_INC(slice) );
x = radius; y = 0.0; coords[0].x = coords[2].x;
RotatePoint( &x, &y, ii * 3600 / slice ); coords[0].y = coords[2].y;
glVertex3f( x + startx, y + starty, zpos ); coords[1].x = coords[3].x;
coords[1].y = coords[3].y;
coords[2].x = coords[3].x = aEndx + ddx;
coords[2].y = coords[3].y = aEndy + ddy;
Set_Object_Data( coords );
} }
glEnd(); // draws the second rectangle between half cylinders
coords[0].x = coords[1].x = aEndx - dx;
coords[0].y = coords[1].y = aEndy + dy;
coords[2].x = coords[3].x = aCenterPos.x - dx;
coords[2].y = coords[3].y = aCenterPos.y + dy;
coords[0].z = coords[3].z = aCenterPos.z;
coords[1].z = coords[2].z = aCenterPos.z + aHeight;
Set_Object_Data( coords );
// Draw the second half cylinder
for( int ii = 1; ii <= slice/2; ii++ )
{
double ddx = -dx;
double ddy = dy;
RotatePoint( &ddx, &ddy, -ii * ANGLE_INC(slice) );
coords[0].x = coords[2].x;
coords[0].y = coords[2].y;
coords[1].x = coords[3].x;
coords[1].y = coords[3].y;
coords[2].x = coords[3].x = aCenterPos.x + ddx;
coords[2].y = coords[3].y = aCenterPos.y + ddy;
Set_Object_Data( coords );
}
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
DataScale3D = tmp;
} }
...@@ -1571,50 +1755,51 @@ void EDA_3D_CANVAS::Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double a ...@@ -1571,50 +1755,51 @@ void EDA_3D_CANVAS::Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double a
} }
static int Get3DLayerEnable( int act_layer ) bool Is3DLayerEnabled( int aLayer )
{ {
int i = -1; int flg = -1;
// see if layer needs to be shown // see if layer needs to be shown
// check the flags // check the flags
switch (act_layer) switch (aLayer)
{ {
case DRAW_N: case DRAW_N:
i=g_Parm_3D_Visu.FL_DRAWINGS; flg=g_Parm_3D_Visu.FL_DRAWINGS;
break; break;
case COMMENT_N: case COMMENT_N:
i=g_Parm_3D_Visu.FL_COMMENTS; flg=g_Parm_3D_Visu.FL_COMMENTS;
break; break;
case ECO1_N: case ECO1_N:
i=g_Parm_3D_Visu.FL_ECO1; flg=g_Parm_3D_Visu.FL_ECO1;
break; break;
case ECO2_N: case ECO2_N:
i=g_Parm_3D_Visu.FL_ECO2; flg=g_Parm_3D_Visu.FL_ECO2;
break; break;
} }
// the layer was not a layer with a flag, so show it // the layer was not a layer with a flag, so show it
if (i < 0) if( flg < 0 )
return true; return true;
// if the layer has a flag, return the flag // if the layer has a flag, return the flag
return g_Parm_3D_Visu.m_DrawFlags[i]; return g_Parm_3D_Visu.m_DrawFlags[flg];
} }
static GLfloat Get3DLayerSide( int act_layer ) GLfloat Get3DLayer_Z_Orientation( int aLayer )
{ {
GLfloat nZ; double nZ;
nZ = 1.0; nZ = 1.0;
if( ( act_layer <= LAST_COPPER_LAYER - 1 ) if( ( aLayer == LAYER_N_BACK )
|| ( act_layer == ADHESIVE_N_BACK ) || ( aLayer == ADHESIVE_N_BACK )
|| ( act_layer == SOLDERPASTE_N_BACK ) || ( aLayer == SOLDERPASTE_N_BACK )
|| ( act_layer == SILKSCREEN_N_BACK ) || ( aLayer == SILKSCREEN_N_BACK )
|| ( act_layer == SOLDERMASK_N_BACK ) ) || ( aLayer == SOLDERMASK_N_BACK ) )
nZ = -1.0; nZ = -1.0;
return nZ; return nZ;
} }
......
...@@ -431,7 +431,7 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event ) ...@@ -431,7 +431,7 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
*/ */
void EDA_3D_FRAME::Set3DBgColor() void EDA_3D_FRAME::Set3DBgColor()
{ {
S3D_Color color; S3D_COLOR color;
wxColour newcolor, oldcolor; wxColour newcolor, oldcolor;
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ), 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. * 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) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <3d_viewer.h> #include <3d_viewer.h>
// separator chars
static const char* sep_chars = " \t\n\r";
int S3D_MASTER::ReadData() int S3D_MASTER::ReadData()
{ {
...@@ -85,13 +87,13 @@ int S3D_MASTER::ReadData() ...@@ -85,13 +87,13 @@ int S3D_MASTER::ReadData()
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, sep_chars );
if( stricmp( text, "DEF" ) == 0 ) if( stricmp( text, "DEF" ) == 0 )
{ {
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, sep_chars );
if( text == NULL ) if( text == NULL )
continue; continue;
...@@ -119,8 +121,8 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum ) ...@@ -119,8 +121,8 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
wxString mat_name; wxString mat_name;
S3D_MATERIAL* material = NULL; S3D_MATERIAL* material = NULL;
command = strtok( NULL, " \t\n\r" ); command = strtok( NULL, sep_chars );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
mat_name = FROM_UTF8( text ); mat_name = FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 ) if( stricmp( command, "USE" ) == 0 )
...@@ -134,7 +136,7 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum ) ...@@ -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; return 0;
} }
...@@ -146,7 +148,7 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum ) ...@@ -146,7 +148,7 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, sep_chars );
if( text == NULL ) if( text == NULL )
continue; continue;
...@@ -159,44 +161,44 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum ) ...@@ -159,44 +161,44 @@ int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum )
if( stricmp( text, "diffuseColor" ) == 0 ) if( stricmp( text, "diffuseColor" ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_DiffuseColor.x = atof( text ); material->m_DiffuseColor.x = atof( text );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_DiffuseColor.y = atof( text ); material->m_DiffuseColor.y = atof( text );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_DiffuseColor.z = atof( text ); material->m_DiffuseColor.z = atof( text );
} }
else if( stricmp( text, "emissiveColor" ) == 0 ) else if( stricmp( text, "emissiveColor" ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_EmissiveColor.x = atof( text ); material->m_EmissiveColor.x = atof( text );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_EmissiveColor.y = atof( text ); material->m_EmissiveColor.y = atof( text );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_EmissiveColor.z = atof( text ); material->m_EmissiveColor.z = atof( text );
} }
else if( strnicmp( text, "specularColor", 13 ) == 0 ) else if( strnicmp( text, "specularColor", 13 ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_SpecularColor.x = atof( text ); material->m_SpecularColor.x = atof( text );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_SpecularColor.y = atof( text ); material->m_SpecularColor.y = atof( text );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_SpecularColor.z = atof( text ); material->m_SpecularColor.z = atof( text );
} }
else if( strnicmp( text, "ambientIntensity", 16 ) == 0 ) else if( strnicmp( text, "ambientIntensity", 16 ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_AmbientIntensity = atof( text ); material->m_AmbientIntensity = atof( text );
} }
else if( strnicmp( text, "transparency", 12 ) == 0 ) else if( strnicmp( text, "transparency", 12 ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_Transparency = atof( text ); material->m_Transparency = atof( text );
} }
else if( strnicmp( text, "shininess", 9 ) == 0 ) else if( strnicmp( text, "shininess", 9 ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, sep_chars );
material->m_Shininess = atof( text ); material->m_Shininess = atof( text );
} }
} }
...@@ -212,7 +214,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum ) ...@@ -212,7 +214,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, sep_chars );
if( *text == ']' ) if( *text == ']' )
return 0; return 0;
...@@ -226,7 +228,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum ) ...@@ -226,7 +228,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
} }
else else
{ {
printf( "ReadChildren error line %d <%s> \n", *LineNum, text ); D( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) );
break; break;
} }
} }
...@@ -242,7 +244,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum ) ...@@ -242,7 +244,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, sep_chars );
if( *text == '}' ) if( *text == '}' )
{ {
...@@ -260,7 +262,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum ) ...@@ -260,7 +262,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
} }
else else
{ {
printf( "ReadShape error line %d <%s> \n", *LineNum, text ); D( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) );
break; break;
} }
} }
...@@ -276,7 +278,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) ...@@ -276,7 +278,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, sep_chars );
if( *text == '}' ) if( *text == '}' )
{ {
...@@ -289,7 +291,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) ...@@ -289,7 +291,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
} }
else else
{ {
printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ); D( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) );
break; break;
} }
} }
...@@ -402,7 +404,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -402,7 +404,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
strcpy( buffer, line ); strcpy( buffer, line );
text = strtok( buffer, " \t\n\r" ); text = strtok( buffer, sep_chars );
if( *text == '}' ) if( *text == '}' )
{ {
...@@ -507,7 +509,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -507,7 +509,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
} }
std::vector< int > coordIndex; std::vector< int > coordIndex;
std::vector< S3D_Vertex > vertices; std::vector< S3D_VERTEX > vertices;
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
...@@ -535,7 +537,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -535,7 +537,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
break; break;
} }
S3D_Vertex vertex; S3D_VERTEX vertex;
vertex.x = points[kk]; vertex.x = points[kk];
vertex.y = points[kk + 1]; vertex.y = points[kk + 1];
vertex.z = points[kk + 2]; vertex.z = points[kk + 2];
...@@ -572,7 +574,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -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]; char line[512];
......
...@@ -41,32 +41,21 @@ ...@@ -41,32 +41,21 @@
class S3D_MASTER; 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*/ /* S3D_VERTEX manages a 3D coordinate (3 float numbers: x,y,z coordinates)*/
{ class S3D_VERTEX
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
{ {
public: public:
double x, y, z; double x, y, z;
public: public:
S3D_Vertex() S3D_VERTEX()
{ {
x = y = z = 0.0; x = y = z = 0.0;
} }
S3D_Vertex( double px, double py, double pz) S3D_VERTEX( double px, double py, double pz)
{ {
x = px; x = px;
y = py; y = py;
...@@ -78,9 +67,9 @@ class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/ ...@@ -78,9 +67,9 @@ class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/
{ {
public: public:
wxString m_Name; wxString m_Name;
S3D_Vertex m_DiffuseColor; S3D_VERTEX m_DiffuseColor;
S3D_Vertex m_EmissiveColor; S3D_VERTEX m_EmissiveColor;
S3D_Vertex m_SpecularColor; S3D_VERTEX m_SpecularColor;
float m_AmbientIntensity; float m_AmbientIntensity;
float m_Transparency; float m_Transparency;
float m_Shininess; float m_Shininess;
...@@ -104,10 +93,10 @@ class S3D_MASTER : public EDA_ITEM ...@@ -104,10 +93,10 @@ class S3D_MASTER : public EDA_ITEM
{ {
public: public:
wxString m_Shape3DName; /* 3D shape name in 3D library */ wxString m_Shape3DName; /* 3D shape name in 3D library */
S3D_Vertex m_MatScale; S3D_VERTEX m_MatScale;
S3D_Vertex m_MatRotation; S3D_VERTEX m_MatRotation;
S3D_Vertex m_MatPosition; S3D_VERTEX m_MatPosition;
Struct3D_Shape* m_3D_Drawings; STRUCT_3D_SHAPE* m_3D_Drawings;
S3D_MATERIAL* m_Materials; S3D_MATERIAL* m_Materials;
public: public:
...@@ -146,7 +135,7 @@ public: ...@@ -146,7 +135,7 @@ public:
int ReadShape( FILE* file, int* LineNum ); int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum ); int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( 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) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
...@@ -155,19 +144,19 @@ public: ...@@ -155,19 +144,19 @@ public:
/* Describes a complex 3D */ /* Describes a complex 3D */
class Struct3D_Shape : public EDA_ITEM class STRUCT_3D_SHAPE : public EDA_ITEM
{ {
public: public:
S3D_Vertex* m_3D_Coord; S3D_VERTEX* m_3D_Coord;
int* m_3D_CoordIndex; int* m_3D_CoordIndex;
int m_3D_Points; int m_3D_Points;
public: public:
Struct3D_Shape( EDA_ITEM* aParent ); STRUCT_3D_SHAPE( EDA_ITEM* aParent );
~Struct3D_Shape(); ~STRUCT_3D_SHAPE();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; } STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
Struct3D_Shape* Back() const { return (Struct3D_Shape*) Pback; } STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }
int ReadData( FILE* file, int* LineNum ); int ReadData( FILE* file, int* LineNum );
...@@ -197,8 +186,8 @@ public: ...@@ -197,8 +186,8 @@ public:
* Function GetValue * Function GetValue
* @return the vertex in internal units. * @return the vertex in internal units.
*/ */
S3D_Vertex GetValue(); S3D_VERTEX GetValue();
void SetValue( S3D_Vertex vertex ); void SetValue( S3D_VERTEX vertex );
void Enable( bool enbl ); void Enable( bool enbl );
void SetToolTip( const wxString& text ); void SetToolTip( const wxString& text );
}; };
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -63,10 +63,8 @@ class ZONE_CONTAINER; ...@@ -63,10 +63,8 @@ class ZONE_CONTAINER;
#define LIB3D_PATH wxT( "packages3d" ) #define LIB3D_PATH wxT( "packages3d" )
class EDA_3D_CANVAS;
class EDA_3D_FRAME; class EDA_3D_FRAME;
class S3D_Vertex; class S3D_VERTEX;
class SEGVIA; class SEGVIA;
...@@ -126,11 +124,37 @@ public: ...@@ -126,11 +124,37 @@ public:
void DrawGrid( double aGriSizeMM ); 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 * Function Draw3D_SolidPolygonsInZones
* draw all solid polygons used as filled areas in a zone * 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 * @param aZone = the zone to draw
*/ */
void Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ); void Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone );
...@@ -143,13 +167,6 @@ public: ...@@ -143,13 +167,6 @@ public:
*/ */
void Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double aZpos ); 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 * Function Draw3D_DrawText
* draws 3D segments to create text objects. * draws 3D segments to create text objects.
...@@ -242,6 +259,6 @@ private: ...@@ -242,6 +259,6 @@ private:
}; };
void SetGLColor( int color ); 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__ */ #endif /* __3D_VIEWER_H__ */
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#ifndef __INFO3D_VISU_H__ #ifndef __INFO3D_VISU_H__
#define __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 #include <layers_id_colors_and_visibility.h> // Layers id definitions
#if !wxUSE_GLCANVAS #if !wxUSE_GLCANVAS
...@@ -51,44 +51,52 @@ ...@@ -51,44 +51,52 @@
#include <3d_struct.h> #include <3d_struct.h>
#define m_ROTX m_Rot[0] #define m_ROTX m_Rot[0]
#define m_ROTY m_Rot[1] #define m_ROTY m_Rot[1]
#define m_ROTZ m_Rot[2] #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 */ /* information needed to display 3D board */
class INFO3D_VISU class INFO3D_VISU
{ {
public: public:
enum DISPLAY3D_FLG enum DISPLAY3D_FLG {
{ FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_AXIS=0, FL_MODULE, FL_ZONE, FL_COMMENTS, FL_DRAWINGS, FL_ECO1, FL_ECO2,
FL_COMMENTS, FL_DRAWINGS, FL_ECO1, FL_ECO2,
FL_GRID, FL_GRID,
FL_LAST FL_LAST
}; };
double m_Beginx, m_Beginy; // position of mouse double m_Beginx, m_Beginy; // position of mouse
double m_Quat[4]; // orientation of object double m_Quat[4]; // orientation of object
double m_Rot[4]; // man rotation of object double m_Rot[4]; // man rotation of object
double m_Zoom; // field of view in degrees double m_Zoom; // field of view in degrees
double m_3D_Grid; // 3D grid valmue, in mm 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 bool m_DrawFlags[FL_LAST]; // show these special items
wxPoint m_BoardPos; wxPoint m_BoardPos;
wxSize m_BoardSize; wxSize m_BoardSize;
int m_CopperLayersCount; // Number of copper layers actually used by the board int m_CopperLayersCount; // Number of copper layers actually used by the board
const BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design settings const BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design settings
double m_EpoxyThickness; // Epoxy thickness (normalized) double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness 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_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(); public: INFO3D_VISU();
~INFO3D_VISU(); ~INFO3D_VISU();
}; };
...@@ -96,4 +104,4 @@ public: INFO3D_VISU(); ...@@ -96,4 +104,4 @@ public: INFO3D_VISU();
extern INFO3D_VISU g_Parm_3D_Visu; extern INFO3D_VISU g_Parm_3D_Visu;
extern double DataScale3D; // 3D scale units. extern double DataScale3D; // 3D scale units.
#endif /* __INFO3D_VISU_H__ */ #endif /* __INFO3D_VISU_H__ */
...@@ -10,25 +10,7 @@ include_directories( ...@@ -10,25 +10,7 @@ include_directories(
${INC_AFTER} ${INC_AFTER}
) )
set(EESCHEMA_SRCS set(EESCHEMA_DLGS
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
dialogs/dialog_color_config.cpp dialogs/dialog_color_config.cpp
dialogs/dialog_plot_schematic_DXF.cpp dialogs/dialog_plot_schematic_DXF.cpp
dialogs/dialog_plot_schematic_DXF_base.cpp dialogs/dialog_plot_schematic_DXF_base.cpp
...@@ -67,6 +49,7 @@ set(EESCHEMA_SRCS ...@@ -67,6 +49,7 @@ set(EESCHEMA_SRCS
dialogs/dialog_lib_edit_pin_base.cpp dialogs/dialog_lib_edit_pin_base.cpp
dialogs/dialog_lib_new_component.cpp dialogs/dialog_lib_new_component.cpp
dialogs/dialog_lib_new_component_base.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_base.cpp
dialogs/dialog_print_using_printer.cpp dialogs/dialog_print_using_printer.cpp
dialogs/dialog_sch_edit_sheet_pin.cpp dialogs/dialog_sch_edit_sheet_pin.cpp
...@@ -77,6 +60,28 @@ set(EESCHEMA_SRCS ...@@ -77,6 +60,28 @@ set(EESCHEMA_SRCS
dialogs/dialog_schematic_find_base.cpp dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_SVG_print.cpp dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.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_component_in_schematic.cpp
edit_bitmap.cpp edit_bitmap.cpp
edit_label.cpp edit_label.cpp
......
...@@ -204,6 +204,10 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -204,6 +204,10 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) ) if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false; 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 ) if( snapToGrid )
pos = screen->GetNearestGridPosition( pos ); pos = screen->GetNearestGridPosition( pos );
...@@ -298,6 +302,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -298,6 +302,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) ) if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false; 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 ) if( snapToGrid )
pos = screen->GetNearestGridPosition( pos ); pos = screen->GetNearestGridPosition( pos );
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2012 jean-pierre Charras <jean-pierre.charras@ujf-grenoble.fr>
* Copyright (C) 1992-2011 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption") #define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
#define KEY_ANNOTATE_ALGO_OPTION wxT("AnnotateAlgoOption") #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 ) DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
...@@ -92,6 +94,14 @@ void DIALOG_ANNOTATE::InitValues() ...@@ -92,6 +94,14 @@ void DIALOG_ANNOTATE::InitValues()
m_rbStartSheetNumLarge->SetValue(1); m_rbStartSheetNumLarge->SetValue(1);
break; 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 ) ); annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) );
...@@ -112,10 +122,19 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) ...@@ -112,10 +122,19 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
{ {
m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder()); m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder());
m_Config->Write(KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo()); 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() ) if( GetResetItems() )
{
message = _( "Clear and annotate all of the components " ); message = _( "Clear and annotate all of the components " );
promptUser = true;
}
else else
message = _( "Annotate only the unannotated components " ); message = _( "Annotate only the unannotated components " );
...@@ -125,10 +144,14 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) ...@@ -125,10 +144,14 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
message += _( "on the current sheet?" ); message += _( "on the current sheet?" );
message += _( "\n\nThis operation will change the current annotation and cannot be undone." ); message += _( "\n\nThis operation will change the current annotation and cannot be undone." );
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL) if( promptUser )
return; {
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL)
return;
}
m_Parent->AnnotateComponents( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(), m_Parent->AnnotateComponents( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(),
(ANNOTATE_OPTION_T) GetAnnotateAlgo(), (ANNOTATE_OPTION_T) GetAnnotateAlgo(),
...@@ -136,6 +159,17 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) ...@@ -136,6 +159,17 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
m_Parent->GetCanvas()->Refresh(); m_Parent->GetCanvas()->Refresh();
m_btnClear->Enable(); 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. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -45,6 +45,7 @@ public: ...@@ -45,6 +45,7 @@ public:
DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ); DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent );
~DIALOG_ANNOTATE(){}; ~DIALOG_ANNOTATE(){};
private:
/// Initialises member variables /// Initialises member variables
void InitValues(); void InitValues();
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
...@@ -56,6 +57,14 @@ public: ...@@ -56,6 +57,14 @@ public:
bool GetResetItems( void ); bool GetResetItems( void );
int GetSortOrder( void ); int GetSortOrder( void );
int GetAnnotateAlgo( void ); int GetAnnotateAlgo( void );
bool GetAnnotateAutoCloseOpt()
{
return m_cbAutoCloseDlg->GetValue();
}
bool GetAnnotateSilentMode()
{
return m_cbUseSilentMode->GetValue();
}
}; };
#endif #endif
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -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 ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -43,6 +43,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -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 ); m_rbResetAnnotation = new wxRadioButton( this, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 );
bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 3 ); bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 3 );
bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT|wxALIGN_RIGHT, 25 ); bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT|wxALIGN_RIGHT, 25 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); 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 ...@@ -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 ); 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 ); bSizerXpos->Add( annotate_down_right_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 12 );
b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 ); b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerYpos; wxBoxSizer* bSizerYpos;
...@@ -83,8 +85,10 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -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 ); 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 ); bSizerYpos->Add( annotate_right_down_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 ); b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 );
bupperSizer->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 25 ); bupperSizer->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 25 );
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); 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 ...@@ -111,6 +115,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bSizerChoiceInc->Add( 0, 0, 1, wxEXPAND, 5 ); bSizerChoiceInc->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceInc, 0, wxEXPAND|wxRIGHT, 5 ); bSizer1AlgoChoice->Add( bSizerChoiceInc, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerChoiceIncBySheet; wxBoxSizer* bSizerChoiceIncBySheet;
...@@ -122,6 +127,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -122,6 +127,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bSizerChoiceIncBySheet->Add( 0, 0, 1, wxEXPAND, 5 ); bSizerChoiceIncBySheet->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceIncBySheet, 1, wxEXPAND, 5 ); bSizer1AlgoChoice->Add( bSizerChoiceIncBySheet, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerChoiceIncBySheetLarge; wxBoxSizer* bSizerChoiceIncBySheetLarge;
...@@ -133,15 +139,63 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -133,15 +139,63 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bSizerChoiceIncBySheetLarge->Add( 0, 0, 1, wxEXPAND, 5 ); bSizerChoiceIncBySheetLarge->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceIncBySheetLarge, 1, wxEXPAND, 5 ); bSizer1AlgoChoice->Add( bSizerChoiceIncBySheetLarge, 1, wxEXPAND, 5 );
bSizerAnnotAlgo->Add( bSizer1AlgoChoice, 1, wxEXPAND|wxLEFT, 25 ); bSizerAnnotAlgo->Add( bSizer1AlgoChoice, 1, wxEXPAND|wxLEFT, 25 );
bupperSizer->Add( bSizerAnnotAlgo, 0, wxEXPAND|wxRIGHT, 5 ); bupperSizer->Add( bSizerAnnotAlgo, 0, wxEXPAND|wxRIGHT, 5 );
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bupperSizer->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 ); 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; wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
...@@ -154,10 +208,13 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -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 ); m_btnApply = new wxButton( this, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 ); bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 6 ); bupperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 6 );
bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 ); bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 );
this->SetSizer( bmainSizer ); this->SetSizer( bmainSizer );
this->Layout(); 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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_annotate_base__ #ifndef __DIALOG_ANNOTATE_BASE_H__
#define __dialog_annotate_base__ #define __DIALOG_ANNOTATE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -23,6 +25,7 @@ ...@@ -23,6 +25,7 @@
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -39,7 +42,7 @@ ...@@ -39,7 +42,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ANNOTATE_BASE /// Class DIALOG_ANNOTATE_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_ANNOTATE_BASE : public wxDialog class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM
{ {
private: private:
...@@ -53,20 +56,19 @@ class DIALOG_ANNOTATE_BASE : public wxDialog ...@@ -53,20 +56,19 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
wxStaticLine* m_staticline2; wxStaticLine* m_staticline2;
wxStaticText* m_staticTextOrder; wxStaticText* m_staticTextOrder;
wxRadioButton* m_rbSortBy_X_Position; wxRadioButton* m_rbSortBy_X_Position;
wxStaticBitmap* annotate_down_right_bitmap; wxStaticBitmap* annotate_down_right_bitmap;
wxRadioButton* m_rbSortBy_Y_Position; wxRadioButton* m_rbSortBy_Y_Position;
wxStaticBitmap* annotate_right_down_bitmap; wxStaticBitmap* annotate_right_down_bitmap;
wxStaticLine* m_staticline5; wxStaticLine* m_staticline5;
wxStaticText* m_staticTextAnnotateAlgo; wxStaticText* m_staticTextAnnotateAlgo;
wxRadioButton* m_rbUseIncremental; wxRadioButton* m_rbUseIncremental;
wxRadioButton* m_rbUseSheetNum; wxRadioButton* m_rbUseSheetNum;
wxRadioButton* m_rbStartSheetNumLarge; wxRadioButton* m_rbStartSheetNumLarge;
wxStaticLine* m_staticline4; wxStaticLine* m_staticline4;
wxStaticText* m_staticTextDlgOpts;
wxCheckBox* m_cbAutoCloseDlg;
wxCheckBox* m_cbUseSilentMode;
wxStaticLine* m_staticline41;
wxButton* m_btnClose; wxButton* m_btnClose;
wxButton* m_btnClear; wxButton* m_btnClear;
wxButton* m_btnApply; wxButton* m_btnApply;
...@@ -79,9 +81,9 @@ class DIALOG_ANNOTATE_BASE : public wxDialog ...@@ -79,9 +81,9 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
public: 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(); ~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 ...@@ -248,7 +248,9 @@ enum id_eeschema_frm
ID_LIBVIEW_LIBWINDOW, ID_LIBVIEW_LIBWINDOW,
ID_LIBVIEW_CMPWINDOW, ID_LIBVIEW_CMPWINDOW,
ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
ID_SET_RELATIVE_OFFSET ID_SET_RELATIVE_OFFSET,
ID_END_EESCHEMA_ID_LIST
}; };
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -54,6 +54,15 @@ ...@@ -54,6 +54,15 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#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: //Imported function:
int TestDuplicateSheetNames( bool aCreateMarker ); int TestDuplicateSheetNames( bool aCreateMarker );
...@@ -61,44 +70,14 @@ int TestDuplicateSheetNames( bool aCreateMarker ); ...@@ -61,44 +70,14 @@ int TestDuplicateSheetNames( bool aCreateMarker );
// ID for configuration: // ID for configuration:
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" ) #define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" ) #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, NETLIST_DIALOG_BASE )
}
BEGIN_EVENT_TABLE( NETLIST_DIALOG, wxDialog )
EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG::OnCancelClick )
EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG::GenNetlist ) 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, EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
NETLIST_DIALOG::SelectNetlistType ) NETLIST_DIALOG::SelectDefaultNetlistType )
EVT_CHECKBOX( ID_ADD_SUBCIRCUIT_PREFIX, EVT_CHECKBOX( ID_ADD_SUBCIRCUIT_PREFIX,
NETLIST_DIALOG::EnableSubcircuitPrefix ) NETLIST_DIALOG::EnableSubcircuitPrefix )
EVT_BUTTON( ID_RUN_SIMULATOR, NETLIST_DIALOG::RunSimulator ) EVT_BUTTON( ID_RUN_SIMULATOR, NETLIST_DIALOG::RunSimulator )
...@@ -115,9 +94,7 @@ END_EVENT_TABLE() ...@@ -115,9 +94,7 @@ END_EVENT_TABLE()
*/ */
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
const wxString& title, const wxString& title,
int id_NetType, NETLIST_TYPE_ID id_NetType ) :
int idCheckBox,
int idCreateFile ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN ) wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN )
{ {
m_IdNetType = id_NetType; m_IdNetType = id_NetType;
...@@ -162,15 +139,13 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, ...@@ -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_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
UpperBoxSizer->Add( m_RightOptionsBoxSizer, 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_IsCurrentFormat = new wxCheckBox( this, ID_CURRENT_FORMAT_IS_DEFAULT,
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 ); _( "Default format" ) );
m_IsCurrentFormat->SetValue( selected ); m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
} m_IsCurrentFormat->SetValue( selected );
if( id_NetType == NET_TYPE_PCBNEW ) if( id_NetType == NET_TYPE_PCBNEW )
{ {
...@@ -182,39 +157,6 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, ...@@ -182,39 +157,6 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_NetOption->SetSelection( fmtOption ); m_NetOption->SetSelection( fmtOption );
m_LeftBoxSizer->Add( m_NetOption, 0, wxGROW | wxALL, 5 ); 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() const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
...@@ -232,53 +174,39 @@ const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName() ...@@ -232,53 +174,39 @@ const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition, NETLIST_DIALOG_BASE( parent )
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{ {
int ii;
m_Parent = parent; 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(); 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; 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 notebook pages:
// Add Panel FORMAT PCBNEW // Add Panel FORMAT PCBNEW
m_PanelNetType[PANELPCBNEW] = m_PanelNetType[PANELPCBNEW] =
new NETLIST_PAGE_DIALOG( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Pcbnew" ),
wxT( "Pcbnew" ), NET_TYPE_PCBNEW );
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
// Add Panel FORMAT ORCADPCB2 // Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] = m_PanelNetType[PANELORCADPCB2] =
new NETLIST_PAGE_DIALOG( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
wxT( "OrcadPCB2" ), NET_TYPE_ORCADPCB2 );
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
// Add Panel FORMAT CADSTAR // Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] = m_PanelNetType[PANELCADSTAR] =
new NETLIST_PAGE_DIALOG( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
wxT( "CadStar" ), NET_TYPE_CADSTAR );
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
// Add Panel spice // Add Panel spice
InstallPageSpice(); InstallPageSpice();
...@@ -286,13 +214,38 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : ...@@ -286,13 +214,38 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
// Add custom panels: // Add custom panels:
InstallCustomPages(); InstallCustomPages();
// GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); 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() void NETLIST_DIALOG::InstallPageSpice()
{ {
wxButton* Button; wxButton* Button;
...@@ -300,15 +253,8 @@ void NETLIST_DIALOG::InstallPageSpice() ...@@ -300,15 +253,8 @@ void NETLIST_DIALOG::InstallPageSpice()
wxString title = wxT( "Spice" ); wxString title = wxT( "Spice" );
page = m_PanelNetType[PANELSPICE] = page = m_PanelNetType[PANELSPICE] =
new NETLIST_PAGE_DIALOG( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook, title, NET_TYPE_SPICE );
title,
NET_TYPE_SPICE,
0, 0 );
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, page->m_AddSubPrefix = new wxCheckBox( page, ID_ADD_SUBCIRCUIT_PREFIX,
_( "Prefix references 'U' and 'IC' with 'X'" ) ); _( "Prefix references 'U' and 'IC' with 'X'" ) );
...@@ -340,15 +286,8 @@ void NETLIST_DIALOG::InstallPageSpice() ...@@ -340,15 +286,8 @@ void NETLIST_DIALOG::InstallPageSpice()
5 ); 5 );
// Add buttons // 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" ) ); Button = new wxButton( page, ID_RUN_SIMULATOR, _( "&Run Simulator" ) );
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); 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() ...@@ -356,147 +295,109 @@ void NETLIST_DIALOG::InstallPageSpice()
*/ */
void NETLIST_DIALOG::InstallCustomPages() void NETLIST_DIALOG::InstallCustomPages()
{ {
int ii, CustomCount; int ii;
wxString title, previoustitle, msg; wxString title, msg;
NETLIST_PAGE_DIALOG* CurrPage; 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 ); title = ReturnUserNetlistTypeName( ii == 0 ? true : false );
if( title.IsEmpty() && previoustitle.IsEmpty() )
break; // No more panel to install
/* Install the panel "Add Plugin" after
* the last initialized panel */
previoustitle = title;
if( title.IsEmpty() ) if( title.IsEmpty() )
CurrPage = break; // No more panel to install
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 = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; 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, currPage = AddOneCustomPage( title, command,
-1, _( "Title:" ) ), 0, (NETLIST_TYPE_ID)(NET_TYPE_CUSTOM1 + ii) );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); m_PanelNetType[PANELCUSTOMBASE + ii] = currPage;
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 );
} }
} }
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
/* const wxString & aCommandString,
* Browse plugin files, add a new panel NETLIST_TYPE_ID aNetTypeId )
* and set m_CommandStringCtrl field
*/
void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
{ {
wxString FullFileName, Mask, Path; NETLIST_PAGE_DIALOG* currPage;
Mask = wxT( "*" ); currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
Path = wxGetApp().GetExecutablePath();
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path,
FullFileName,
wxEmptyString,
Mask,
this,
wxFD_OPEN,
true
);
if( FullFileName.IsEmpty() )
return;
NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL ) currPage->m_LowBoxSizer->Add( new wxStaticText( currPage,
return; -1, _( "Netlist command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
// Creates a default command line, suitable for external tool xslproc: currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
// try to build a default command line depending on plugin extension wxDefaultPosition, wxDefaultSize );
wxString cmdLine;
wxFileName fn( FullFileName );
wxString ext = fn.GetExt();
if( ext == wxT("xsl" ) ) currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) ); currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl,
else if( ext == wxT("exe" ) || ext.IsEmpty() ) 0,
cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) ); wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
else 5 );
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
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 */ currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
wxString title = CurrPage->m_TitleStringCtrl->GetValue(); wxDefaultPosition, wxDefaultSize );
if( title.IsEmpty() ) currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
DisplayInfoMessage( this, currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl,
_( "Do not forget to choose a title for this netlist control page" ) ); 0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
return currPage;
} }
/* Called when the check box "default format" is clicked /* Called when the check box "default format" is clicked
*/ */
void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event ) void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
{ {
int ii; int ii;
NETLIST_PAGE_DIALOG* CurrPage; NETLIST_PAGE_DIALOG* currPage;
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ ) for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
if( m_PanelNetType[ii] ) if( m_PanelNetType[ii] )
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( false ); 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; return;
m_Parent->SetNetListFormatName( CurrPage->GetPageNetFmtName() ); m_Parent->SetNetListFormatName( currPage->GetPageNetFmtName() );
CurrPage->m_IsCurrentFormat->SetValue( true ); 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 /* Called when the check box m_AddSubPrefix
* "default format" is clicked * "default format" is clicked
...@@ -505,14 +406,14 @@ void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event ) ...@@ -505,14 +406,14 @@ void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
void NETLIST_DIALOG::EnableSubcircuitPrefix( 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; return;
m_Parent->SetAddReferencePrefix( CurrPage->m_AddSubPrefix->IsChecked() ); m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
} }
void NETLIST_DIALOG::NetlistUpdateOpt() void NETLIST_DIALOG::NetlistUpdateOpt()
...@@ -553,72 +454,118 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) ...@@ -553,72 +454,118 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
NetlistUpdateOpt(); NetlistUpdateOpt();
NETLIST_PAGE_DIALOG* CurrPage; NETLIST_PAGE_DIALOG* currPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
unsigned netlist_opt = 0; unsigned netlist_opt = 0;
/* Calculate the netlist filename */ /* Calculate the netlist filename */
fn = g_RootSheet->GetScreen()->GetFileName(); 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: case NET_TYPE_SPICE:
fileExt = wxT( "cir" );
fileWildcard = _( "SPICE netlist file (.cir)|*.cir" );
// Set spice netlist options: // Set spice netlist options:
if( g_OptNetListUseNames ) if( g_OptNetListUseNames )
netlist_opt |= NET_USE_NETNAMES; netlist_opt |= NET_USE_NETNAMES;
if( CurrPage->m_AddSubPrefix->GetValue() ) if( currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX; netlist_opt |= NET_USE_X_PREFIX;
break; break;
case NET_TYPE_CADSTAR: case NET_TYPE_CADSTAR:
fileExt = wxT( "frp" );
fileWildcard = _( "CadStar netlist file (.frp)|*.frp" );
break; break;
case NET_TYPE_PCBNEW: case NET_TYPE_PCBNEW:
if( CurrPage->m_NetOption->GetSelection() != 0 ) if( currPage->m_NetOption->GetSelection() != 0 )
netlist_opt = NET_PCBNEW_USE_NEW_FORMAT; netlist_opt = NET_PCBNEW_USE_NEW_FORMAT;
fileExt = NetlistFileExtension;
fileWildcard = NetlistFileWildcard;
break; break;
case NET_TYPE_ORCADPCB2: case NET_TYPE_ORCADPCB2:
fileExt = NetlistFileExtension;
fileWildcard = NetlistFileWildcard;
break; break;
default: // custom, NET_TYPE_CUSTOM1 and greater default: // custom, NET_TYPE_CUSTOM1 and greater
fileExt = wxEmptyString; title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() );
fileWildcard = AllFilesWildcard;
title.Printf( _( "%s Export" ), CurrPage->m_TitleStringCtrl->GetValue().GetData() );
} }
fn.SetExt( fileExt ); fn.SetExt( fileExt );
wxString fullfilname = fn.GetFullName();
wxFileDialog dlg( this, title, fn.GetPath(), if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
fn.GetFullName(), fileWildcard, {
wxFD_SAVE ); wxFileDialog dlg( this, title, fn.GetPath(),
fullfilname, fileWildcard,
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
fullfilname = dlg.GetPath();
}
m_Parent->ClearMsgPanel(); m_Parent->ClearMsgPanel();
if( CurrPage->m_CommandStringCtrl ) if( currPage->m_CommandStringCtrl )
m_Parent->SetNetListerCommand( CurrPage->m_CommandStringCtrl->GetValue() ); m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
else else
m_Parent->SetNetListerCommand( wxEmptyString ); m_Parent->SetNetListerCommand( wxEmptyString );
m_Parent->CreateNetlist( CurrPage->m_IdNetType, dlg.GetPath(), netlist_opt ); m_Parent->CreateNetlist( currPage->m_IdNetType, fullfilname, netlist_opt );
WriteCurrentNetlistSetup(); WriteCurrentNetlistSetup();
EndModal( NET_OK ); 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" );
break;
case NET_TYPE_CADSTAR:
fileExt = wxT( "frp" );
fileWildcard = _( "CadStar netlist file (.frp)|*.frp" );
break;
case NET_TYPE_PCBNEW:
case NET_TYPE_ORCADPCB2:
fileExt = NetlistFileExtension;
fileWildcard = NetlistFileWildcard;
break;
default: // custom, NET_TYPE_CUSTOM1 and greater
fileWildcard = AllFilesWildcard;
ret = false;
}
if( aExt )
*aExt = fileExt;
if( aWildCard )
*aWildCard = fileWildcard;
return ret;
}
/* Function CreateNetlist /* Function CreateNetlist
* > test for some issues (missing or duplicate references and sheet names) * > test for some issues (missing or duplicate references and sheet names)
...@@ -670,7 +617,7 @@ Do you want to annotate schematic?" ) ) ) ...@@ -670,7 +617,7 @@ Do you want to annotate schematic?" ) ) )
void NETLIST_DIALOG::OnCancelClick( wxCommandEvent& event ) void NETLIST_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( NET_ABORT ); EndModal( wxID_CANCEL );
} }
...@@ -691,19 +638,19 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) ...@@ -691,19 +638,19 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
fn.SetExt( wxT( "cir" ) ); fn.SetExt( wxT( "cir" ) );
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" ); CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
NETLIST_PAGE_DIALOG* CurrPage; NETLIST_PAGE_DIALOG* currPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
g_OptNetListUseNames = CurrPage->m_NetOption->GetSelection() == 0; g_OptNetListUseNames = currPage->m_NetOption->GetSelection() == 0;
// Set spice netlist options: // Set spice netlist options:
unsigned netlist_opt = 0; unsigned netlist_opt = 0;
if( g_OptNetListUseNames ) if( g_OptNetListUseNames )
netlist_opt |= NET_USE_NETNAMES; 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; 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 ) ) netlist_opt ) )
return; return;
...@@ -718,59 +665,60 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) ...@@ -718,59 +665,60 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
{ {
wxString msg, Command; wxString msg, Command;
wxConfig* config = wxGetApp().GetSettings();
NetlistUpdateOpt(); NetlistUpdateOpt();
m_Config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() );
// Update the new titles // Update the new titles
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ ) 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; break;
msg = wxT( "Custom" ); msg = wxT( "Custom" );
msg << ii + 1; msg << ii + 1;
if( CurrPage->m_TitleStringCtrl ) if( currPage->m_TitleStringCtrl )
{ {
wxString title = CurrPage->m_TitleStringCtrl->GetValue(); wxString title = currPage->m_TitleStringCtrl->GetValue();
CurrPage->SetPageNetFmtName( title ); currPage->SetPageNetFmtName( title );
if( msg != title ) // Title has changed, Update config if( msg != title ) // Title has changed, Update config
{ {
msg = CUSTOM_NETLIST_TITLE; msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1; 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 = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
config->Write( msg, Command ); m_Config->Write( msg, Command );
} }
} }
} }
/** /**
* Function DeletePluginPanel * Function OnDelPlugin
* Remove a panel relative to a netlist plugin * 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_CommandStringCtrl->SetValue( wxEmptyString );
CurrPage->m_TitleStringCtrl->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 ); m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
} }
...@@ -778,27 +726,119 @@ void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event ) ...@@ -778,27 +726,119 @@ void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event )
EndModal( NET_PLUGIN_CHANGE ); EndModal( NET_PLUGIN_CHANGE );
} }
/** /**
* Function ValidatePluginPanel * Function OnAddPlugin
* Validate the panel info relative to a new netlist plugin * Add a new panel for a new netlist plugin
*/ */
void NETLIST_DIALOG::ValidatePluginPanel( wxCommandEvent& event ) void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
{
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 )
{ {
NETLIST_PAGE_DIALOG* CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); m_Parent = parent;
GetSizer()->SetSizeHints( this );
}
if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString ) /**
* Function OnOKClick
* Validate info relative to a new netlist plugin
*/
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
{
if( m_textCtrlCommand->GetValue() == wxEmptyString )
{ {
DisplayError( this, _( "Error. You must provide a command String" ) ); wxMessageBox( _( "Error. You must provide a command String" ) );
return; return;
} }
if( CurrPage->m_TitleStringCtrl->GetValue() == wxEmptyString ) if( m_textCtrlName->GetValue() == wxEmptyString )
{ {
DisplayError( this, _( "Error. You must provide a Title" ) ); wxMessageBox( _( "Error. You must provide a Title" ) );
return; return;
} }
WriteCurrentNetlistSetup(); EndModal( wxID_OK );
EndModal( NET_PLUGIN_CHANGE ); }
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" ) );
} }
/***************************************************************************** /**
* @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.
* *
* netlist_control.h * 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_ #ifndef _NETLIST_CONTROL_H_
#define _NETLIST_CONTROL_H_ #define _NETLIST_CONTROL_H_
#include <dialogs/dialog_netlist_base.h>
/* Event id for notebook page buttons: */ #define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
enum id_netlist {
ID_CREATE_NETLIST = 1550, // Id to select netlist type
ID_CURRENT_FORMAT_IS_DEFAULT, enum NETLIST_TYPE_ID {
ID_RUN_SIMULATOR, NET_TYPE_UNINIT = 0,
ID_SETUP_PLUGIN, NET_TYPE_PCBNEW,
ID_VALIDATE_PLUGIN, NET_TYPE_ORCADPCB2,
ID_DELETE_PLUGIN, NET_TYPE_CADSTAR,
ID_NETLIST_NOTEBOOK, NET_TYPE_SPICE,
ID_CHANGE_NOTEBOOK_PAGE, NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
ID_ADD_SUBCIRCUIT_PREFIX, * 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 */ /* panel (notebook page) identifiers */
...@@ -31,19 +59,17 @@ enum panel_netlist_index { ...@@ -31,19 +59,17 @@ enum panel_netlist_index {
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */ * others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
}; };
/* Values returned when the netlist dialog is demiss */ // Values returned when the netlist dialog is demiss
enum gen_netlist_diag { #define NET_PLUGIN_CHANGE 1
NET_OK, // other values in use are wxID_OK and wxID_CANCEL
NET_ABORT,
NET_PLUGIN_CHANGE
};
/* wxPanels for creating the NoteBook pages for each netlist format: */ /* wxPanels for creating the NoteBook pages for each netlist format: */
class NETLIST_PAGE_DIALOG : public wxPanel class NETLIST_PAGE_DIALOG : public wxPanel
{ {
public: public:
int m_IdNetType; NETLIST_TYPE_ID m_IdNetType;
wxCheckBox* m_IsCurrentFormat; wxCheckBox* m_IsCurrentFormat;
wxCheckBox* m_AddSubPrefix; wxCheckBox* m_AddSubPrefix;
wxTextCtrl* m_CommandStringCtrl; wxTextCtrl* m_CommandStringCtrl;
...@@ -63,11 +89,9 @@ public: ...@@ -63,11 +89,9 @@ public:
* @param parent = wxNotebook * parent * @param parent = wxNotebook * parent
* @param title = title (name) of the notebook page * @param title = title (name) of the notebook page
* @param id_NetType = netlist type id * @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, NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
int id_NetType, int idCheckBox, int idCreateFile ); NETLIST_TYPE_ID id_NetType );
~NETLIST_PAGE_DIALOG() { }; ~NETLIST_PAGE_DIALOG() { };
/** /**
...@@ -79,27 +103,10 @@ public: ...@@ -79,27 +103,10 @@ public:
*/ */
const wxString GetPageNetFmtName(); 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 // Options for Spice netlist generation (OR'ed bits
enum netlistOptions { enum netlistOptions {
NET_USE_NETNAMES = 1, // for Spice netlist : use netnames instead of numbers NET_USE_NETNAMES = 1, // for Spice netlist : use netnames instead of numbers
...@@ -108,14 +115,16 @@ enum netlistOptions { ...@@ -108,14 +115,16 @@ enum netlistOptions {
}; };
/* Dialog frame for creating netlists */ /* Dialog frame for creating netlists */
class NETLIST_DIALOG : public wxDialog class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
{ {
public: public:
SCH_EDIT_FRAME* m_Parent; SCH_EDIT_FRAME* m_Parent;
wxString m_NetFmtName; wxString m_NetFmtName;
wxNotebook* m_NoteBook;
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
private:
wxConfig* m_Config;
public: public:
// Constructor and destructor // Constructor and destructor
...@@ -124,20 +133,73 @@ public: ...@@ -124,20 +133,73 @@ public:
private: private:
void InstallCustomPages(); void InstallCustomPages();
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
const wxString & aCommandString,
NETLIST_TYPE_ID aNetTypeId );
void InstallPageSpice(); void InstallPageSpice();
void GenNetlist( wxCommandEvent& event ); void GenNetlist( wxCommandEvent& event );
void RunSimulator( wxCommandEvent& event ); void RunSimulator( wxCommandEvent& event );
void NetlistUpdateOpt(); void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event ); void OnNetlistTypeSelection( wxNotebookEvent& event );
void SelectDefaultNetlistType( wxCommandEvent& event );
void EnableSubcircuitPrefix( wxCommandEvent& event ); void EnableSubcircuitPrefix( wxCommandEvent& event );
void AddNewPluginPanel( wxCommandEvent& event ); void OnAddPlugin( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event ); void OnDelPlugin( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event );
void WriteCurrentNetlistSetup( void ); 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() 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_ */ #endif /* _NETLIST_CONTROL_H_ */
...@@ -338,22 +338,8 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -338,22 +338,8 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
// Compute the outlines of the segment, and creates a polygon // 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: // add right rounded end:
for( int ii = delta; ii < 1800; ii += delta ) for( int ii = 0; ii < 1800; ii += delta )
{ {
corner = wxPoint( 0, radius ); corner = wxPoint( 0, radius );
RotatePoint( &corner, ii ); RotatePoint( &corner, ii );
...@@ -365,6 +351,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -365,6 +351,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
aCornerBuffer.push_back( polypoint ); aCornerBuffer.push_back( polypoint );
} }
// Finish arc:
corner = wxPoint( seg_len, -radius ); corner = wxPoint( seg_len, -radius );
RotatePoint( &corner, -delta_angle ); RotatePoint( &corner, -delta_angle );
corner += startp; corner += startp;
...@@ -372,15 +359,8 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -372,15 +359,8 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
polypoint.y = corner.y; polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint ); 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: // add left rounded end:
for( int ii = delta; ii < 1800; ii += delta ) for( int ii = 0; ii < 1800; ii += delta )
{ {
corner = wxPoint( 0, -radius ); corner = wxPoint( 0, -radius );
RotatePoint( &corner, ii ); RotatePoint( &corner, ii );
...@@ -391,6 +371,14 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -391,6 +371,14 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
aCornerBuffer.push_back( polypoint ); 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; aCornerBuffer.back().end_contour = true;
} }
......
...@@ -335,10 +335,10 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -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 // If there's no intrusion and DRC is active, we pass the cursor
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do. // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment if( !Drc_On || !g_CurrentTrackSegment ||
|| (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment, !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) ) GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) )
{ {
GetScreen()->SetCrossHairPosition( curs_pos, snapToGrid ); GetScreen()->SetCrossHairPosition( curs_pos, snapToGrid );
} }
...@@ -350,7 +350,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -350,7 +350,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
pos = GetScreen()->GetCrossHairPosition(); pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos, false ); GetScreen()->SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos, false ); GetScreen()->SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 2012 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
...@@ -267,15 +267,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -267,15 +267,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text ); m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text );
m_ValueCtrl->SetValue( m_ValueCopy->m_Text ); m_ValueCtrl->SetValue( m_ValueCopy->m_Text );
#if wxCHECK_VERSION( 2, 8, 0 )
m_AttributsCtrl->SetItemToolTip( 0, m_AttributsCtrl->SetItemToolTip( 0,
_( "Use this attribute for most non smd components" ) ); _( "Use this attribute for most non smd components" ) );
m_AttributsCtrl->SetItemToolTip( 1, m_AttributsCtrl->SetItemToolTip( 1,
_( "Use this attribute for smd components.\nOnly components with this option are put in the footprint position list file" ) ); _( "Use this attribute for smd components.\nOnly components with this option are put in the footprint position list file" ) );
m_AttributsCtrl->SetItemToolTip( 2, m_AttributsCtrl->SetItemToolTip( 2,
_( "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) ); _( "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) );
#endif
/* Controls on right side of the dialog */ /* Controls on right side of the dialog */
switch( m_CurrentModule->m_Attributs & 255 ) switch( m_CurrentModule->m_Attributs & 255 )
...@@ -299,12 +296,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -299,12 +296,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_AutoPlaceCtrl->SetSelection( m_AutoPlaceCtrl->SetSelection(
(m_CurrentModule->m_ModuleStatus & MODULE_is_LOCKED) ? 1 : 0 ); (m_CurrentModule->m_ModuleStatus & MODULE_is_LOCKED) ? 1 : 0 );
#if wxCHECK_VERSION( 2, 8, 0 )
m_AutoPlaceCtrl->SetItemToolTip( 0, m_AutoPlaceCtrl->SetItemToolTip( 0,
_( "Enable hotkey move commands and Auto Placement" ) ); _( "Enable hotkey move commands and Auto Placement" ) );
m_AutoPlaceCtrl->SetItemToolTip( 1, m_AutoPlaceCtrl->SetItemToolTip( 1,
_( "Disable hotkey move commands and Auto Placement" ) ); _( "Disable hotkey move commands and Auto Placement" ) );
#endif
m_CostRot90Ctrl->SetValue( m_CurrentModule->m_CntRot90 ); m_CostRot90Ctrl->SetValue( m_CurrentModule->m_CntRot90 );
m_CostRot180Ctrl->SetValue( m_CurrentModule->m_CntRot180 ); m_CostRot180Ctrl->SetValue( m_CurrentModule->m_CntRot180 );
...@@ -349,7 +346,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay( ...@@ -349,7 +346,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay(
} }
else else
{ {
S3D_Vertex dummy_vertex; S3D_VERTEX dummy_vertex;
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0; dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
m_3D_Scale->SetValue( dummy_vertex ); m_3D_Scale->SetValue( dummy_vertex );
} }
...@@ -474,6 +471,10 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) ...@@ -474,6 +471,10 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
} }
S3D_MASTER* new3DShape = new S3D_MASTER( NULL ); S3D_MASTER* new3DShape = new S3D_MASTER( NULL );
#ifdef __WINDOWS__
// Store filename in Unix notation
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
new3DShape->m_Shape3DName = shortfilename; new3DShape->m_Shape3DName = shortfilename;
m_Shapes3D_list.push_back( new3DShape ); m_Shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename ); m_3D_ShapeNameListBox->Append( shortfilename );
......
...@@ -4,6 +4,32 @@ ...@@ -4,6 +4,32 @@
* @brief Dialog for editing a module properties in module editor (modedit) * @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 <fctsys.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
...@@ -199,7 +225,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStru ...@@ -199,7 +225,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStru
} }
else else
{ {
S3D_Vertex dummy_vertex; S3D_VERTEX dummy_vertex;
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0; dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
m_3D_Scale->SetValue( dummy_vertex ); m_3D_Scale->SetValue( dummy_vertex );
} }
...@@ -316,6 +342,11 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event ) ...@@ -316,6 +342,11 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
} }
S3D_MASTER* new3DShape = new S3D_MASTER(NULL); S3D_MASTER* new3DShape = new S3D_MASTER(NULL);
#ifdef __WINDOWS__
// Store filename in Unix notation
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
new3DShape->m_Shape3DName = shortfilename; new3DShape->m_Shape3DName = shortfilename;
m_Shapes3D_list.push_back( new3DShape ); m_Shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename ); m_3D_ShapeNameListBox->Append( shortfilename );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="10" /> <FileVersion major="1" minor="11" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration" /> <property name="class_decoration" />
<property name="code_generation">C++</property> <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