Upstream merge.
This commit is contained in:
commit
c3b448b633
|
@ -47,7 +47,7 @@
|
|||
class BOARD_DESIGN_SETTINGS;
|
||||
class EDA_3D_FRAME;
|
||||
class S3D_VERTEX;
|
||||
class SEGVIA;
|
||||
class VIA;
|
||||
class D_PAD;
|
||||
|
||||
// We are using GL lists to store layers and other items
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
void Draw3DGrid( double aGriSizeMM );
|
||||
void Draw3DAxis();
|
||||
|
||||
void Draw3DViaHole( SEGVIA * aVia );
|
||||
void Draw3DPadHole( D_PAD * aPad );
|
||||
void Draw3DViaHole( const VIA * aVia );
|
||||
void Draw3DPadHole( const D_PAD * aPad );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -257,8 +257,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
|
||||
// Build a polygon from edge cut items
|
||||
wxString msg;
|
||||
if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,
|
||||
allLayerHoles, &msg ) )
|
||||
|
||||
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
||||
{
|
||||
msg << wxT("\n\n") <<
|
||||
_("Unable to calculate the board outlines.\n"
|
||||
|
@ -274,7 +274,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
bool hightQualityMode = false;
|
||||
|
||||
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
|
||||
layer++ )
|
||||
++layer )
|
||||
{
|
||||
if( layer != LAST_COPPER_LAYER
|
||||
&& layer >= g_Parm_3D_Visu.m_CopperLayersCount )
|
||||
|
@ -302,18 +302,19 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
// Add via hole
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
int shape = track->GetShape();
|
||||
int holediameter = track->GetDrillValue();
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
VIA *via = static_cast<VIA*>( track );
|
||||
VIATYPE_T viatype = via->GetViaType();
|
||||
int holediameter = via->GetDrillValue();
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
int hole_outer_radius = (holediameter + thickness) / 2;
|
||||
|
||||
if( shape != VIA_THROUGH )
|
||||
if( viatype != VIA_THROUGH )
|
||||
TransformCircleToPolygon( currLayerHoles,
|
||||
track->GetStart(), hole_outer_radius,
|
||||
via->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
else if( !throughHolesListBuilt )
|
||||
TransformCircleToPolygon( allLayerHoles,
|
||||
track->GetStart(), hole_outer_radius,
|
||||
via->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
}
|
||||
}
|
||||
|
@ -431,14 +432,16 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
}
|
||||
|
||||
// Draw vias holes (vertical cylinders)
|
||||
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||
for( const TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
Draw3DViaHole( (SEGVIA*) track );
|
||||
const VIA *via = dynamic_cast<const VIA*>(track);
|
||||
|
||||
if( via )
|
||||
Draw3DViaHole( via );
|
||||
}
|
||||
|
||||
// Draw pads holes (vertical cylinders)
|
||||
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
for( const MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
{
|
||||
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
|
||||
Draw3DPadHole( pad );
|
||||
|
@ -505,6 +508,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
// to reduce time calculations
|
||||
// for holes and items which do not need
|
||||
// a fine representation
|
||||
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );
|
||||
|
||||
CPOLYGONS_LIST bufferPolys;
|
||||
bufferPolys.reserve( 100000 ); // Reserve for large board
|
||||
|
@ -514,8 +518,8 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
CPOLYGONS_LIST bufferPcbOutlines; // stores the board main outlines
|
||||
// Build a polygon from edge cut items
|
||||
wxString msg;
|
||||
if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,
|
||||
allLayerHoles, &msg ) )
|
||||
|
||||
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
||||
{
|
||||
msg << wxT("\n\n") <<
|
||||
_("Unable to calculate the board outlines.\n"
|
||||
|
@ -524,20 +528,19 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
}
|
||||
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||
{
|
||||
// Add via hole
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
int shape = track->GetShape();
|
||||
int holediameter = track->GetDrillValue();
|
||||
int hole_outer_radius = (holediameter + thickness) / 2;
|
||||
|
||||
if( shape == VIA_THROUGH )
|
||||
TransformCircleToPolygon( allLayerHoles,
|
||||
track->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
}
|
||||
// Add via holes
|
||||
for( VIA* via = GetFirstVia( pcb->m_Track ); via != NULL;
|
||||
via = GetFirstVia( via->Next() ) )
|
||||
{
|
||||
VIATYPE_T viatype = via->GetViaType();
|
||||
int holediameter = via->GetDrillValue();
|
||||
int hole_outer_radius = (holediameter + thickness) / 2;
|
||||
|
||||
if( viatype == VIA_THROUGH )
|
||||
TransformCircleToPolygon( allLayerHoles,
|
||||
via->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
}
|
||||
|
||||
// draw pads holes
|
||||
|
@ -557,7 +560,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
allLayerHoles.ExportTo( brdpolysetHoles );
|
||||
|
||||
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
|
||||
layer++ )
|
||||
++layer )
|
||||
{
|
||||
// Skip user layers, which are not drawn here
|
||||
if( IsUserLayer( layer) )
|
||||
|
@ -606,22 +609,30 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
continue;
|
||||
|
||||
BuildPadShapeThickOutlineAsPolygon( pad, bufferPolys,
|
||||
linewidth,
|
||||
segcountforcircle, correctionFactor );
|
||||
linewidth, segcountforcircle, correctionFactor );
|
||||
}
|
||||
}
|
||||
else
|
||||
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
|
||||
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
}
|
||||
|
||||
// Draw non copper zones
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
|
||||
{
|
||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
||||
|
||||
if( !zone->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
zone->TransformSolidAreasShapesToPolygonSet(
|
||||
bufferPolys, segcountLowQuality, correctionFactorLQ );
|
||||
}
|
||||
}
|
||||
|
||||
// bufferPolys contains polygons to merge. Many overlaps .
|
||||
|
@ -700,7 +711,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
|
|||
bufferPolys.reserve( 5000 ); // Reserve for items not on board
|
||||
|
||||
for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
|
||||
layer++ )
|
||||
++layer )
|
||||
{
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
@ -1047,7 +1058,7 @@ void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )
|
|||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
|
||||
void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
|
||||
{
|
||||
LAYER_NUM top_layer, bottom_layer;
|
||||
int inner_radius = aVia->GetDrillValue() / 2;
|
||||
|
@ -1060,7 +1071,7 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
|
|||
SetGLCopperColor();
|
||||
else
|
||||
{
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + aVia->GetShape() );
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + aVia->GetViaType() );
|
||||
SetGLColor( color );
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1122,7 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,
|
|||
|
||||
|
||||
// Draw 3D pads.
|
||||
void EDA_3D_CANVAS::Draw3DPadHole( D_PAD* aPad )
|
||||
void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
|
||||
{
|
||||
// Draw the pad hole
|
||||
wxSize drillsize = aPad->GetDrillSize();
|
||||
|
|
|
@ -81,7 +81,7 @@ END_EVENT_TABLE()
|
|||
|
||||
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, DISPLAY3D_FRAME_TYPE, aTitle,
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
{
|
||||
m_canvas = NULL;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -71,7 +71,7 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
|
|||
if ( text == NULL )
|
||||
continue;
|
||||
|
||||
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
|
||||
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Transform" ) == 0 || stricmp( text, "Group" ) == 0 )
|
||||
{
|
||||
while( GetLine( file, line, &LineNum, 512 ) )
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0)
|
||||
if( stricmp( command, "DEF" ) == 0 || stricmp( command,"Transform" ) == 0 || stricmp( command, "Material") == 0)
|
||||
{
|
||||
material = new S3D_MATERIAL( GetMaster(), mat_name );
|
||||
|
||||
|
@ -197,6 +197,9 @@ int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum )
|
|||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( *text == '[' )
|
||||
continue;
|
||||
|
||||
if( *text == ']' )
|
||||
return 0;
|
||||
|
||||
|
@ -233,6 +236,11 @@ int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum )
|
|||
break;
|
||||
}
|
||||
|
||||
if( *text == '{' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "appearance" ) == 0 )
|
||||
{
|
||||
readAppearance( file, LineNum );
|
||||
|
@ -267,6 +275,11 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
|
|||
break;
|
||||
}
|
||||
|
||||
if( *text == '{' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "material" ) == 0 )
|
||||
{
|
||||
readMaterial( file, LineNum );
|
||||
|
@ -380,6 +393,16 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
|
|||
break;
|
||||
}
|
||||
|
||||
if( stricmp( text, "creaseAngle" ) == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( *text == '{' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "normalPerVertex" ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, " ,\t\n\r" );
|
||||
|
|
|
@ -623,7 +623,6 @@ add_subdirectory( 3d-viewer )
|
|||
add_subdirectory( cvpcb )
|
||||
add_subdirectory( eeschema )
|
||||
add_subdirectory( gerbview )
|
||||
add_subdirectory( kicad )
|
||||
add_subdirectory( lib_dxf )
|
||||
add_subdirectory( pcbnew )
|
||||
add_subdirectory( polygon )
|
||||
|
@ -631,9 +630,11 @@ add_subdirectory( pagelayout_editor )
|
|||
add_subdirectory( potrace )
|
||||
add_subdirectory( bitmap2component )
|
||||
add_subdirectory( pcb_calculator )
|
||||
add_subdirectory( kicad ) # should follow pcbnew, eeschema
|
||||
add_subdirectory( tools )
|
||||
add_subdirectory( utils )
|
||||
add_subdirectory( qa )
|
||||
|
||||
#add_subdirectory( new )
|
||||
|
||||
|
||||
|
@ -653,16 +654,16 @@ add_dependencies( pnsrouter boost )
|
|||
|
||||
|
||||
if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
|
||||
add_dependencies( pcbnew lib-dependencies )
|
||||
add_dependencies( eeschema lib-dependencies )
|
||||
add_dependencies( cvpcb lib-dependencies )
|
||||
add_dependencies( common lib-dependencies )
|
||||
add_dependencies( gal lib-dependencies )
|
||||
add_dependencies( pcbcommon lib-dependencies )
|
||||
add_dependencies( 3d-viewer lib-dependencies )
|
||||
add_dependencies( pcad2kicadpcb lib-dependencies )
|
||||
add_dependencies( pl_editor lib-dependencies )
|
||||
add_dependencies( pnsrouter lib-dependencies )
|
||||
add_dependencies( pcbnew lib-dependencies )
|
||||
add_dependencies( eeschema lib-dependencies )
|
||||
add_dependencies( cvpcb lib-dependencies )
|
||||
add_dependencies( common lib-dependencies )
|
||||
add_dependencies( gal lib-dependencies )
|
||||
add_dependencies( pcbcommon lib-dependencies )
|
||||
add_dependencies( 3d-viewer lib-dependencies )
|
||||
add_dependencies( pcad2kicadpcb lib-dependencies )
|
||||
add_dependencies( pl_editor lib-dependencies )
|
||||
add_dependencies( pnsrouter lib-dependencies )
|
||||
endif()
|
||||
|
||||
if ( KICAD_BUILD_DYNAMIC )
|
||||
|
|
|
@ -38,6 +38,12 @@
|
|||
# Where the library is to be installed.
|
||||
set( PREFIX ${DOWNLOAD_DIR}/avhttp )
|
||||
|
||||
if( KICAD_SKIP_BOOST )
|
||||
set( AVHTTP_DEPEND "" )
|
||||
else()
|
||||
set( AVHTTP_DEPEND "boost" )
|
||||
endif()
|
||||
|
||||
|
||||
# Install the AVHTTP header only library ${PREFIX}
|
||||
ExternalProject_Add( avhttp
|
||||
|
@ -46,7 +52,7 @@ ExternalProject_Add( avhttp
|
|||
|
||||
# grab it from a local zip file for now, cmake caller's source dir
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/avhttp-master.zip
|
||||
DEPENDS boost
|
||||
DEPENDS ${AVHTTP_DEPEND}
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ ExternalProject_Add( boost
|
|||
|
||||
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
|
||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||
TIMEOUT 600 # 10 minutes
|
||||
TIMEOUT 1200 # 20 minutes
|
||||
URL_MD5 ${BOOST_MD5}
|
||||
# If download fails, then enable "LOG_DOWNLOAD ON" and try again.
|
||||
# Upon a second failure with logging enabled, then look at these logs:
|
||||
|
|
|
@ -639,7 +639,7 @@ namespace BMP2CMP {
|
|||
|
||||
static struct IFACE : public KIFACE_I
|
||||
{
|
||||
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
|
||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
|
||||
{
|
||||
|
@ -706,8 +706,8 @@ PGM_BASE& Pgm()
|
|||
#endif
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
return start_common();
|
||||
return start_common( aCtlBits );
|
||||
}
|
||||
|
||||
|
|
|
@ -182,10 +182,13 @@ set( COMMON_SRCS
|
|||
html_messagebox.cpp
|
||||
kiface_i.cpp
|
||||
kiway.cpp
|
||||
kiway_express.cpp
|
||||
kiway_holder.cpp
|
||||
kiway_player.cpp
|
||||
msgpanel.cpp
|
||||
netlist_keywords.cpp
|
||||
newstroke_font.cpp
|
||||
prependpath.cpp
|
||||
project.cpp
|
||||
ptree.cpp
|
||||
reporter.cpp
|
||||
|
|
|
@ -62,7 +62,7 @@ static const wxChar entryPerspective[] = wxT( "Perspective" );
|
|||
|
||||
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName ) :
|
||||
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
|
||||
|
@ -107,7 +107,10 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
|||
|
||||
void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
||||
{
|
||||
SaveSettings( config() ); // virtual, wxFrame specific
|
||||
wxConfigBase* cfg = config();
|
||||
|
||||
if( cfg )
|
||||
SaveSettings( cfg ); // virtual, wxFrame specific
|
||||
|
||||
event.Skip(); // we did not "handle" the event, only eavesdropped on it.
|
||||
}
|
||||
|
@ -266,7 +269,7 @@ wxConfigBase* EDA_BASE_FRAME::config()
|
|||
{
|
||||
// KICAD_MANAGER_FRAME overrides this
|
||||
wxConfigBase* ret = Kiface().KifaceSettings();
|
||||
wxASSERT( ret );
|
||||
//wxASSERT( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -570,12 +570,21 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
if( textAsLines || containsNonAsciiChars( aText ) )
|
||||
/* output text as graphics */
|
||||
// Fix me: see how to use DXF text mode for multiline texts
|
||||
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
|
||||
aMultilineAllowed = false; // the text has only one line.
|
||||
|
||||
if( textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed )
|
||||
{
|
||||
// output text as graphics.
|
||||
// Perhaps miltiline texts could be handled as DXF text entity
|
||||
// but I do not want spend time about this (JPC)
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold );
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Emit text as a text entity. This loses formatting and shape but it's
|
||||
|
|
|
@ -741,10 +741,15 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
// Fix me: see how to use PDF text mode for multiline texts
|
||||
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
|
||||
aMultilineAllowed = false; // the text has only one line.
|
||||
|
||||
// Emit native PDF text (if requested)
|
||||
if( m_textMode != PLOTTEXTMODE_STROKE )
|
||||
if( m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed )
|
||||
{
|
||||
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
|
||||
: (aBold ? "/KicadFontB" : "/KicadFont");
|
||||
|
@ -800,10 +805,10 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
|||
}
|
||||
|
||||
// Plot the stroked text (if requested)
|
||||
if( m_textMode != PLOTTEXTMODE_NATIVE )
|
||||
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
|
||||
{
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold );
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -812,27 +812,32 @@ bool PS_PLOTTER::EndPlot()
|
|||
|
||||
|
||||
|
||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||
enum EDA_COLOR_T aColor,
|
||||
const wxString& aText,
|
||||
double aOrient,
|
||||
const wxSize& aSize,
|
||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||
enum EDA_COLOR_T aColor,
|
||||
const wxString& aText,
|
||||
double aOrient,
|
||||
const wxSize& aSize,
|
||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
SetCurrentLineWidth( aWidth );
|
||||
SetColor( aColor );
|
||||
|
||||
// Fix me: see how to use PS text mode for multiline texts
|
||||
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
|
||||
aMultilineAllowed = false; // the text has only one line.
|
||||
|
||||
// Draw the native postscript text (if requested)
|
||||
if( m_textMode == PLOTTEXTMODE_NATIVE )
|
||||
if( m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed )
|
||||
{
|
||||
const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
|
||||
: "/KicadFont-Oblique")
|
||||
: (aBold ? "/KicadFont-Bold"
|
||||
: "/KicadFont");
|
||||
: (aBold ? "/KicadFont-Bold"
|
||||
: "/KicadFont");
|
||||
|
||||
// Compute the copious tranformation parameters
|
||||
double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
|
||||
|
@ -874,16 +879,16 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
|||
if( m_textMode == PLOTTEXTMODE_PHANTOM )
|
||||
{
|
||||
fputsPostscriptString( outputFile, aText );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
fprintf( outputFile, " %g %g phantomshow\n",
|
||||
pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
// Draw the stroked text (if requested)
|
||||
if( m_textMode != PLOTTEXTMODE_NATIVE )
|
||||
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
|
||||
{
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold );
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -478,6 +478,15 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
if( penState == 'Z' ) // here plume = 'D' or 'U'
|
||||
{
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
|
||||
// Ensure we do not use a fill mode when moving tne pen,
|
||||
// in SVG mode (i;e. we are plotting only basic lines, not a filled area
|
||||
if( m_fillMode != NO_FILL )
|
||||
{
|
||||
setFillMode( NO_FILL );
|
||||
setSVGPlotStyle();
|
||||
}
|
||||
|
||||
fprintf( outputFile, "<path d=\"M%d %d\n",
|
||||
(int) pos_dev.x, (int) pos_dev.y );
|
||||
}
|
||||
|
@ -572,7 +581,8 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
setFillMode( NO_FILL );
|
||||
SetColor( aColor );
|
||||
|
@ -581,5 +591,5 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
|||
// TODO: see if the postscript native text code can be used in SVG plotter
|
||||
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold );
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
}
|
||||
|
|
|
@ -29,16 +29,9 @@ dialog_about::dialog_about(wxWindow *parent, AboutAppInfo& appInfo)
|
|||
m_staticTextBuildVersion->SetLabel( info.GetBuildVersion() );
|
||||
m_staticTextLibVersion->SetLabel( info.GetLibVersion() );
|
||||
|
||||
/* Affects m_titlepanel the parent of some wxStaticText.
|
||||
* Changing the text afterwards makes it under Windows necessary to call 'Layout()'
|
||||
* so that the new text gets properly layout.
|
||||
*/
|
||||
/* m_staticTextCopyright->GetParent()->Layout();
|
||||
m_staticTextBuildVersion->GetParent()->Layout();
|
||||
m_staticTextLibVersion->GetParent()->Layout();
|
||||
*/
|
||||
DeleteNotebooks();
|
||||
CreateNotebooks();
|
||||
|
||||
GetSizer()->SetSizeHints(this);
|
||||
m_auiNotebook->Update();
|
||||
SetFocus();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Sep 8 2010)
|
||||
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -46,11 +46,13 @@ dialog_about_base::dialog_about_base( wxWindow* parent, wxWindowID id, const wxS
|
|||
m_staticTextLibVersion->Wrap( -1 );
|
||||
b_apptitleSizer->Add( m_staticTextLibVersion, 0, wxALIGN_CENTER|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( b_apptitleSizer, 10, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( 0, 0, 2, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( bSizer3, 0, wxEXPAND, 5 );
|
||||
|
||||
wxStaticLine* m_staticline1;
|
||||
|
@ -67,6 +69,7 @@ dialog_about_base::dialog_about_base( wxWindow* parent, wxWindowID id, const wxS
|
|||
m_buttonOK->SetDefault();
|
||||
bSizer1->Add( m_buttonOK, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer1 );
|
||||
this->Layout();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +1,16 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Sep 8 2010)
|
||||
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __dialog_about_base__
|
||||
#define __dialog_about_base__
|
||||
#ifndef __DIALOG_ABOUT_BASE_H__
|
||||
#define __DIALOG_ABOUT_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
|
@ -37,13 +38,11 @@ class dialog_about_base : public wxDialog
|
|||
wxButton* m_buttonOK;
|
||||
|
||||
protected:
|
||||
|
||||
wxStaticBitmap* m_bitmapApp;
|
||||
wxStaticText* m_staticTextAppTitle;
|
||||
wxStaticText* m_staticTextCopyright;
|
||||
wxStaticText* m_staticTextBuildVersion;
|
||||
wxStaticText* m_staticTextLibVersion;
|
||||
|
||||
wxAuiNotebook* m_auiNotebook;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
|
@ -53,9 +52,9 @@ class dialog_about_base : public wxDialog
|
|||
|
||||
public:
|
||||
|
||||
dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,350 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP );
|
||||
dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP );
|
||||
~dialog_about_base();
|
||||
|
||||
};
|
||||
|
||||
#endif //__dialog_about_base__
|
||||
#endif //__DIALOG_ABOUT_BASE_H__
|
||||
|
|
|
@ -65,7 +65,7 @@ static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
|
|||
static const wxString LastGridSizeIdKeyword( wxT( "_LastGridSize" ) );
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
|
||||
BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
|
||||
EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
|
||||
EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
|
||||
EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
|
||||
|
@ -91,7 +91,7 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aFrameType,
|
||||
FRAME_T aFrameType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName ) :
|
||||
|
|
|
@ -32,14 +32,6 @@
|
|||
#include <trigo.h> // RotatePoint
|
||||
#include <class_drawpanel.h> // EDA_DRAW_PANEL
|
||||
|
||||
// until bzr rev 4476, Y position of vertical justification
|
||||
// of multiline texts was incorrectly calculated for BOTTOM
|
||||
// and CENTER vertical justification. (Only the first line was justified)
|
||||
// If this line is left uncommented, the bug is fixed, but
|
||||
// creates a (very minor) issue for existing texts, mainly in Pcbnew
|
||||
// because the text position is sometimes critical.
|
||||
#define FIX_MULTILINE_VERT_JUSTIF
|
||||
|
||||
// Conversion to application internal units defined at build time.
|
||||
#if defined( PCBNEW )
|
||||
#include <class_board_item.h>
|
||||
|
@ -205,7 +197,6 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
|
|||
|
||||
if( linecount > 1 )
|
||||
{
|
||||
#ifdef FIX_MULTILINE_VERT_JUSTIF
|
||||
int yoffset;
|
||||
linecount -= 1;
|
||||
|
||||
|
@ -224,7 +215,6 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
|
|||
rect.SetY( rect.GetY() - yoffset );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
rect.Inflate( thickness / 2 );
|
||||
|
@ -305,7 +295,6 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
|
|||
|
||||
offset.y = GetInterline();
|
||||
|
||||
#ifdef FIX_MULTILINE_VERT_JUSTIF
|
||||
if( aLineCount > 1 )
|
||||
{
|
||||
switch( m_VJustify )
|
||||
|
@ -326,7 +315,7 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
|
|||
// Rotate the position of the first line
|
||||
// around the center of the multiline text block
|
||||
RotatePoint( &pos, m_Pos, m_Orient );
|
||||
#endif
|
||||
|
||||
// Rotate the offset lines to increase happened in the right direction
|
||||
RotatePoint( &offset, m_Orient );
|
||||
|
||||
|
|
|
@ -94,8 +94,10 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
|
|||
}
|
||||
|
||||
|
||||
bool KIFACE_I::start_common()
|
||||
bool KIFACE_I::start_common( int aCtlBits )
|
||||
{
|
||||
m_start_flags = aCtlBits;
|
||||
|
||||
m_bm.Init();
|
||||
|
||||
m_bm.m_config->Read( showPageLimitsKey, &g_ShowPageLimits );
|
||||
|
|
314
common/kiway.cpp
314
common/kiway.cpp
|
@ -22,37 +22,98 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <kiway.h>
|
||||
#include <config.h>
|
||||
#include <wx/debug.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// one for each FACE_T
|
||||
wxDynamicLibrary KIWAY::s_sch_dso;
|
||||
wxDynamicLibrary KIWAY::s_pcb_dso;
|
||||
#include <macros.h>
|
||||
#include <kiway.h>
|
||||
#include <kiway_player.h>
|
||||
#include <kiway_express.h>
|
||||
#include <config.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
|
||||
KIWAY::KIWAY()
|
||||
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
|
||||
int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
|
||||
|
||||
|
||||
|
||||
KIWAY::KIWAY( PGM_BASE* aProgram, wxFrame* aTop ):
|
||||
m_program( aProgram ),
|
||||
m_top( 0 )
|
||||
{
|
||||
memset( &m_kiface, 0, sizeof( m_kiface ) );
|
||||
SetTop( aTop ); // hook playerDestroyHandler() into aTop.
|
||||
|
||||
memset( m_player, 0, sizeof( m_player ) );
|
||||
}
|
||||
|
||||
// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
|
||||
// propogated upwards to parent windows if not handled below. Therefor the
|
||||
// m_top window should receive all wxWindowDestroyEvents originating from
|
||||
// KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops
|
||||
// on that event stream looking for KIWAY_PLAYERs being closed.
|
||||
|
||||
void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
|
||||
{
|
||||
wxWindow* w = event.GetWindow();
|
||||
|
||||
for( unsigned i=0; i<DIM(m_player); ++i )
|
||||
{
|
||||
// if destroying one of our flock, then mark it as deceased.
|
||||
if( (wxWindow*) m_player[i] == w )
|
||||
{
|
||||
// DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );)
|
||||
m_player[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
const wxString KIWAY::dso_name( FACE_T aFaceId )
|
||||
void KIWAY::SetTop( wxFrame* aTop )
|
||||
{
|
||||
if( m_top )
|
||||
{
|
||||
m_top->Disconnect( wxEVT_DESTROY, wxWindowDestroyEventHandler( KIWAY::playerDestroyHandler ), NULL, this );
|
||||
}
|
||||
|
||||
if( aTop )
|
||||
{
|
||||
aTop->Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler( KIWAY::playerDestroyHandler ), NULL, this );
|
||||
}
|
||||
|
||||
m_top = aTop;
|
||||
}
|
||||
|
||||
|
||||
const wxString KIWAY::dso_full_path( FACE_T aFaceId )
|
||||
{
|
||||
const wxChar* name;
|
||||
|
||||
switch( aFaceId )
|
||||
{
|
||||
case FACE_SCH: return KIFACE_PREFIX wxT( "eeschema" ) KIFACE_SUFFIX;
|
||||
case FACE_PCB: return KIFACE_PREFIX wxT( "pcbnew" ) KIFACE_SUFFIX;
|
||||
case FACE_SCH: name = KIFACE_PREFIX wxT( "eeschema" ); break;
|
||||
case FACE_PCB: name = KIFACE_PREFIX wxT( "pcbnew" ); break;
|
||||
case FACE_CVPCB: name = KIFACE_PREFIX wxT( "cvpcb" ); break;
|
||||
case FACE_GERBVIEW: name = KIFACE_PREFIX wxT( "gerbview" ); break;
|
||||
case FACE_PL_EDITOR: name = KIFACE_PREFIX wxT( "pl_editor" ); break;
|
||||
|
||||
// case FACE_PCB_CALCULATOR: who knows.
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxFileName fn = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
||||
fn.SetName( name );
|
||||
|
||||
// Here a "suffix" == an extension with a preceding '.',
|
||||
// so skip the preceding '.' to get an extension
|
||||
fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1]
|
||||
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
PROJECT& KIWAY::Prj() const
|
||||
|
@ -63,33 +124,230 @@ PROJECT& KIWAY::Prj() const
|
|||
|
||||
KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
|
||||
{
|
||||
switch( aFaceId )
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFaceId.
|
||||
if( unsigned( aFaceId ) >= DIM( m_kiface ) )
|
||||
{
|
||||
case FACE_SCH:
|
||||
case FACE_PCB:
|
||||
if( m_kiface[aFaceId] )
|
||||
return m_kiface[aFaceId];
|
||||
// @todo : throw an exception here for python's benefit, at least that
|
||||
// way it gets some explanatory text.
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// DSO with KIFACE has not been loaded yet, does user want to load it?
|
||||
// return the previously loaded KIFACE, if it was.
|
||||
if( m_kiface[aFaceId] )
|
||||
return m_kiface[aFaceId];
|
||||
|
||||
// DSO with KIFACE has not been loaded yet, does caller want to load it?
|
||||
if( doLoad )
|
||||
{
|
||||
switch( aFaceId )
|
||||
wxString dname = dso_full_path( aFaceId );
|
||||
|
||||
wxDynamicLibrary dso;
|
||||
|
||||
void* addr = NULL;
|
||||
|
||||
if( !dso.Load( dname, wxDL_VERBATIM | wxDL_NOW ) )
|
||||
{
|
||||
case FACE_SCH:
|
||||
break;
|
||||
// Failure: error reporting UI was done via wxLogSysError().
|
||||
// No further reporting required here.
|
||||
}
|
||||
|
||||
case FACE_PCB:
|
||||
break;
|
||||
else if( ( addr = dso.GetSymbol( wxT( KIFACE_INSTANCE_NAME_AND_VERSION ) ) ) == NULL )
|
||||
{
|
||||
// Failure: error reporting UI was done via wxLogSysError().
|
||||
// No further reporting required here.
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
else
|
||||
{
|
||||
KIFACE_GETTER_FUNC* getter = (KIFACE_GETTER_FUNC*) addr;
|
||||
|
||||
KIFACE* kiface = getter( &m_kiface_version[aFaceId], KIFACE_VERSION, m_program );
|
||||
|
||||
// KIFACE_GETTER_FUNC function comment (API) says the non-NULL is unconditional.
|
||||
wxASSERT_MSG( kiface,
|
||||
wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
|
||||
|
||||
// Give the DSO a single chance to do its "process level" initialization.
|
||||
// "Process level" specifically means stay away from any projects in there.
|
||||
if( kiface->OnKifaceStart( m_program, KFCTL_PROJECT_SUITE ) )
|
||||
{
|
||||
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
|
||||
(void) dso.Detach();
|
||||
|
||||
return m_kiface[aFaceId] = kiface;
|
||||
}
|
||||
}
|
||||
|
||||
// In any of the failure cases above, dso.Unload() should be called here
|
||||
// by dso destructor.
|
||||
// However:
|
||||
|
||||
// There is a file installation bug. We only look for KIFACE_I's which we know
|
||||
// to exist, and we did not find one. If we do not find one, this is an
|
||||
// installation bug.
|
||||
|
||||
wxString msg = wxString::Format( wxT(
|
||||
"Fatal Installation Bug\nmissing file:\n'%s'\n\nargv[0]:\n'%s'" ),
|
||||
GetChars( dname ),
|
||||
GetChars( wxStandardPaths::Get().GetExecutablePath() )
|
||||
);
|
||||
|
||||
// This is a fatal error, one from which we cannot recover, nor do we want
|
||||
// to protect against in client code which would require numerous noisy
|
||||
// tests in numerous places. So we inform the user that the installation
|
||||
// is bad. This exception will likely not get caught until way up in the
|
||||
// wxApp derivative, at which point the process will exit gracefully.
|
||||
THROW_IO_ERROR( msg );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
|
||||
{
|
||||
switch( aFrameType )
|
||||
{
|
||||
case FRAME_SCH:
|
||||
case FRAME_SCH_LIB_EDITOR:
|
||||
case FRAME_SCH_VIEWER:
|
||||
return FACE_SCH;
|
||||
|
||||
case FRAME_PCB:
|
||||
case FRAME_PCB_MODULE_EDITOR:
|
||||
case FRAME_PCB_MODULE_VIEWER:
|
||||
case FRAME_PCB_FOOTPRINT_WIZARD:
|
||||
case FRAME_PCB_DISPLAY3D:
|
||||
return FACE_PCB;
|
||||
|
||||
case FRAME_CVPCB:
|
||||
case FRAME_CVPCB_DISPLAY:
|
||||
return FACE_CVPCB;
|
||||
|
||||
case FRAME_GERBER:
|
||||
return FACE_GERBVIEW;
|
||||
|
||||
case FRAME_PL_EDITOR:
|
||||
return FACE_PL_EDITOR;
|
||||
|
||||
default:
|
||||
return FACE_T( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
|
||||
{
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFrameType.
|
||||
if( unsigned( aFrameType ) >= DIM( m_player ) )
|
||||
{
|
||||
// @todo : throw an exception here for python's benefit, at least that
|
||||
// way it gets some explanatory text.
|
||||
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// return the previously opened window
|
||||
if( m_player[aFrameType] )
|
||||
return m_player[aFrameType];
|
||||
|
||||
if( doCreate )
|
||||
{
|
||||
FACE_T face_type = KifaceType( aFrameType );
|
||||
wxASSERT( face_type != FACE_T(-1) );
|
||||
|
||||
KIFACE* kiface = KiFACE( face_type );
|
||||
wxASSERT( kiface );
|
||||
|
||||
if( kiface )
|
||||
{
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( m_top, aFrameType, this, KFCTL_PROJECT_SUITE );
|
||||
wxASSERT( frame );
|
||||
|
||||
return m_player[aFrameType] = frame;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
|
||||
{
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFrameType.
|
||||
if( unsigned( aFrameType ) >= DIM( m_player ) )
|
||||
{
|
||||
// @todo : throw an exception here for python's benefit, at least that
|
||||
// way it gets some explanatory text.
|
||||
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_player[aFrameType] )
|
||||
{
|
||||
if( m_player[aFrameType]->Close( doForce ) )
|
||||
{
|
||||
m_player[aFrameType] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // window is closed already.
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY::PlayersClose( bool doForce )
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
for( unsigned i=0; i < DIM( m_player ); ++i )
|
||||
{
|
||||
ret = ret && PlayerClose( FRAME_T( i ), doForce );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void KIWAY::ExpressMail( FRAME_T aDestination,
|
||||
MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource )
|
||||
{
|
||||
KIWAY_EXPRESS mail( aDestination, aCommand, aPayload, aSource );
|
||||
|
||||
ProcessEvent( mail );
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY::ProcessEvent( wxEvent& aEvent )
|
||||
{
|
||||
KIWAY_EXPRESS* mail = dynamic_cast<KIWAY_EXPRESS*>( &aEvent );
|
||||
|
||||
if( mail )
|
||||
{
|
||||
FRAME_T dest = mail->Dest();
|
||||
|
||||
// see if recipient is alive
|
||||
KIWAY_PLAYER* alive = Player( dest, false );
|
||||
|
||||
if( alive )
|
||||
{
|
||||
#if 1
|
||||
return alive->ProcessEvent( aEvent );
|
||||
#else
|
||||
alive->KiwayMailIn( *mail );
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <kiway_express.h>
|
||||
|
||||
//IMPLEMENT_DYNAMIC_CLASS( KIWAY_EXPRESS, wxEvent )
|
||||
|
||||
|
||||
#if 0 // requires that this code reside in only a single link image, rather than
|
||||
// in each of kicad.exe, _pcbnew.kiface, and _eeschema.kiface as now.
|
||||
// In the current case wxEVENT_ID will get a different value in each link
|
||||
// image. We need to put this into a shared library for common utilization,
|
||||
// I think that library should be libki.so. I am reluctant to do that now
|
||||
// because the cost will be finding libki.so at runtime, and we need infrastructure
|
||||
// to set our LIB_ENV_VAR to the proper place so libki.so can be reliably found.
|
||||
// All things in due course.
|
||||
const wxEventType KIWAY_EXPRESS::wxEVENT_ID = wxNewEventType();
|
||||
#else
|
||||
const wxEventType KIWAY_EXPRESS::wxEVENT_ID = 30000; // commmon accross all link images, hopefully unique.
|
||||
#endif
|
||||
|
||||
|
||||
KIWAY_EXPRESS::KIWAY_EXPRESS( const KIWAY_EXPRESS& anOther ) :
|
||||
wxEvent( anOther )
|
||||
{
|
||||
m_destination = anOther.m_destination;
|
||||
m_payload = anOther.m_payload;
|
||||
}
|
||||
|
||||
|
||||
KIWAY_EXPRESS::KIWAY_EXPRESS( FRAME_T aDestination, MAIL_T aCommand,
|
||||
const std::string& aPayload, wxWindow* aSource ) :
|
||||
wxEvent( aCommand, wxEVENT_ID ),
|
||||
m_destination( aDestination ),
|
||||
m_payload( aPayload )
|
||||
{
|
||||
SetEventObject( aSource );
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
|
||||
#include <kiway_player.h>
|
||||
#include <kiway_express.h>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( KIWAY_PLAYER, EDA_BASE_FRAME )
|
||||
/* have not been able to get this to work yet:
|
||||
EVT_KIWAY_EXPRESS( KIWAY_PLAYER::kiway_express )
|
||||
Use Connect() in constructor until this can be sorted out.
|
||||
|
||||
OK the problem is KIWAY_PLAYER::wxEVENT_ID not being unique accross all link images.
|
||||
*/
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( aKiway )
|
||||
{
|
||||
DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
|
||||
Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
|
||||
}
|
||||
|
||||
|
||||
KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( 0 )
|
||||
{
|
||||
DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
|
||||
Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
|
||||
}
|
||||
|
||||
|
||||
void KIWAY_PLAYER::kiway_express( KIWAY_EXPRESS& aEvent )
|
||||
{
|
||||
// logging support
|
||||
#if defined(DEBUG)
|
||||
const char* class_name = typeid(this).name();
|
||||
|
||||
printf( "%s: cmd:%d pay:'%s'\n", class_name,
|
||||
aEvent.GetEventType(), aEvent.GetPayload().c_str() );
|
||||
#endif
|
||||
|
||||
KiwayMailIn( aEvent ); // call the virtual, overload in derived.
|
||||
}
|
||||
|
||||
|
||||
void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )
|
||||
{
|
||||
// overload this.
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
|
||||
#include <macros.h>
|
||||
#include <fctsys.h>
|
||||
#include <wx/filename.h>
|
||||
|
||||
|
||||
|
||||
#if !wxCHECK_VERSION( 3, 0, 0 )
|
||||
|
||||
// implement missing wx2.8 function until >= wx3.0 pervades.
|
||||
static wxString wxJoin(const wxArrayString& arr, const wxChar sep,
|
||||
const wxChar escape = '\\')
|
||||
{
|
||||
size_t count = arr.size();
|
||||
if ( count == 0 )
|
||||
return wxEmptyString;
|
||||
|
||||
wxString str;
|
||||
|
||||
// pre-allocate memory using the estimation of the average length of the
|
||||
// strings in the given array: this is very imprecise, of course, but
|
||||
// better than nothing
|
||||
str.reserve(count*(arr[0].length() + arr[count-1].length()) / 2);
|
||||
|
||||
if ( escape == wxT('\0') )
|
||||
{
|
||||
// escaping is disabled:
|
||||
for ( size_t i = 0; i < count; i++ )
|
||||
{
|
||||
if ( i )
|
||||
str += sep;
|
||||
str += arr[i];
|
||||
}
|
||||
}
|
||||
else // use escape character
|
||||
{
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
if ( n )
|
||||
str += sep;
|
||||
|
||||
for ( wxString::const_iterator i = arr[n].begin(),
|
||||
end = arr[n].end();
|
||||
i != end;
|
||||
++i )
|
||||
{
|
||||
const wxChar ch = *i;
|
||||
if ( ch == sep )
|
||||
str += escape; // escape this separator
|
||||
str += ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str.Shrink(); // release extra memory if we allocated too much
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
|
||||
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
|
||||
{
|
||||
wxPathList paths;
|
||||
|
||||
paths.AddEnvList( aEnvVar );
|
||||
paths.Insert( aPriorityPath, 0 );
|
||||
|
||||
return wxJoin( paths, wxPATH_SEP[0] );
|
||||
}
|
|
@ -30,6 +30,7 @@
|
|||
#include <gr_basic.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <common.h> // NAMELESS_PROJECT
|
||||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <config_params.h>
|
||||
|
@ -43,14 +44,13 @@ PROJECT::PROJECT()
|
|||
|
||||
PROJECT::~PROJECT()
|
||||
{
|
||||
/* @todo
|
||||
careful here, this may work, but the virtual destructor may not
|
||||
be in the same link image as PROJECT. Won't enable this until
|
||||
we're more stable and destructor is assuredly in same image, i.e.
|
||||
libki.so
|
||||
#if 1
|
||||
// careful here, this may work, but the virtual destructor may not
|
||||
// be in the same link image as PROJECT.
|
||||
|
||||
for( unsigned i = 0; i<DIM(m_elems); ++i )
|
||||
delete m_elems[i];
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ void PROJECT::SetProjectFullName( const wxString& aFullPathAndName )
|
|||
{
|
||||
m_project_name = aFullPathAndName;
|
||||
|
||||
wxASSERT( m_project_name.IsAbsolute() );
|
||||
wxASSERT( m_project_name.GetName() == NAMELESS_PROJECT || m_project_name.IsAbsolute() );
|
||||
#if 0
|
||||
wxASSERT( m_project_name.GetExt() == wxT( ".pro" ) )
|
||||
#else
|
||||
|
@ -305,7 +305,7 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString&
|
|||
void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aFileName,
|
||||
const wxString& aGroupName, const PARAM_CFG_ARRAY& aParams )
|
||||
{
|
||||
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, FORCE_LOCAL_CONFIG ) );
|
||||
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, true ) );
|
||||
|
||||
if( !cfg.get() )
|
||||
{
|
||||
|
@ -353,8 +353,7 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName,
|
|||
|
||||
wxString timestamp = cfg->Read( wxT( "update" ) );
|
||||
|
||||
if( doLoadOnlyIfNew && timestamp.size() &&
|
||||
timestamp == m_pro_date_and_time )
|
||||
if( doLoadOnlyIfNew && timestamp.size() && timestamp == m_pro_date_and_time )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,74 +51,8 @@
|
|||
// The functions we use will cause the program launcher to pull stuff in
|
||||
// during linkage, keep the map file in mind to see what's going into it.
|
||||
|
||||
|
||||
#if !wxCHECK_VERSION( 3, 0, 0 )
|
||||
|
||||
// implement missing wx2.8 function until >= wx3.0 pervades.
|
||||
static wxString wxJoin(const wxArrayString& arr, const wxChar sep,
|
||||
const wxChar escape = '\\')
|
||||
{
|
||||
size_t count = arr.size();
|
||||
if ( count == 0 )
|
||||
return wxEmptyString;
|
||||
|
||||
wxString str;
|
||||
|
||||
// pre-allocate memory using the estimation of the average length of the
|
||||
// strings in the given array: this is very imprecise, of course, but
|
||||
// better than nothing
|
||||
str.reserve(count*(arr[0].length() + arr[count-1].length()) / 2);
|
||||
|
||||
if ( escape == wxT('\0') )
|
||||
{
|
||||
// escaping is disabled:
|
||||
for ( size_t i = 0; i < count; i++ )
|
||||
{
|
||||
if ( i )
|
||||
str += sep;
|
||||
str += arr[i];
|
||||
}
|
||||
}
|
||||
else // use escape character
|
||||
{
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
if ( n )
|
||||
str += sep;
|
||||
|
||||
for ( wxString::const_iterator i = arr[n].begin(),
|
||||
end = arr[n].end();
|
||||
i != end;
|
||||
++i )
|
||||
{
|
||||
const wxChar ch = *i;
|
||||
if ( ch == sep )
|
||||
str += escape; // escape this separator
|
||||
str += ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str.Shrink(); // release extra memory if we allocated too much
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
|
||||
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
|
||||
{
|
||||
wxPathList paths;
|
||||
|
||||
paths.AddEnvList( aEnvVar );
|
||||
paths.Insert( aPriorityPath, 0 );
|
||||
|
||||
return wxJoin( paths, wxPATH_SEP[0] );
|
||||
}
|
||||
|
||||
|
||||
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
|
||||
void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
||||
static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
|
||||
{
|
||||
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
|
||||
// "subsidiary DSOs" in the same directory as the kiway top process modules.
|
||||
|
@ -149,6 +83,7 @@ void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
// POLICY CHOICE 1: return the full path of the DSO to load from single_top.
|
||||
static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
|
||||
{
|
||||
|
@ -186,7 +121,7 @@ static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
|
|||
|
||||
// Only a single KIWAY is supported in this single_top top level component,
|
||||
// which is dedicated to loading only a single DSO.
|
||||
static KIWAY kiway;
|
||||
KIWAY Kiway( &Pgm() );
|
||||
|
||||
|
||||
// implement a PGM_BASE and a wxApp side by side:
|
||||
|
@ -217,21 +152,10 @@ PGM_BASE& Pgm()
|
|||
struct APP_SINGLE_TOP : public wxApp
|
||||
{
|
||||
bool OnInit() // overload wxApp virtual
|
||||
{
|
||||
return Pgm().OnPgmInit( this );
|
||||
}
|
||||
|
||||
int OnExit() // overload wxApp virtual
|
||||
{
|
||||
Pgm().OnPgmExit();
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
int OnRun() // overload wxApp virtual
|
||||
{
|
||||
try
|
||||
{
|
||||
return wxApp::OnRun();
|
||||
return Pgm().OnPgmInit( this );
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
{
|
||||
|
@ -241,16 +165,49 @@ struct APP_SINGLE_TOP : public wxApp
|
|||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
|
||||
GetChars( FROM_UTF8( typeid( ioe ).name() ) ),
|
||||
GetChars( ioe.errorText ) );
|
||||
wxLogError( GetChars( ioe.errorText ) );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
wxLogError( wxT( "Unhandled exception of unknown type" ) );
|
||||
}
|
||||
|
||||
return -1;
|
||||
Pgm().OnPgmExit();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int OnExit() // overload wxApp virtual
|
||||
{
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
int OnRun() // overload wxApp virtual
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
try
|
||||
{
|
||||
ret = wxApp::OnRun();
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
{
|
||||
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
|
||||
GetChars( FROM_UTF8( typeid(e).name() )),
|
||||
GetChars( FROM_UTF8( e.what() ) ) );;
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( GetChars( ioe.errorText ) );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
wxLogError( wxT( "Unhandled exception of unknown type" ) );
|
||||
}
|
||||
|
||||
Pgm().OnPgmExit();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -307,10 +264,30 @@ static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
|
|||
// No further reporting required here.
|
||||
}
|
||||
|
||||
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
|
||||
(void) dso.Detach();
|
||||
else
|
||||
{
|
||||
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
|
||||
(void) dso.Detach();
|
||||
|
||||
return (KIFACE_GETTER_FUNC*) addr;
|
||||
return (KIFACE_GETTER_FUNC*) addr;
|
||||
}
|
||||
|
||||
// There is a file installation bug. We only look for KIFACE_I's which we know
|
||||
// to exist, and we did not find one. If we do not find one, this is an
|
||||
// installation bug.
|
||||
|
||||
wxString msg = wxString::Format( wxT(
|
||||
"Fatal Installation Bug\nmissing file:\n'%s'\n\nargv[0]:\n'%s'" ),
|
||||
GetChars( aDSOName ),
|
||||
GetChars( wxStandardPaths::Get().GetExecutablePath() )
|
||||
);
|
||||
|
||||
// This is a fatal error, one from which we cannot recover, nor do we want
|
||||
// to protect against in client code which would require numerous noisy
|
||||
// tests in numerous places. So we inform the user that the installation
|
||||
// is bad. This exception will likely not get caught until way up in the
|
||||
// wxApp derivative, at which point the process will exit gracefully.
|
||||
THROW_IO_ERROR( msg );
|
||||
|
||||
#else
|
||||
return &KIFACE_GETTER;
|
||||
|
@ -339,7 +316,7 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
|||
|
||||
// Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the
|
||||
// KIFACE has hard dependencies on subsidiary DSOs below it.
|
||||
SetLibEnvVar( absoluteArgv0 );
|
||||
set_lib_env_var( absoluteArgv0 );
|
||||
|
||||
if( !initPgm() )
|
||||
return false;
|
||||
|
@ -364,22 +341,22 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
|||
|
||||
// Give the DSO a single chance to do its "process level" initialization.
|
||||
// "Process level" specifically means stay away from any projects in there.
|
||||
if( !kiface->OnKifaceStart( this ) )
|
||||
if( !kiface->OnKifaceStart( this, KFCTL_STANDALONE ) )
|
||||
return false;
|
||||
|
||||
// Use KIFACE to create a top window that the KIFACE knows about.
|
||||
// TOP_FRAME is passed on compiler command line from CMake, and is one of
|
||||
// the types in ID_DRAWFRAME_TYPE.
|
||||
// the types in FRAME_T.
|
||||
// KIFACE::CreateWindow() is a virtual so we don't need to link to it.
|
||||
// Remember its in the *.kiface DSO.
|
||||
#if 0
|
||||
// this pulls in EDA_DRAW_FRAME type info, which we don't want in
|
||||
// the single_top link image.
|
||||
KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( kiface->CreateWindow(
|
||||
NULL, TOP_FRAME, &kiway, KFCTL_STANDALONE ) );
|
||||
NULL, TOP_FRAME, &Kiway, KFCTL_STANDALONE ) );
|
||||
#else
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
|
||||
NULL, TOP_FRAME, &kiway, KFCTL_STANDALONE );
|
||||
NULL, TOP_FRAME, &Kiway, KFCTL_STANDALONE );
|
||||
#endif
|
||||
|
||||
App().SetTopWindow( frame ); // wxApp gets a face.
|
||||
|
@ -418,8 +395,11 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
|||
if( !argv1.GetExt() )
|
||||
argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) );
|
||||
|
||||
argSet[0] = argv1.GetFullPath();
|
||||
#endif
|
||||
argv1.MakeAbsolute();
|
||||
|
||||
argSet[0] = argv1.GetFullPath();
|
||||
|
||||
if( !Pgm().LockFile( argSet[0] ) )
|
||||
{
|
||||
wxLogSysError( _( "This file is already open." ) );
|
||||
|
@ -479,9 +459,8 @@ void PGM_SINGLE_TOP::OnPgmExit()
|
|||
|
||||
saveCommonSettings();
|
||||
|
||||
// write common settings to disk, and destroy everything in PGM_BASE,
|
||||
// especially wxSingleInstanceCheckerImpl earlier than wxApp and earlier
|
||||
// than static destruction would.
|
||||
// Destroy everything in PGM_BASE, especially wxSingleInstanceCheckerImpl
|
||||
// earlier than wxApp and earlier than static destruction would.
|
||||
PGM_BASE::destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ if( USE_KIWAY_DLLS )
|
|||
${CVPCB_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=CVPCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CVPCB;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( cvpcb
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
|
|
@ -72,7 +72,7 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Footprint Viewer" ),
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
|
||||
{
|
||||
|
|
|
@ -107,7 +107,7 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, CVPCB_FRAME_TYPE, wxT( "CvPCB" ), wxDefaultPosition,
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition,
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
||||
{
|
||||
m_FrameName = CVPCB_MAINFRAME_NAME;
|
||||
|
@ -786,14 +786,10 @@ void CVPCB_MAINFRAME::UpdateTitle()
|
|||
|
||||
void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
|
||||
{
|
||||
char cmd[1024];
|
||||
int selection;
|
||||
COMPONENT* Component;
|
||||
|
||||
if( m_netlist.IsEmpty() )
|
||||
return;
|
||||
|
||||
selection = m_ListCmp->GetSelection();
|
||||
int selection = m_ListCmp->GetSelection();
|
||||
|
||||
if ( selection < 0 )
|
||||
selection = 0;
|
||||
|
@ -801,12 +797,14 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
|
|||
if( m_netlist.GetComponent( selection ) == NULL )
|
||||
return;
|
||||
|
||||
Component = m_netlist.GetComponent( selection );
|
||||
COMPONENT* component = m_netlist.GetComponent( selection );
|
||||
|
||||
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->GetReference() ) );
|
||||
|
||||
SendCommand( MSG_TO_SCH, cmd );
|
||||
std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
SendCommand( MSG_TO_SCH, packet.c_str() );
|
||||
else
|
||||
Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ static struct IFACE : public KIFACE_I
|
|||
KIFACE_I( aName, aType )
|
||||
{}
|
||||
|
||||
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
|
||||
void OnKifaceEnd();
|
||||
|
||||
|
@ -108,7 +108,7 @@ static struct IFACE : public KIFACE_I
|
|||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case CVPCB_FRAME_TYPE:
|
||||
case FRAME_CVPCB:
|
||||
{
|
||||
CVPCB_MAINFRAME* frame = new CVPCB_MAINFRAME( aKiway, aParent );
|
||||
return frame;
|
||||
|
@ -276,13 +276,13 @@ FP_LIB_TABLE GFootprintTable;
|
|||
// we skip setting KISYSMOD here for now. User should set the environment
|
||||
// variable.
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
// This is process level, not project level, initialization of the DSO.
|
||||
|
||||
// Do nothing in here pertinent to a project!
|
||||
|
||||
start_common();
|
||||
start_common( aCtlBits );
|
||||
|
||||
// Set 3D shape path from environment variable KISYS3DMOD
|
||||
set3DShapesPath( wxT("KISYS3DMOD") );
|
||||
|
|
|
@ -720,8 +720,7 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
|
|||
return 0;
|
||||
}
|
||||
|
||||
wxString msg;
|
||||
msg.Printf( _("File %s saved"), GetChars( fn.GetFullPath() ) );
|
||||
wxString msg = wxString::Format( _("File %s saved"), GetChars( fn.GetFullPath() ) );
|
||||
SetStatusText( msg );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ if( USE_KIWAY_DLLS )
|
|||
${EESCHEMA_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=SCHEMATIC_FRAME_TYPE;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( eeschema
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
@ -345,7 +345,7 @@ else()
|
|||
)
|
||||
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=SCHEMATIC_FRAME_TYPE;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
|
|
|
@ -78,7 +78,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Cross probing to Pcbnew if a pin or a component is found */
|
||||
// Cross probing to Pcbnew if a pin or a component is found
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_FIELD_T:
|
||||
|
@ -105,6 +105,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
|
|||
{
|
||||
// Force display pin information (the previous display could be a component info)
|
||||
MSG_PANEL_ITEMS items;
|
||||
|
||||
Pin->GetMsgPanelInfo( items );
|
||||
|
||||
if( LibItem )
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway_express.h>
|
||||
#include <macros.h>
|
||||
#include <eda_dde.h>
|
||||
#include <wxEeschemaStruct.h>
|
||||
|
@ -107,56 +109,95 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem )
|
||||
std::string FormatProbeItem( EDA_ITEM* aComponent, SCH_COMPONENT* aPart )
|
||||
{
|
||||
if( objectToSync == NULL )
|
||||
return;
|
||||
|
||||
LIB_PIN* Pin = NULL;
|
||||
char Line[1024];
|
||||
|
||||
/* Cross probing to Pcbnew if a pin or a component is found */
|
||||
switch( objectToSync->Type() )
|
||||
// Cross probing to Pcbnew if a pin or a component is found
|
||||
switch( aComponent->Type() )
|
||||
{
|
||||
case SCH_FIELD_T:
|
||||
case LIB_FIELD_T:
|
||||
{
|
||||
if( !LibItem )
|
||||
if( !aPart )
|
||||
break;
|
||||
|
||||
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
|
||||
SendCommand( MSG_TO_PCB, Line );
|
||||
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case SCH_COMPONENT_T:
|
||||
LibItem = (SCH_COMPONENT*) objectToSync;
|
||||
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
|
||||
SendCommand( MSG_TO_PCB, Line );
|
||||
break;
|
||||
aPart = (SCH_COMPONENT*) aComponent;
|
||||
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
|
||||
|
||||
case LIB_PIN_T:
|
||||
if( !LibItem )
|
||||
break;
|
||||
|
||||
Pin = (LIB_PIN*) objectToSync;
|
||||
|
||||
if( Pin->GetNumber() )
|
||||
{
|
||||
wxString pinnum;
|
||||
Pin->PinStringNum( pinnum );
|
||||
sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
|
||||
TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
|
||||
}
|
||||
if( !aPart )
|
||||
break;
|
||||
|
||||
SendCommand( MSG_TO_PCB, Line );
|
||||
LIB_PIN* pin = (LIB_PIN*) aComponent;
|
||||
|
||||
if( pin->GetNumber() )
|
||||
{
|
||||
wxString pinnum;
|
||||
|
||||
pin->PinStringNum( pinnum );
|
||||
|
||||
return StrPrintf( "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
|
||||
TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* aComponent, SCH_COMPONENT* aPart )
|
||||
{
|
||||
#if 1
|
||||
wxASSERT( aComponent ); // fix the caller
|
||||
|
||||
#else // WTF?
|
||||
if( !aComponent ) // caller remains eternally stupid.
|
||||
return;
|
||||
#endif
|
||||
|
||||
std::string packet = FormatProbeItem( aComponent, aPart );
|
||||
|
||||
if( packet.size() )
|
||||
{
|
||||
if( Kiface().IsSingle() )
|
||||
SendCommand( MSG_TO_PCB, packet.c_str() );
|
||||
else
|
||||
{
|
||||
// Typically ExpressMail is going to be s-expression packets, but since
|
||||
// we have existing interpreter of the cross probe packet on the other
|
||||
// side in place, we use that here.
|
||||
Kiway().ExpressMail( FRAME_PCB, MAIL_CROSS_PROBE, packet, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||
{
|
||||
const std::string& payload = mail.GetPayload();
|
||||
|
||||
switch( mail.Command() )
|
||||
{
|
||||
case MAIL_CROSS_PROBE:
|
||||
ExecuteRemoteCommand( payload.c_str() );
|
||||
break;
|
||||
|
||||
// many many others.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ static struct IFACE : public KIFACE_I
|
|||
KIFACE_I( aName, aType )
|
||||
{}
|
||||
|
||||
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
|
||||
void OnKifaceEnd( PGM_BASE* aProgram )
|
||||
{
|
||||
|
@ -79,15 +79,7 @@ static struct IFACE : public KIFACE_I
|
|||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case LIBEDITOR_FRAME_TYPE:
|
||||
{
|
||||
LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway,
|
||||
dynamic_cast<SCH_EDIT_FRAME*>( aParent ) );
|
||||
return frame;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCHEMATIC_FRAME_TYPE:
|
||||
case FRAME_SCH:
|
||||
{
|
||||
SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
|
||||
|
||||
|
@ -96,9 +88,19 @@ static struct IFACE : public KIFACE_I
|
|||
// Read a default config file in case no project given on command line.
|
||||
frame->LoadProjectFile( wxEmptyString, true );
|
||||
|
||||
// @todo temporary
|
||||
CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER );
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
// only run this under single_top, not under a project manager.
|
||||
CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER );
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
break;
|
||||
|
||||
case FRAME_SCH_LIB_EDITOR:
|
||||
{
|
||||
LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway,
|
||||
dynamic_cast<SCH_EDIT_FRAME*>( aParent ) );
|
||||
return frame;
|
||||
}
|
||||
break;
|
||||
|
@ -152,13 +154,13 @@ PGM_BASE& Pgm()
|
|||
}
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
// This is process level, not project level, initialization of the DSO.
|
||||
|
||||
// Do nothing in here pertinent to a project!
|
||||
|
||||
start_common();
|
||||
start_common( aCtlBits );
|
||||
|
||||
// Give a default colour for all layers
|
||||
// (actual color will be initialized by config)
|
||||
|
|
|
@ -810,7 +810,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
|
|||
if( aPanel && aPanel->GetParent() )
|
||||
frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
|
||||
|
||||
if( frame && frame->IsType( SCHEMATIC_FRAME_TYPE ) &&
|
||||
if( frame && frame->IsType( FRAME_SCH ) &&
|
||||
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
|
||||
return;
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ END_EVENT_TABLE()
|
|||
#define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
|
||||
|
||||
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, SCH_EDIT_FRAME* aParent ) :
|
||||
SCH_BASE_FRAME( aKiway, aParent, LIBEDITOR_FRAME_TYPE, _( "Library Editor" ),
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() )
|
||||
{
|
||||
wxASSERT( aParent ); // LIB_EDIT_FRAME needs a parent, since it peeks up there.
|
||||
|
|
|
@ -64,20 +64,22 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Menu File:
|
||||
wxMenu* fileMenu = new wxMenu;
|
||||
|
||||
// New
|
||||
AddMenuItem( fileMenu,
|
||||
ID_NEW_PROJECT,
|
||||
_( "&New Schematic Project" ),
|
||||
_( "Clear current schematic hierarchy and start a new schematic root sheet" ),
|
||||
KiBitmap( new_xpm ) );
|
||||
if( Kiface().IsSingle() ) // not when under a project mgr
|
||||
{
|
||||
AddMenuItem( fileMenu,
|
||||
ID_NEW_PROJECT,
|
||||
_( "&New Schematic Project" ),
|
||||
_( "Clear current schematic hierarchy and start a new schematic root sheet" ),
|
||||
KiBitmap( new_xpm ) );
|
||||
|
||||
// Open
|
||||
text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH );
|
||||
AddMenuItem( fileMenu,
|
||||
ID_LOAD_PROJECT, text,
|
||||
_( "Open an existing schematic hierarchy" ),
|
||||
KiBitmap( open_document_xpm ) );
|
||||
text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH );
|
||||
AddMenuItem( fileMenu,
|
||||
ID_LOAD_PROJECT, text,
|
||||
_( "Open an existing schematic hierarchy" ),
|
||||
KiBitmap( open_document_xpm ) );
|
||||
}
|
||||
|
||||
// @todo: static probably not OK in multiple open projects.
|
||||
// Open Recent submenu
|
||||
static wxMenu* openRecentMenu;
|
||||
|
||||
|
@ -91,21 +93,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
Kiface().GetFileHistory().UseMenu( openRecentMenu );
|
||||
Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu );
|
||||
|
||||
AddMenuItem( fileMenu, openRecentMenu,
|
||||
wxID_ANY, _( "Open &Recent" ),
|
||||
_( "Open a recent opened schematic project" ),
|
||||
KiBitmap( open_project_xpm ) );
|
||||
if( Kiface().IsSingle() ) // not when under a project mgr
|
||||
{
|
||||
AddMenuItem( fileMenu, openRecentMenu,
|
||||
wxID_ANY, _( "Open &Recent" ),
|
||||
_( "Open a recent opened schematic project" ),
|
||||
KiBitmap( open_project_xpm ) );
|
||||
}
|
||||
|
||||
// Import
|
||||
AddMenuItem( fileMenu,
|
||||
ID_APPEND_PROJECT, _( "&Append Schematic Sheet" ),
|
||||
_( "Append schematic sheet to current project" ),
|
||||
KiBitmap( open_document_xpm ) );
|
||||
|
||||
// Separator
|
||||
fileMenu->AppendSeparator();
|
||||
|
||||
// Save schematic project
|
||||
text = AddHotkeyName( _( "&Save Schematic Project" ),
|
||||
s_Schematic_Hokeys_Descr, HK_SAVE_SCH );
|
||||
AddMenuItem( fileMenu,
|
||||
|
@ -113,31 +115,29 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "Save all sheets in schematic project" ),
|
||||
KiBitmap( save_project_xpm ) );
|
||||
|
||||
// Save current sheet
|
||||
AddMenuItem( fileMenu,
|
||||
ID_UPDATE_ONE_SHEET,
|
||||
_( "Save &Current Sheet Only" ),
|
||||
_( "Save only current schematic sheet" ),
|
||||
KiBitmap( save_xpm ) );
|
||||
|
||||
// Save current sheet as
|
||||
AddMenuItem( fileMenu,
|
||||
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
|
||||
_( "Save Current Sheet &As" ),
|
||||
_( "Save current schematic sheet as..." ),
|
||||
KiBitmap( save_as_xpm ) );
|
||||
if( Kiface().IsSingle() ) // not when under a project mgr
|
||||
{
|
||||
AddMenuItem( fileMenu,
|
||||
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
|
||||
_( "Save Current Sheet &As" ),
|
||||
_( "Save current schematic sheet as..." ),
|
||||
KiBitmap( save_as_xpm ) );
|
||||
}
|
||||
|
||||
// Separator
|
||||
fileMenu->AppendSeparator();
|
||||
|
||||
// Page settings
|
||||
AddMenuItem( fileMenu,
|
||||
ID_SHEET_SET,
|
||||
_( "Pa&ge Settings" ),
|
||||
_( "Setting for sheet size and frame references" ),
|
||||
KiBitmap( sheetset_xpm ) );
|
||||
|
||||
// Print
|
||||
AddMenuItem( fileMenu,
|
||||
wxID_PRINT,
|
||||
_( "Pri&nt" ),
|
||||
|
@ -155,7 +155,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
// Plot to Clipboard (Windows only)
|
||||
|
||||
|
||||
AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
|
||||
_( "Plot to &Clipboard" ),
|
||||
_( "Export drawings to clipboard" ),
|
||||
|
@ -243,32 +242,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
* using in AddHotkeyName call the option "false" (not a shortcut)
|
||||
*/
|
||||
|
||||
// Zoom in
|
||||
text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
|
||||
|
||||
// Zoom out
|
||||
text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut
|
||||
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
|
||||
|
||||
// Fit on screen
|
||||
text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) );
|
||||
|
||||
// Separator
|
||||
viewMenu->AppendSeparator();
|
||||
|
||||
// Hierarchy
|
||||
AddMenuItem( viewMenu,
|
||||
ID_HIERARCHY,
|
||||
_( "Show &Hierarchical Navigator" ),
|
||||
_( "Navigate hierarchical sheets" ),
|
||||
KiBitmap( hierarchy_nav_xpm ) );
|
||||
|
||||
// Redraw
|
||||
text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
|
||||
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
|
||||
|
||||
|
@ -276,78 +269,66 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// @todo unify IDs
|
||||
wxMenu* placeMenu = new wxMenu;
|
||||
|
||||
// Component
|
||||
text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
|
||||
HELP_PLACE_COMPONENTS,
|
||||
KiBitmap( add_component_xpm ) );
|
||||
|
||||
// Power port
|
||||
text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
|
||||
HELP_PLACE_POWERPORT,
|
||||
KiBitmap( add_power_xpm ) );
|
||||
|
||||
// Wire
|
||||
text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr,
|
||||
HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_WIRE_BUTT, text,
|
||||
HELP_PLACE_WIRE,
|
||||
KiBitmap( add_line_xpm ) );
|
||||
|
||||
// Bus
|
||||
text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr,
|
||||
HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_BUS_BUTT, text,
|
||||
HELP_PLACE_BUS,
|
||||
KiBitmap( add_bus_xpm ) );
|
||||
|
||||
// Wire to Bus entry
|
||||
text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
|
||||
HELP_PLACE_WIRE2BUS_ENTRY,
|
||||
KiBitmap( add_line2bus_xpm ) );
|
||||
|
||||
// Bus to Bus entry
|
||||
text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
|
||||
HELP_PLACE_BUS2BUS_ENTRY,
|
||||
KiBitmap( add_bus2bus_xpm ) );
|
||||
|
||||
// No Connect Flag
|
||||
text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) );
|
||||
|
||||
// Net name
|
||||
text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_LABEL_BUTT, text,
|
||||
HELP_PLACE_NETLABEL,
|
||||
KiBitmap( add_line_label_xpm ) );
|
||||
|
||||
// Global label
|
||||
text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_GLABEL_BUTT, text,
|
||||
HELP_PLACE_GLOBALLABEL,
|
||||
KiBitmap( add_glabel_xpm ) );
|
||||
|
||||
// Junction
|
||||
text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text,
|
||||
HELP_PLACE_JUNCTION,
|
||||
KiBitmap( add_junction_xpm ) );
|
||||
|
||||
// Separator
|
||||
placeMenu->AppendSeparator();
|
||||
|
||||
// Hierarchical label
|
||||
text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_HIERLABEL_BUTT,
|
||||
|
@ -355,38 +336,32 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
KiBitmap( add_hierarchical_label_xpm ) );
|
||||
|
||||
|
||||
// Hierarchical sheet
|
||||
text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
|
||||
HELP_PLACE_SHEET,
|
||||
KiBitmap( add_hierarchical_subsheet_xpm ) );
|
||||
|
||||
// Import hierarchical sheet
|
||||
AddMenuItem( placeMenu,
|
||||
ID_IMPORT_HLABEL_BUTT,
|
||||
_( "I&mport Hierarchical Label" ),
|
||||
HELP_IMPORT_SHEETPIN,
|
||||
KiBitmap( import_hierarchical_label_xpm ) );
|
||||
|
||||
// Add hierarchical Pin to Sheet
|
||||
AddMenuItem( placeMenu,
|
||||
ID_SHEET_PIN_BUTT,
|
||||
_( "Hierarchical Pi&n to Sheet" ),
|
||||
HELP_PLACE_SHEETPIN,
|
||||
KiBitmap( add_hierar_pin_xpm ) );
|
||||
|
||||
// Separator
|
||||
placeMenu->AppendSeparator();
|
||||
|
||||
// Graphic line or polygon
|
||||
text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
|
||||
HELP_PLACE_GRAPHICLINES,
|
||||
KiBitmap( add_dashed_line_xpm ) );
|
||||
|
||||
// Graphic text
|
||||
text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
|
||||
AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
|
||||
|
@ -437,14 +412,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Separator
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
||||
// Save preferences
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_CONFIG_SAVE,
|
||||
_( "&Save Preferences" ),
|
||||
_( "Save application preferences" ),
|
||||
KiBitmap( save_setup_xpm ) );
|
||||
|
||||
// Read preferences
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_CONFIG_READ,
|
||||
_( "&Read Preferences" ),
|
||||
|
@ -454,22 +427,18 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Menu Tools:
|
||||
wxMenu* toolsMenu = new wxMenu;
|
||||
|
||||
// Library editor
|
||||
AddMenuItem( toolsMenu,
|
||||
ID_TO_LIBRARY,
|
||||
_( "Library &Editor" ), HELP_RUN_LIB_EDITOR,
|
||||
KiBitmap( libedit_xpm ) );
|
||||
|
||||
// Library viewer
|
||||
AddMenuItem( toolsMenu,
|
||||
ID_TO_LIBVIEW,
|
||||
_( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
|
||||
KiBitmap( library_browse_xpm ) );
|
||||
|
||||
// Separator
|
||||
toolsMenu->AppendSeparator();
|
||||
|
||||
// Annotate
|
||||
AddMenuItem( toolsMenu,
|
||||
ID_GET_ANNOTATE,
|
||||
_( "&Annotate Schematic" ), HELP_ANNOTATE,
|
||||
|
@ -482,24 +451,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "Perform electrical rule check" ),
|
||||
KiBitmap( erc_xpm ) );
|
||||
|
||||
// Generate netlist
|
||||
AddMenuItem( toolsMenu,
|
||||
ID_GET_NETLIST,
|
||||
_( "Generate &Netlist File" ),
|
||||
_( "Generate the component netlist file" ),
|
||||
KiBitmap( netlist_xpm ) );
|
||||
|
||||
// Generate bill of materials
|
||||
AddMenuItem( toolsMenu,
|
||||
ID_GET_TOOLS,
|
||||
_( "Generate Bill of &Materials" ),
|
||||
HELP_GENERATE_BOM,
|
||||
KiBitmap( bom_xpm ) );
|
||||
|
||||
// Separator
|
||||
toolsMenu->AppendSeparator();
|
||||
|
||||
//Run CvPcb
|
||||
// Run CvPcb
|
||||
AddMenuItem( toolsMenu,
|
||||
ID_TO_CVPCB,
|
||||
_( "A&ssign Component Footprint" ),
|
||||
|
@ -519,7 +485,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Version info
|
||||
AddHelpVersionInfoMenuEntry( helpMenu );
|
||||
|
||||
// Contents
|
||||
AddMenuItem( helpMenu,
|
||||
wxID_HELP,
|
||||
_( "Eesc&hema Manual" ),
|
||||
|
@ -532,7 +497,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
|
||||
KiBitmap( help_xpm ) );
|
||||
|
||||
// About Eeschema
|
||||
helpMenu->AppendSeparator();
|
||||
AddMenuItem( helpMenu,
|
||||
wxID_ABOUT,
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
|
||||
SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aWindowType, const wxString& aTitle,
|
||||
FRAME_T aWindowType, const wxString& aTitle,
|
||||
const wxPoint& aPosition, const wxSize& aSize, long aStyle,
|
||||
const wxString& aFrameName ) :
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition,
|
||||
|
|
|
@ -35,19 +35,6 @@
|
|||
* They can be renamed and can appear in reports
|
||||
*/
|
||||
|
||||
/* set USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR to 0 to use
|
||||
* a justification relative to the text itself
|
||||
* i.e. justification relative to an horizontal text
|
||||
* or to 1 to keep the initial Eeschema behavior
|
||||
* The initial behavior is:
|
||||
* For vertical texts, exchange the horizontal and the vertical justification
|
||||
* The idea is to keep the justification always left or top for instance,
|
||||
* no matter the text orientation
|
||||
* This is a bit tricky when you want to change a text field justification
|
||||
* when the fiels and the component are both rotated 90.0 degrees
|
||||
*/
|
||||
#define USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR 0
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <base_struct.h>
|
||||
|
@ -206,7 +193,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
|
|||
textpos = m_Pos - origin;
|
||||
textpos = parentComponent->GetScreenCoord( textpos );
|
||||
textpos += parentComponent->GetPosition();
|
||||
GRLine( clipbox, DC, origin.x, origin.y, textpos.x, textpos.y, 2, DARKGRAY );
|
||||
GRLine( clipbox, DC, origin, textpos, 2, DARKGRAY );
|
||||
}
|
||||
|
||||
/* Enable this to draw the bounding box around the text field to validate
|
||||
|
@ -281,26 +268,14 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
|||
// Calculate the text bounding box:
|
||||
EDA_RECT rect;
|
||||
|
||||
// set USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR to 0 to use
|
||||
// a justification relative to the text itself
|
||||
// i.e. justification relative to an horizontal text
|
||||
// or to 1 to keep the initial behavior
|
||||
#if (USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR == 1 )
|
||||
if( m_Orient == TEXT_ORIENT_VERT )
|
||||
if( m_id == REFERENCE ) // multi units have one letter or more added to reference
|
||||
{
|
||||
// For vertical texts, exchange the horizontal and the vertical justification
|
||||
// The idea is to keep the justification always left or top for instance,
|
||||
// no matter the text orientation
|
||||
SCH_FIELD text( *this ); // Make a local copy to swap justifications
|
||||
SCH_FIELD text( *this ); // Make a local copy to change text
|
||||
// because GetBoundingBox() is const
|
||||
int tmp = (int)text.m_VJustify;
|
||||
NEGATE( tmp );
|
||||
text.m_VJustify = (EDA_TEXT_VJUSTIFY_T)text.m_HJustify;
|
||||
text.m_HJustify = (EDA_TEXT_HJUSTIFY_T)tmp;
|
||||
text.SetText( GetFullyQualifiedText() );
|
||||
rect = text.GetTextBox( -1, linewidth );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
rect = GetTextBox( -1, linewidth );
|
||||
|
||||
// Calculate the bounding box position relative to the component:
|
||||
|
|
|
@ -1345,7 +1345,7 @@ SCH_SCREEN* SCH_SCREENS::GetNext()
|
|||
}
|
||||
|
||||
|
||||
SCH_SCREEN* SCH_SCREENS::GetScreen( unsigned int aIndex )
|
||||
SCH_SCREEN* SCH_SCREENS::GetScreen( unsigned int aIndex ) const
|
||||
{
|
||||
if( aIndex < m_screens.size() )
|
||||
return m_screens[ aIndex ];
|
||||
|
|
|
@ -112,7 +112,7 @@ int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
|
|||
}
|
||||
|
||||
|
||||
SCH_SHEET* SCH_SHEET_PATH::Last()
|
||||
SCH_SHEET* SCH_SHEET_PATH::Last() const
|
||||
{
|
||||
if( m_numSheets )
|
||||
return m_sheets[m_numSheets - 1];
|
||||
|
@ -121,7 +121,7 @@ SCH_SHEET* SCH_SHEET_PATH::Last()
|
|||
}
|
||||
|
||||
|
||||
SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
|
||||
SCH_SCREEN* SCH_SHEET_PATH::LastScreen() const
|
||||
{
|
||||
SCH_SHEET* lastSheet = Last();
|
||||
|
||||
|
@ -132,7 +132,7 @@ SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
|
|||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
|
||||
SCH_ITEM* SCH_SHEET_PATH::LastDrawList() const
|
||||
{
|
||||
SCH_SHEET* lastSheet = Last();
|
||||
|
||||
|
@ -143,7 +143,7 @@ SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
|
|||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_PATH::FirstDrawList()
|
||||
SCH_ITEM* SCH_SHEET_PATH::FirstDrawList() const
|
||||
{
|
||||
SCH_ITEM* item = NULL;
|
||||
|
||||
|
@ -316,7 +316,7 @@ void SCH_SHEET_PATH::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aInclu
|
|||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
|
||||
SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
||||
{
|
||||
bool hasWrapped = false;
|
||||
bool firstItemFound = false;
|
||||
|
@ -349,7 +349,7 @@ SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool
|
|||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
|
||||
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
||||
{
|
||||
bool hasWrapped = false;
|
||||
bool firstItemFound = false;
|
||||
|
|
|
@ -129,20 +129,20 @@ public:
|
|||
* returns a pointer to the last sheet of the list
|
||||
* One can see the others sheet as the "path" to reach this last sheet
|
||||
*/
|
||||
SCH_SHEET* Last();
|
||||
SCH_SHEET* Last() const;
|
||||
|
||||
/**
|
||||
* Function LastScreen
|
||||
* @return the SCH_SCREEN relative to the last sheet in list
|
||||
*/
|
||||
SCH_SCREEN* LastScreen();
|
||||
SCH_SCREEN* LastScreen() const;
|
||||
|
||||
/**
|
||||
* Function LastDrawList
|
||||
* @return a pointer to the first schematic item handled by the
|
||||
* SCH_SCREEN relative to the last sheet in list
|
||||
*/
|
||||
SCH_ITEM* LastDrawList();
|
||||
SCH_ITEM* LastDrawList() const;
|
||||
|
||||
/**
|
||||
* Get the last schematic item relative to the first sheet in the list.
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
* @return Last schematic item relative to the first sheet in the list if list
|
||||
* is not empty. Otherwise NULL.
|
||||
*/
|
||||
SCH_ITEM* FirstDrawList();
|
||||
SCH_ITEM* FirstDrawList() const;
|
||||
|
||||
/**
|
||||
* Function Push
|
||||
|
@ -248,7 +248,7 @@ public:
|
|||
* is defined.
|
||||
* @return - The next schematic item if found. Otherwise, NULL is returned.
|
||||
*/
|
||||
SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false );
|
||||
SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const;
|
||||
|
||||
/**
|
||||
* Find the previous schematic item in this sheet path object.
|
||||
|
@ -260,7 +260,7 @@ public:
|
|||
* is defined.
|
||||
* @return - The previous schematic item if found. Otherwise, NULL is returned.
|
||||
*/
|
||||
SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false );
|
||||
SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const;
|
||||
|
||||
SCH_SHEET_PATH& operator=( const SCH_SHEET_PATH& d1 );
|
||||
|
||||
|
@ -318,7 +318,7 @@ public:
|
|||
* @return the number of sheets in list:
|
||||
* usually the number of sheets found in the whole hierarchy
|
||||
*/
|
||||
int GetCount() { return m_count; }
|
||||
int GetCount() const { return m_count; }
|
||||
|
||||
/**
|
||||
* Function GetFirst
|
||||
|
|
|
@ -176,7 +176,7 @@ END_EVENT_TABLE()
|
|||
#define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
|
||||
|
||||
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
SCH_BASE_FRAME( aKiway, aParent, SCHEMATIC_FRAME_TYPE, wxT( "Eeschema" ),
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
|
||||
m_item_to_repeat( 0 )
|
||||
{
|
||||
|
@ -764,9 +764,23 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
|
|||
{
|
||||
fn.SetExt( PcbFileExtension );
|
||||
|
||||
wxString filename = QuoteFullPath( fn );
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
wxString filename = QuoteFullPath( fn );
|
||||
ExecuteFile( this, PCBNEW_EXE, filename );
|
||||
}
|
||||
else
|
||||
{
|
||||
KIWAY_PLAYER* player = Kiway().Player( FRAME_PCB, false ); // test open already.
|
||||
|
||||
ExecuteFile( this, PCBNEW_EXE, filename );
|
||||
if( !player )
|
||||
{
|
||||
player = Kiway().Player( FRAME_PCB, true );
|
||||
player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
player->Show( true );
|
||||
}
|
||||
player->Raise();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -783,7 +797,22 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
|
|||
|
||||
if( fn.IsOk() && fn.FileExists() )
|
||||
{
|
||||
ExecuteFile( this, CVPCB_EXE, QuoteFullPath( fn ) );
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
ExecuteFile( this, CVPCB_EXE, QuoteFullPath( fn ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
|
||||
|
||||
if( !player )
|
||||
{
|
||||
player = Kiway().Player( FRAME_CVPCB, true );
|
||||
player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
player->Show( true );
|
||||
}
|
||||
player->Raise();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -802,13 +831,15 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
|||
|
||||
if( (item == NULL) || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
|
||||
{
|
||||
wxMessageBox( _("Error: not a component or no component" ) );
|
||||
wxMessageBox( _( "Error: not a component or no component" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
component = (SCH_COMPONENT*) item;
|
||||
}
|
||||
|
||||
// @todo: should be changed to use Kiway().Player()?
|
||||
|
||||
LIB_EDIT_FRAME* libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
|
||||
if( libeditFrame )
|
||||
{
|
||||
|
@ -819,7 +850,9 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
wxWindow* w = Kiface().CreateWindow( this, LIBEDITOR_FRAME_TYPE, &Kiway() );
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
wxWindow* w = kf.CreateWindow( this, FRAME_SCH_LIB_EDITOR, &Kiway(), kf.StartFlags() );
|
||||
libeditFrame = dynamic_cast<LIB_EDIT_FRAME*>( w );
|
||||
}
|
||||
|
||||
|
@ -1040,3 +1073,4 @@ void SCH_EDIT_FRAME::UpdateTitle()
|
|||
|
||||
SetTitle( title );
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,11 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
//#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
#include <wxEeschemaStruct.h>
|
||||
#include <base_units.h>
|
||||
|
||||
//#include <general.h>
|
||||
#include <sch_sheet.h>
|
||||
|
||||
#include <dialogs/dialog_sch_sheet_props.h>
|
||||
|
|
|
@ -97,7 +97,7 @@ static wxAcceleratorEntry accels[] =
|
|||
|
||||
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, SCH_BASE_FRAME* aParent,
|
||||
CMP_LIBRARY* aLibrary, wxSemaphore* aSemaphore, long aStyle ) :
|
||||
SCH_BASE_FRAME( aKiway, aParent, VIEWER_FRAME_TYPE, _( "Library Browser" ),
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_VIEWER, _( "Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize, aStyle, GetLibViewerFrameName() )
|
||||
{
|
||||
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
||||
|
|
|
@ -100,7 +100,7 @@ if( USE_KIWAY_DLLS )
|
|||
${GERBVIEW_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=GERBER_FRAME_TYPE;BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_GERBER;BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( gerbview
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
~GBR_SCREEN();
|
||||
|
||||
GBR_SCREEN* Next() { return (GBR_SCREEN*) Pnext; }
|
||||
GBR_SCREEN* Next() const { return static_cast<GBR_SCREEN*>( Pnext ); }
|
||||
|
||||
// void SetNextZoom();
|
||||
// void SetPreviousZoom();
|
||||
|
|
|
@ -116,8 +116,8 @@ public:
|
|||
*/
|
||||
GERBER_DRAW_ITEM* Copy() const;
|
||||
|
||||
GERBER_DRAW_ITEM* Next() const { return (GERBER_DRAW_ITEM*) Pnext; }
|
||||
GERBER_DRAW_ITEM* Back() const { return (GERBER_DRAW_ITEM*) Pback; }
|
||||
GERBER_DRAW_ITEM* Next() const { return static_cast<GERBER_DRAW_ITEM*>( Pnext ); }
|
||||
GERBER_DRAW_ITEM* Back() const { return static_cast<GERBER_DRAW_ITEM*>( Pback ); }
|
||||
|
||||
/**
|
||||
* Function GetLayer
|
||||
|
|
|
@ -73,7 +73,7 @@ static struct IFACE : public KIFACE_I
|
|||
KIFACE_I( aName, aType )
|
||||
{}
|
||||
|
||||
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
|
||||
void OnKifaceEnd();
|
||||
|
||||
|
@ -81,7 +81,7 @@ static struct IFACE : public KIFACE_I
|
|||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case GERBER_FRAME_TYPE:
|
||||
case FRAME_GERBER:
|
||||
{
|
||||
GERBVIEW_FRAME* frame = new GERBVIEW_FRAME( aKiway, aParent );
|
||||
|
||||
|
@ -145,9 +145,9 @@ PGM_BASE& Pgm()
|
|||
}
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
start_common();
|
||||
start_common( aCtlBits );
|
||||
|
||||
// Must be called before creating the main frame in order to
|
||||
// display the real hotkeys in menus or tool tips
|
||||
|
|
|
@ -65,7 +65,7 @@ static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBloc
|
|||
#define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
|
||||
|
||||
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
EDA_DRAW_FRAME( aKiway, aParent, GERBER_FRAME_TYPE, wxT( "GerbView" ),
|
||||
EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
|
||||
{
|
||||
m_colorsSettings = &g_ColorsSettings;
|
||||
|
|
|
@ -375,8 +375,8 @@ public:
|
|||
void SetTimeStamp( time_t aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
|
||||
time_t GetTimeStamp() const { return m_TimeStamp; }
|
||||
|
||||
EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; }
|
||||
EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; }
|
||||
EDA_ITEM* Next() const { return Pnext; }
|
||||
EDA_ITEM* Back() const { return Pback; }
|
||||
EDA_ITEM* GetParent() const { return m_Parent; }
|
||||
DHEAD* GetList() const { return m_List; }
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <pcbstruct.h> // NB_COLORS
|
||||
#include <class_pad.h>
|
||||
#include <class_track.h>
|
||||
#include <config_params.h>
|
||||
|
||||
|
||||
|
@ -19,7 +20,7 @@ class BOARD_DESIGN_SETTINGS
|
|||
public:
|
||||
bool m_MicroViasAllowed; ///< true to allow micro vias
|
||||
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
|
||||
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
|
||||
VIATYPE_T m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
|
||||
|
||||
/// if true, when creating a new track starting on an existing track, use this track width
|
||||
bool m_UseConnectedTrackWidth;
|
||||
|
|
|
@ -106,8 +106,8 @@ public:
|
|||
*/
|
||||
static wxPoint ZeroOffset;
|
||||
|
||||
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
|
||||
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
|
||||
BOARD_ITEM* Next() const { return static_cast<BOARD_ITEM*>( Pnext ); }
|
||||
BOARD_ITEM* Back() const { return static_cast<BOARD_ITEM*>( Pback ); }
|
||||
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
~PCB_SCREEN();
|
||||
|
||||
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
|
||||
PCB_SCREEN* Next() const { return static_cast<PCB_SCREEN*>( Pnext ); }
|
||||
|
||||
void SetNextZoom();
|
||||
void SetPreviousZoom();
|
||||
|
|
|
@ -523,7 +523,7 @@ public:
|
|||
int GetCount() const { return m_screens.size(); }
|
||||
SCH_SCREEN* GetFirst();
|
||||
SCH_SCREEN* GetNext();
|
||||
SCH_SCREEN* GetScreen( unsigned int aIndex );
|
||||
SCH_SCREEN* GetScreen( unsigned int aIndex ) const;
|
||||
|
||||
/**
|
||||
* Function ClearAnnotation
|
||||
|
|
|
@ -610,4 +610,8 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack );
|
|||
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName );
|
||||
|
||||
|
||||
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
|
||||
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath );
|
||||
|
||||
|
||||
#endif // INCLUDE__COMMON_H_
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
|
||||
|
||||
#define CONFIG_VERSION 1
|
||||
#define FORCE_LOCAL_CONFIG true
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -118,7 +118,7 @@ protected:
|
|||
|
||||
public:
|
||||
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aFrameType,
|
||||
FRAME_T aFrameType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle,
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef FRAME_T_H_
|
||||
#define FRAME_T_H_
|
||||
|
||||
/**
|
||||
* Enum FRAME_T
|
||||
* is the set of EDA_BASE_FRAME derivatives, typically stored in
|
||||
* EDA_BASE_FRAME::m_Ident.
|
||||
*/
|
||||
enum FRAME_T
|
||||
{
|
||||
FRAME_SCH,
|
||||
FRAME_SCH_LIB_EDITOR,
|
||||
FRAME_SCH_VIEWER,
|
||||
FRAME_PCB,
|
||||
FRAME_PCB_MODULE_EDITOR,
|
||||
FRAME_PCB_MODULE_VIEWER,
|
||||
FRAME_PCB_FOOTPRINT_WIZARD,
|
||||
FRAME_PCB_DISPLAY3D,
|
||||
FRAME_CVPCB,
|
||||
FRAME_CVPCB_DISPLAY,
|
||||
FRAME_GERBER,
|
||||
|
||||
KIWAY_PLAYER_COUNT, // counts subset of FRAME_T's tracked in class KIWAY
|
||||
|
||||
KICAD_MAIN_FRAME_T = KIWAY_PLAYER_COUNT,
|
||||
FRAME_PL_EDITOR,
|
||||
//TEXT_EDITOR_FRAME_T,
|
||||
|
||||
FRAME_T_COUNT
|
||||
};
|
||||
|
||||
#endif // FRAME_T_H_
|
|
@ -32,10 +32,10 @@
|
|||
|
||||
#define ASSERT assert // RTree uses ASSERT( condition )
|
||||
#ifndef Min
|
||||
#define Min std::min
|
||||
#define rMin std::min
|
||||
#endif // Min
|
||||
#ifndef Max
|
||||
#define Max std::max
|
||||
#define rMax std::max
|
||||
#endif // Max
|
||||
|
||||
//
|
||||
|
@ -1326,8 +1326,8 @@ typename RTREE_QUAL::Rect RTREE_QUAL::CombineRect( Rect* a_rectA, Rect* a_rectB
|
|||
|
||||
for( int index = 0; index < NUMDIMS; ++index )
|
||||
{
|
||||
newRect.m_min[index] = Min( a_rectA->m_min[index], a_rectB->m_min[index] );
|
||||
newRect.m_max[index] = Max( a_rectA->m_max[index], a_rectB->m_max[index] );
|
||||
newRect.m_min[index] = rMin( a_rectA->m_min[index], a_rectB->m_min[index] );
|
||||
newRect.m_max[index] = rMax( a_rectA->m_max[index], a_rectB->m_max[index] );
|
||||
}
|
||||
|
||||
return newRect;
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
// see base class KIFACE in kiway.h for doxygen docs
|
||||
|
||||
VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram ) = 0;
|
||||
VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) = 0;
|
||||
/*
|
||||
{
|
||||
typically call start_common() in your overload
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
|
||||
VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent,
|
||||
int aClassId, KIWAY* aKIWAY, int aCtlBits = 0 ) = 0;
|
||||
int aClassId, KIWAY* aKIWAY, int aCtlBits ) = 0;
|
||||
|
||||
VTBL_ENTRY void* IfaceOrAddress( int aDataId ) = 0;
|
||||
|
||||
|
@ -76,7 +76,8 @@ public:
|
|||
*/
|
||||
KIFACE_I( const char* aKifaceName, KIWAY::FACE_T aId ) :
|
||||
m_id( aId ),
|
||||
m_bm( aKifaceName )
|
||||
m_bm( aKifaceName ),
|
||||
m_start_flags( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,7 @@ public:
|
|||
protected:
|
||||
|
||||
/// Common things to do for a top program module, during OnKifaceStart().
|
||||
bool start_common();
|
||||
bool start_common( int aCtlBits );
|
||||
|
||||
/// Common things to do for a top program module, during OnKifaceEnd();
|
||||
void end_common();
|
||||
|
@ -100,6 +101,18 @@ public:
|
|||
|
||||
wxConfigBase* KifaceSettings() const { return m_bm.m_config; }
|
||||
|
||||
/**
|
||||
* Function StartFlags
|
||||
* returns whatever was passed as @a aCtlBits to OnKifaceStart()
|
||||
*/
|
||||
int StartFlags() const { return m_start_flags; }
|
||||
|
||||
/**
|
||||
* Function IsSingle
|
||||
* is this KIFACE_I running under single_top?
|
||||
*/
|
||||
bool IsSingle() const { return m_start_flags & KFCTL_STANDALONE; }
|
||||
|
||||
/**
|
||||
* Function GetHelpFileName
|
||||
* returns just the basename portion of the current help file.
|
||||
|
@ -116,6 +129,8 @@ private:
|
|||
KIWAY::FACE_T m_id;
|
||||
|
||||
BIN_MOD m_bm;
|
||||
|
||||
int m_start_flags; ///< flags provided in OnKifaceStart()
|
||||
};
|
||||
|
||||
|
||||
|
|
153
include/kiway.h
153
include/kiway.h
|
@ -101,6 +101,8 @@ as such! As such, it is OK to use UTF8 characters:
|
|||
#include <import_export.h>
|
||||
#include <search_stack.h>
|
||||
#include <project.h>
|
||||
#include <frame_type.h>
|
||||
#include <mail_type.h>
|
||||
|
||||
|
||||
#define VTBL_ENTRY virtual
|
||||
|
@ -112,25 +114,21 @@ as such! As such, it is OK to use UTF8 characters:
|
|||
// be mangled.
|
||||
#define KIFACE_INSTANCE_NAME_AND_VERSION "KIFACE_1"
|
||||
|
||||
|
||||
#if defined(__linux__)
|
||||
#define LIB_ENV_VAR wxT( "LD_LIBRARY_PATH" )
|
||||
|
||||
#elif defined(__WXMAC__)
|
||||
#define LIB_ENV_VAR wxT( "DYLD_LIBRARY_PATH" )
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
#define LIB_ENV_VAR wxT( "PATH" )
|
||||
#endif
|
||||
|
||||
|
||||
class wxConfigBase;
|
||||
|
||||
|
||||
class KIWAY;
|
||||
class wxWindow;
|
||||
class PGM_BASE;
|
||||
class wxConfigBase;
|
||||
class PGM_BASE;
|
||||
class KIWAY;
|
||||
class KIWAY_PLAYER;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -151,6 +149,10 @@ struct KIFACE
|
|||
// order of functions in this listing unless you recompile all clients of
|
||||
// this interface.
|
||||
|
||||
#define KFCTL_STANDALONE (1<<0) ///< Am running as a standalone Top.
|
||||
#define KFCTL_PROJECT_SUITE (1<<1) ///< Am running under a project mgr, possibly with others
|
||||
|
||||
|
||||
/**
|
||||
* Function OnKifaceStart
|
||||
* is called just once shortly after the DSO is loaded. It is the second
|
||||
|
@ -161,13 +163,15 @@ struct KIFACE
|
|||
*
|
||||
* @param aProgram is the process block: PGM_BASE*
|
||||
*
|
||||
* @param aCtlBits consists of bit flags from the set of KFCTL_* \#defines above.
|
||||
*
|
||||
* @return bool - true if DSO initialized OK, false if not. When returning
|
||||
* false, the loader may optionally decide to terminate the process or not,
|
||||
* but will not put out any UI because that is the duty of this function to say
|
||||
* why it is returning false. Never return false without having reported
|
||||
* to the UI why.
|
||||
*/
|
||||
VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram ) = 0;
|
||||
VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) = 0;
|
||||
|
||||
/**
|
||||
* Function OnKifaceEnd
|
||||
|
@ -176,8 +180,6 @@ struct KIFACE
|
|||
*/
|
||||
VTBL_ENTRY void OnKifaceEnd() = 0;
|
||||
|
||||
#define KFCTL_STANDALONE (1<<0) ///< Am running as a standalone Top.
|
||||
|
||||
/**
|
||||
* Function CreateWindow
|
||||
* creates a wxWindow for the current project. The caller
|
||||
|
@ -199,7 +201,7 @@ struct KIFACE
|
|||
* not contained in the caller's link image.
|
||||
*/
|
||||
VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent, int aClassId,
|
||||
KIWAY* aKIWAY, int aCtlBits = 0 ) = 0;
|
||||
KIWAY* aKIWAY, int aCtlBits ) = 0;
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
|
@ -249,62 +251,120 @@ class KIWAY : public wxEvtHandler
|
|||
{
|
||||
|
||||
public:
|
||||
/// DSO players on *this* KIWAY
|
||||
/// Known KIFACE implementations
|
||||
enum FACE_T
|
||||
{
|
||||
FACE_SCH, ///< eeschema DSO
|
||||
// FACE_LIB,
|
||||
FACE_PCB, ///< pcbnew DSO
|
||||
// FACE_MOD,
|
||||
FACE_SCH, ///< eeschema DSO
|
||||
FACE_PCB, ///< pcbnew DSO
|
||||
FACE_CVPCB,
|
||||
FACE_BMP2CMP,
|
||||
|
||||
/// count of those above here, which is the subset managed in a KIWAY.
|
||||
KIWAY_FACE_COUNT,
|
||||
|
||||
FACE_BMP2CMP = KIWAY_FACE_COUNT,
|
||||
FACE_GERBVIEW,
|
||||
FACE_PL_EDITOR,
|
||||
FACE_PCB_CALCULATOR,
|
||||
|
||||
FACE_COUNT, ///< how many KIWAY player types
|
||||
FACE_COUNT
|
||||
};
|
||||
|
||||
/* from edaappl.h, now pgm_base.h, obsoleted by above FACE_T enum.
|
||||
enum PGM_BASE_T
|
||||
{
|
||||
APP_UNKNOWN,
|
||||
APP_EESCHEMA,
|
||||
APP_PCBNEW,
|
||||
APP_CVPCB,
|
||||
APP_GERBVIEW,
|
||||
APP_KICAD,
|
||||
APP_PL_EDITOR,
|
||||
APP_BM2CMP,
|
||||
};
|
||||
*/
|
||||
/**
|
||||
* Function KifaceType
|
||||
* is a simple mapping function which returns the FACE_T which is known to
|
||||
* implement @a aFrameType.
|
||||
*
|
||||
* @return KIWAY::FACE_T - a valid value or FACE_T(-1) if given a bad aFrameType.
|
||||
*/
|
||||
static FACE_T KifaceType( FRAME_T aFrameType );
|
||||
|
||||
// Don't change the order of these VTBL_ENTRYs, add new ones at the end,
|
||||
// unless you recompile all of KiCad.
|
||||
|
||||
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad );
|
||||
VTBL_ENTRY PROJECT& Prj() const;
|
||||
// If you change the vtable, recompile all of KiCad.
|
||||
|
||||
KIWAY();
|
||||
/**
|
||||
* Function KiFACE
|
||||
* returns the KIFACE* given a FACE_T. If it is not already loaded, the
|
||||
* KIFACE is loaded and initialized with a call to KIFACE::OnKifaceStart()
|
||||
*/
|
||||
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad = true );
|
||||
|
||||
/**
|
||||
* Function Player
|
||||
* returns the KIWAY_PLAYER* given a FRAME_T. If it is not already created,
|
||||
* the required KIFACE is found and loaded and initialized if necessary, then
|
||||
* the KIWAY_PLAYER window is created but not shown. Caller must Show() it.
|
||||
* If it is already created, then the existing KIWAY_PLAYER* pointer is returned.
|
||||
*
|
||||
* @param aFrameType is from enum #FRAME_T.
|
||||
* @param doCreate when true asks that the player be created if it is not
|
||||
* already created, false means do not create and maybe return NULL.
|
||||
*
|
||||
* @return KIWAY_PLAYER* - a valid opened KIWAY_PLAYER or NULL if there
|
||||
* is something wrong or doCreate was false and the player has yet to be created.
|
||||
*/
|
||||
VTBL_ENTRY KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true );
|
||||
|
||||
/**
|
||||
* Function PlayerClose
|
||||
* calls the KIWAY_PLAYER::Close( bool force ) function on the window and
|
||||
* if not vetoed, returns true, else false. If window actually closes, then
|
||||
* this KIWAY marks it as not opened internally.
|
||||
*
|
||||
* @return bool - true the window is closed and not vetoed, else false.
|
||||
*/
|
||||
VTBL_ENTRY bool PlayerClose( FRAME_T aFrameType, bool doForce );
|
||||
|
||||
/**
|
||||
* Function PlayersClose
|
||||
* calls the KIWAY_PLAYER::Close( bool force ) function on all the windows and
|
||||
* if none are vetoed, returns true, else false. If any window actually closes, then
|
||||
* this KIWAY marks it as not opened internally.
|
||||
*
|
||||
* @return bool - true indicates that all windows closed because none were vetoed,
|
||||
* false means at least one cast a veto. Any that cast a veto are still open.
|
||||
*/
|
||||
VTBL_ENTRY bool PlayersClose( bool doForce );
|
||||
|
||||
VTBL_ENTRY void ExpressMail( FRAME_T aDestination, MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource=NULL );
|
||||
|
||||
/**
|
||||
* Function Prj
|
||||
* returns the PROJECT associated with this KIWAY. This is here as an
|
||||
* accessor, so that there is freedom to put the actual PROJECT storage
|
||||
* in a place decided by the implementation, and not known to the caller.
|
||||
*/
|
||||
VTBL_ENTRY PROJECT& Prj() const;
|
||||
|
||||
KIWAY( PGM_BASE* aProgram, wxFrame* aTop = NULL );
|
||||
|
||||
/// In case aTop may not be known at time of KIWAY construction:
|
||||
void SetTop( wxFrame* aTop );
|
||||
|
||||
bool ProcessEvent( wxEvent& aEvent ); // overload virtual
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
/// Get the name of the DSO holding the requested FACE_T.
|
||||
static const wxString dso_name( FACE_T aFaceId );
|
||||
*/
|
||||
/// Get the full path & name of the DSO holding the requested FACE_T.
|
||||
static const wxString dso_full_path( FACE_T aFaceId );
|
||||
|
||||
// one for each FACE_T
|
||||
static wxDynamicLibrary s_sch_dso;
|
||||
static wxDynamicLibrary s_pcb_dso;
|
||||
//static wxDynamicLibrary s_cvpcb_dso; // will get merged into pcbnew
|
||||
/// hooked into m_top in SetTop(), marks child frame as closed.
|
||||
void playerDestroyHandler( wxWindowDestroyEvent& event );
|
||||
|
||||
KIFACE* m_kiface[FACE_COUNT];
|
||||
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
|
||||
static int m_kiface_version[KIWAY_FACE_COUNT];
|
||||
|
||||
PROJECT m_project; // do not assume this is here, use Prj().
|
||||
PGM_BASE* m_program;
|
||||
wxFrame* m_top;
|
||||
|
||||
KIWAY_PLAYER* m_player[KIWAY_PLAYER_COUNT]; // from frame_type.h
|
||||
|
||||
PROJECT m_project; // do not assume this is here, use Prj().
|
||||
};
|
||||
|
||||
|
||||
extern KIWAY Kiway; // provided by single_top.cpp and kicad.cpp
|
||||
|
||||
|
||||
/**
|
||||
* Function Pointer KIFACE_GETTER_FUNC
|
||||
* points to the one and only KIFACE export. The export's address
|
||||
|
@ -323,4 +383,5 @@ typedef KIFACE* KIFACE_GETTER_FUNC( int* aKIFACEversion, int aKIWAYversion,
|
|||
/// No name mangling. Each KIFACE (DSO/DLL) will implement this once.
|
||||
extern "C" KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
|
||||
|
||||
|
||||
#endif // KIWAY_H_
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
#ifndef KIWAY_EXPRESS_H_
|
||||
#define KIWAY_EXPRESS_H_
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
// @see http://wiki.wxwidgets.org/Custom_Events_Tutorial
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <frame_type.h>
|
||||
#include <mail_type.h>
|
||||
|
||||
|
||||
/**
|
||||
* Class KIWAY_EXPRESS
|
||||
* carries a payload from one KIWAY_PLAYER to another within a PROJECT.
|
||||
*/
|
||||
class KIWAY_EXPRESS : public wxEvent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Function Dest
|
||||
* returns the destination player id of the message.
|
||||
*/
|
||||
FRAME_T Dest() { return m_destination; }
|
||||
|
||||
/**
|
||||
* Function Command
|
||||
* returns the MAIL_T associated with this mail.
|
||||
*/
|
||||
MAIL_T Command()
|
||||
{
|
||||
return (MAIL_T) GetId(); // re-purposed control id.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Payload
|
||||
* returns the payload, which can be any text but it typicall self
|
||||
* identifying s-expression.
|
||||
*/
|
||||
const std::string& GetPayload() { return m_payload; }
|
||||
void SetPayload( const std::string& aPayload ) { m_payload = aPayload; }
|
||||
|
||||
KIWAY_EXPRESS* Clone() const { return new KIWAY_EXPRESS( *this ); }
|
||||
|
||||
//KIWAY_EXPRESS() {}
|
||||
|
||||
KIWAY_EXPRESS( FRAME_T aDestination,
|
||||
MAIL_T aCommand,
|
||||
const std::string& aPayload,
|
||||
wxWindow* aSource = NULL );
|
||||
|
||||
KIWAY_EXPRESS( const KIWAY_EXPRESS& anOther );
|
||||
|
||||
/// The wxEventType argument to wxEvent() and identifies an event class
|
||||
/// in a hurry. These wxEventTypes also allow a common class to be used
|
||||
/// multiple ways. Should be allocated at startup by wxNewEventType();
|
||||
static const wxEventType wxEVENT_ID;
|
||||
|
||||
//DECLARE_DYNAMIC_CLASS( KIWAY_EXPRESS )
|
||||
|
||||
private:
|
||||
FRAME_T m_destination; ///< could have been a bitmap indicating multiple recipients
|
||||
std::string m_payload; ///< very often s-expression text, but not always
|
||||
|
||||
// possible new ideas here.
|
||||
};
|
||||
|
||||
|
||||
typedef void ( wxEvtHandler::*kiwayExpressFunction )( KIWAY_EXPRESS& );
|
||||
|
||||
#define wxKiwayExressHandler(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(kiwayExpressFunction, &func)
|
||||
|
||||
|
||||
#define EVT_KIWAY_EXPRESS( func ) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( \
|
||||
KIWAY_EXPRESS::wxEVENT_ID, -1, -1, \
|
||||
(wxObjectEventFunction) \
|
||||
(kiwayExpressFunction) & func, \
|
||||
(wxObject*) NULL ),
|
||||
|
||||
|
||||
#endif // KIWAY_EXPRESS_H_
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
|
||||
#ifndef KIWAY_MGR_H_
|
||||
#define KIWAY_MGR_H_
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <kiway.h>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* Class KIWAY_MGR
|
||||
* is a container for all KIWAYS [and PROJECTS]. This class needs to work both
|
||||
* for a C++ project manager and an a wxPython one (after being moved into a
|
||||
* header later).
|
||||
*/
|
||||
class KIWAY_MGR
|
||||
{
|
||||
public:
|
||||
//KIWAY_MGR();
|
||||
// ~KIWAY_MGR();
|
||||
|
||||
bool OnStart( wxApp* aProcess );
|
||||
|
||||
void OnEnd();
|
||||
|
||||
KIWAY& operator[]( int aIndex )
|
||||
{
|
||||
wxASSERT( m_kiways.size() ); // stuffed in OnStart()
|
||||
return m_kiways[aIndex];
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// KIWAYs may not be moved once doled out, since window DNA depends on the
|
||||
// pointer being good forever.
|
||||
// boost_ptr::vector however never moves the object pointed to.
|
||||
typedef boost::ptr_vector<KIWAY> KIWAYS;
|
||||
|
||||
KIWAYS m_kiways;
|
||||
};
|
||||
|
||||
extern KIWAY_MGR Kiways;
|
||||
|
||||
#endif // KIWAY_MGR_H_
|
|
@ -84,6 +84,8 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class KIWAY_EXPRESS;
|
||||
|
||||
/**
|
||||
* Class KIWAY_PLAYER
|
||||
* is a wxFrame capable of the OpenProjectFiles function, meaning it can load
|
||||
|
@ -98,21 +100,15 @@ private:
|
|||
class KIWAY_PLAYER : public EDA_BASE_FRAME, public KIWAY_HOLDER
|
||||
{
|
||||
public:
|
||||
KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aWdoName = wxFrameNameStr ) :
|
||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( aKiway )
|
||||
{}
|
||||
long aStyle, const wxString& aWdoName = wxFrameNameStr );
|
||||
|
||||
/// Don't use this one, only wxformbuilder uses it, and it must be augmented with
|
||||
/// a SetKiway() early in derived constructor.
|
||||
KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName = wxFrameNameStr ) :
|
||||
EDA_BASE_FRAME( aParent, (ID_DRAWFRAME_TYPE) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( 0 )
|
||||
{}
|
||||
const wxString& aWdoName = wxFrameNameStr );
|
||||
|
||||
|
||||
// For the aCtl argument of OpenProjectFiles()
|
||||
|
@ -130,7 +126,7 @@ public:
|
|||
* <p>
|
||||
* Each derived class should handle this in a way specific to its needs.
|
||||
* No prompting is done inside here for any file or project. There should be
|
||||
* need to call this with aFileList which is empty. However, calling it with
|
||||
* no need to call this with aFileList which is empty. However, calling it with
|
||||
* a single filename which does not exist should indicate to the implementor
|
||||
* that a new session is being started and that the given name is the desired
|
||||
* name for the data file at time of save.
|
||||
|
@ -164,6 +160,67 @@ public:
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function KiwayMailIn
|
||||
* receives KIWAY_EXPRESS messages from other players. Merely override it
|
||||
* in derived classes.
|
||||
*/
|
||||
virtual void KiwayMailIn( KIWAY_EXPRESS& aEvent );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
//private:
|
||||
|
||||
/// event handler, routes to virtual KiwayMailIn()
|
||||
void kiway_express( KIWAY_EXPRESS& aEvent );
|
||||
};
|
||||
|
||||
|
||||
// psuedo code for OpenProjectFiles
|
||||
#if 0
|
||||
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFileList, int aCtl = 0 )
|
||||
{
|
||||
if( aFileList.size() != 1 )
|
||||
{
|
||||
complain via UI.
|
||||
return false
|
||||
}
|
||||
|
||||
assert( aFileList[0] is absolute ) // bug in single_top.cpp or project manager.
|
||||
|
||||
if (window does not support appending) || !(aCtl & KICTL_OPEN_APPEND)
|
||||
{
|
||||
close any currently open project files.
|
||||
}
|
||||
|
||||
if( aFileList[0] does not exist )
|
||||
{
|
||||
notify user file does not exist.
|
||||
|
||||
create an empty project file
|
||||
mark file as modified.
|
||||
|
||||
use the default project config file.
|
||||
}
|
||||
else
|
||||
{
|
||||
load aFileList[0]
|
||||
|
||||
use the project config file for project given by aFileList[0]s full path.
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
show contents.
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // KIWAY_PLAYER_H_
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef MAIL_TYPE_H_
|
||||
#define MAIL_TYPE_H_
|
||||
|
||||
/**
|
||||
* Enum MAIL_T
|
||||
* is the set of mail types sendable via KIWAY::ExpressMail() and supplied as
|
||||
* the @a aCommand parameter to that function. Such mail will be received in
|
||||
* KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent ) and aEvent.Command() will
|
||||
* match aCommand to KIWAY::ExpressMail().
|
||||
*/
|
||||
enum MAIL_T
|
||||
{
|
||||
MAIL_CROSS_PROBE, ///< PCB<->SCH, CVPCB->SCH cross-probing.
|
||||
};
|
||||
|
||||
#endif // MAIL_TYPE_H_
|
|
@ -568,7 +568,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
protected:
|
||||
virtual void emitSetRGBColor( double r, double g, double b );
|
||||
};
|
||||
|
@ -633,7 +634,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
|
||||
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
|
||||
double aScaleFactor );
|
||||
|
@ -702,7 +704,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
|
||||
protected:
|
||||
FILL_T m_fillMode; // true if the current contour
|
||||
|
@ -904,7 +907,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
|
||||
protected:
|
||||
bool textAsLines;
|
||||
|
|
|
@ -47,7 +47,7 @@ class SCH_BASE_FRAME : public EDA_DRAW_FRAME
|
|||
{
|
||||
public:
|
||||
SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aWindowType,
|
||||
FRAME_T aWindowType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPosition, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName );
|
||||
|
|
|
@ -136,8 +136,8 @@ public:
|
|||
*/
|
||||
virtual void SwapData( SCH_ITEM* aItem );
|
||||
|
||||
SCH_ITEM* Next() { return (SCH_ITEM*) Pnext; }
|
||||
SCH_ITEM* Back() { return (SCH_ITEM*) Pback; }
|
||||
SCH_ITEM* Next() const { return static_cast<SCH_ITEM*>( Pnext ); }
|
||||
SCH_ITEM* Back() const { return static_cast<SCH_ITEM*>( Pback ); }
|
||||
|
||||
/**
|
||||
* Function GetLayer
|
||||
|
|
|
@ -57,8 +57,8 @@ enum KICAD_T
|
|||
PCB_TEXT_T, ///< class TEXTE_PCB, text on a layer
|
||||
PCB_MODULE_TEXT_T, ///< class TEXTE_MODULE, text in a footprint
|
||||
PCB_MODULE_EDGE_T, ///< class EDGE_MODULE, a footprint edge
|
||||
PCB_TRACE_T, ///< class TRACKE, a track segment (segment on a copper layer)
|
||||
PCB_VIA_T, ///< class SEGVIA, a via (like a track segment on a copper layer)
|
||||
PCB_TRACE_T, ///< class TRACK, a track segment (segment on a copper layer)
|
||||
PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer)
|
||||
PCB_ZONE_T, ///< class SEGZONE, a segment used to fill a zone area (segment on a
|
||||
///< copper layer)
|
||||
PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something
|
||||
|
|
|
@ -115,7 +115,7 @@ protected:
|
|||
static const LAYER_NUM GAL_LAYER_ORDER[];
|
||||
|
||||
public:
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName );
|
||||
|
||||
|
|
|
@ -368,6 +368,8 @@ public:
|
|||
*/
|
||||
virtual void ExecuteRemoteCommand( const char* cmdline );
|
||||
|
||||
void KiwayMailIn( KIWAY_EXPRESS& aEvent ); // virtual overload from KIWAY_PLAYER
|
||||
|
||||
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
|
||||
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
|
||||
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
|
||||
|
|
|
@ -44,7 +44,7 @@ class TEXTE_PCB;
|
|||
class MODULE;
|
||||
class TRACK;
|
||||
class SEGZONE;
|
||||
class SEGVIA;
|
||||
class VIA;
|
||||
class D_PAD;
|
||||
class TEXTE_MODULE;
|
||||
class PCB_TARGET;
|
||||
|
@ -209,6 +209,8 @@ public:
|
|||
*/
|
||||
virtual void ExecuteRemoteCommand( const char* cmdline );
|
||||
|
||||
void KiwayMailIn( KIWAY_EXPRESS& aEvent ); // virtual overload from KIWAY_PLAYER
|
||||
|
||||
/**
|
||||
* Function ToPlotter
|
||||
* Open a dialog frame to create plot and drill files
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <frame_type.h>
|
||||
|
||||
#ifdef USE_WX_OVERLAY
|
||||
#include <wx/overlay.h>
|
||||
|
@ -81,26 +82,6 @@ enum id_librarytype {
|
|||
};
|
||||
|
||||
|
||||
enum ID_DRAWFRAME_TYPE
|
||||
{
|
||||
NOT_INIT_FRAME_TYPE = 0,
|
||||
SCHEMATIC_FRAME_TYPE,
|
||||
LIBEDITOR_FRAME_TYPE,
|
||||
VIEWER_FRAME_TYPE,
|
||||
PCB_FRAME_TYPE,
|
||||
MODULE_EDITOR_FRAME_TYPE,
|
||||
MODULE_VIEWER_FRAME_TYPE,
|
||||
FOOTPRINT_WIZARD_FRAME_TYPE,
|
||||
CVPCB_FRAME_TYPE,
|
||||
CVPCB_DISPLAY_FRAME_TYPE,
|
||||
GERBER_FRAME_TYPE,
|
||||
TEXT_EDITOR_FRAME_TYPE,
|
||||
DISPLAY3D_FRAME_TYPE,
|
||||
KICAD_MAIN_FRAME_TYPE,
|
||||
PL_EDITOR_FRAME_TYPE
|
||||
};
|
||||
|
||||
|
||||
/// Custom trace mask to enable and disable auto save tracing.
|
||||
extern const wxChar traceAutoSave[];
|
||||
|
||||
|
@ -132,7 +113,7 @@ class EDA_BASE_FRAME : public wxFrame
|
|||
void windowClosing( wxCloseEvent& event );
|
||||
|
||||
protected:
|
||||
ID_DRAWFRAME_TYPE m_Ident; ///< Id Type (pcb, schematic, library..)
|
||||
FRAME_T m_Ident; ///< Id Type (pcb, schematic, library..)
|
||||
wxPoint m_FramePos;
|
||||
wxSize m_FrameSize;
|
||||
|
||||
|
@ -196,7 +177,7 @@ protected:
|
|||
virtual wxString help_name();
|
||||
|
||||
public:
|
||||
EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName );
|
||||
|
||||
|
@ -219,7 +200,7 @@ public:
|
|||
|
||||
bool IsActive() const { return m_FrameIsActive; }
|
||||
|
||||
bool IsType( ID_DRAWFRAME_TYPE aType ) const { return m_Ident == aType; }
|
||||
bool IsType( FRAME_T aType ) const { return m_Ident == aType; }
|
||||
|
||||
void GetKicadHelp( wxCommandEvent& event );
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
add_definitions(-DKICAD)
|
||||
add_definitions( -DKICAD )
|
||||
|
||||
include_directories(BEFORE ${INC_BEFORE})
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
|
||||
set(KICAD_SRCS
|
||||
set( KICAD_SRCS
|
||||
class_treeprojectfiles.cpp
|
||||
class_treeproject_item.cpp
|
||||
commandframe.cpp
|
||||
|
@ -19,48 +19,66 @@ set(KICAD_SRCS
|
|||
preferences.cpp
|
||||
prjconfig.cpp
|
||||
project_template.cpp
|
||||
tree_project_frame.cpp)
|
||||
tree_project_frame.cpp
|
||||
)
|
||||
|
||||
if(MINGW)
|
||||
if( MINGW )
|
||||
# KICAD_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler(kicad)
|
||||
mingw_resource_compiler( kicad )
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(KICAD_RESOURCES kicad.icns kicad_doc.icns)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/kicad.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/kicad_doc.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(MACOSX_BUNDLE_ICON_FILE kicad.icns)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad)
|
||||
set(MACOSX_BUNDLE_NAME kicad)
|
||||
endif(APPLE)
|
||||
if( APPLE )
|
||||
set( KICAD_RESOURCES kicad.icns kicad_doc.icns )
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/kicad.icns" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/kicad_doc.icns" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
set( MACOSX_BUNDLE_ICON_FILE kicad.icns )
|
||||
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad )
|
||||
set( MACOSX_BUNDLE_NAME kicad )
|
||||
endif()
|
||||
|
||||
add_executable(kicad WIN32 MACOSX_BUNDLE
|
||||
add_executable( kicad WIN32 MACOSX_BUNDLE
|
||||
${KICAD_SRCS}
|
||||
${KICAD_EXTRA_SRCS}
|
||||
${KICAD_RESOURCES}
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(kicad PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
target_link_libraries(kicad
|
||||
if( UNIX )
|
||||
# for build directory: create kiface symlinks so kicad (exe) can be run in-situ
|
||||
add_custom_target( kiface_sym_links
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR}/eeschema/_eeschema.kiface" "${CMAKE_BINARY_DIR}/kicad/_eeschema.kiface"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.kiface" "${CMAKE_BINARY_DIR}/kicad/_pcbnew.kiface"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR}/cvpcb/_cvpcb.kiface" "${CMAKE_BINARY_DIR}/kicad/_cvpcb.kiface"
|
||||
COMMENT "Making <build-dir>/kicad/<kiface.symlinks>"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if( APPLE )
|
||||
set_target_properties( kicad PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||
)
|
||||
target_link_libraries( kicad
|
||||
common
|
||||
bitmaps
|
||||
polygon
|
||||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
else(APPLE)
|
||||
target_link_libraries(kicad
|
||||
else()
|
||||
target_link_libraries( kicad
|
||||
common
|
||||
bitmaps
|
||||
polygon
|
||||
${wxWidgets_LIBRARIES}
|
||||
${GDI_PLUS_LIBRARIES}
|
||||
)
|
||||
endif(APPLE)
|
||||
endif()
|
||||
|
||||
install( TARGETS kicad
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
|
||||
install(TARGETS kicad
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary)
|
||||
|
|
|
@ -59,7 +59,7 @@ int LAUNCHER_PANEL::GetPanelHeight() const
|
|||
* Function CreateCommandToolbar
|
||||
* create the buttons to call Eeschema CvPcb, Pcbnew and GerbView
|
||||
*/
|
||||
void LAUNCHER_PANEL::CreateCommandToolbar( void )
|
||||
void LAUNCHER_PANEL::CreateCommandToolbar()
|
||||
{
|
||||
wxBitmapButton* btn;
|
||||
|
||||
|
|
136
kicad/kicad.cpp
136
kicad/kicad.cpp
|
@ -28,8 +28,9 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <macros.h>
|
||||
#include <fctsys.h>
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
#include <kicad.h>
|
||||
#include <kiway.h>
|
||||
#include <pgm_kicad.h>
|
||||
|
@ -40,6 +41,40 @@
|
|||
|
||||
#include <build_version.h>
|
||||
|
||||
|
||||
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
|
||||
static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
|
||||
{
|
||||
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
|
||||
// "subsidiary DSOs" in the same directory as the kiway top process modules.
|
||||
// A subsidiary shared library is one that is not a top level DSO, but rather
|
||||
// some shared library that a top level DSO needs to even be loaded. It is
|
||||
// a static link to a shared object from a top level DSO.
|
||||
|
||||
// This directory POLICY CHOICE 2 is not the only dir in play, since LIB_ENV_VAR
|
||||
// has numerous path options in it, as does DSO searching on linux, windows, and OSX.
|
||||
// See "man ldconfig" on linux. What's being done here is for quick installs
|
||||
// into a non-standard place, and especially for Windows users who may not
|
||||
// know what the PATH environment variable is or how to set it.
|
||||
|
||||
wxFileName fn( aAbsoluteArgv0 );
|
||||
|
||||
wxString ld_path( LIB_ENV_VAR );
|
||||
wxString my_path = fn.GetPath();
|
||||
wxString new_paths = PrePendPath( ld_path, my_path );
|
||||
|
||||
wxSetEnv( ld_path, new_paths );
|
||||
|
||||
#if defined(DEBUG)
|
||||
{
|
||||
wxString test;
|
||||
wxGetEnv( ld_path, &test );
|
||||
printf( "LIB_ENV_VAR:'%s'\n", TO_UTF8( test ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// a dummy to quiet linking with EDA_BASE_FRAME::config();
|
||||
#include <kiface_i.h>
|
||||
KIFACE_I& Kiface()
|
||||
|
@ -62,7 +97,6 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
|||
|
||||
m_bm.Init();
|
||||
|
||||
#if 0 // copied from single_top.c, possibly for milestone B)
|
||||
wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
||||
if( !wxIsAbsolutePath( absoluteArgv0 ) )
|
||||
|
@ -71,14 +105,34 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
|||
return false;
|
||||
}
|
||||
|
||||
// Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the
|
||||
// KIFACE has hard dependencies on subsidiary DSOs below it.
|
||||
SetLibEnvVar( absoluteArgv0 );
|
||||
#endif
|
||||
// Set LIB_ENV_VAR *before* loading the KIFACE DSOs, in case they have hard
|
||||
// dependencies on subsidiary DSOs below it.
|
||||
set_lib_env_var( absoluteArgv0 );
|
||||
|
||||
if( !initPgm() )
|
||||
return false;
|
||||
|
||||
// Add search paths to feed the PGM_KICAD::SysSearch() function,
|
||||
// currenly limited in support to only look for project templates
|
||||
{
|
||||
SEARCH_STACK bases;
|
||||
|
||||
SystemDirsAppend( &bases );
|
||||
|
||||
// DBG( bases.Show( (std::string(__func__) + " bases").c_str() );)
|
||||
|
||||
for( unsigned i = 0; i < bases.GetCount(); ++i )
|
||||
{
|
||||
wxFileName fn( bases[i], wxEmptyString );
|
||||
|
||||
// Add KiCad template file path to search path list.
|
||||
fn.AppendDir( wxT( "template" ) );
|
||||
m_bm.m_search.AddPaths( fn.GetPath() );
|
||||
}
|
||||
|
||||
//DBG( m_bm.m_search.Show( (std::string( __func__ ) + " SysSearch()").c_str() );)
|
||||
}
|
||||
|
||||
// Read current setup and reopen last directory if no filename to open on
|
||||
// command line.
|
||||
if( App().argc == 1 )
|
||||
|
@ -95,6 +149,8 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
|||
wxDefaultPosition, wxDefaultSize );
|
||||
App().SetTopWindow( frame );
|
||||
|
||||
Kiway.SetTop( frame );
|
||||
|
||||
bool prjloaded = false; // true when the project is loaded
|
||||
|
||||
if( App().argc > 1 )
|
||||
|
@ -197,39 +253,7 @@ void PGM_KICAD::destroy()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class KIWAY_MGR
|
||||
* is a container for all KIWAYS [and PROJECTS]. This class needs to work both
|
||||
* for a C++ project manager and an a wxPython one (after being moved into a
|
||||
* header later).
|
||||
*/
|
||||
class KIWAY_MGR
|
||||
{
|
||||
public:
|
||||
//KIWAY_MGR();
|
||||
// ~KIWAY_MGR();
|
||||
|
||||
bool OnStart( wxApp* aProcess );
|
||||
|
||||
void OnEnd();
|
||||
|
||||
KIWAY& operator[]( int aIndex )
|
||||
{
|
||||
wxASSERT( m_kiways.size() ); // stuffed in OnStart()
|
||||
return m_kiways[aIndex];
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// KIWAYs may not be moved once doled out, since window DNA depends on the
|
||||
// pointer being good forever.
|
||||
// boost_ptr::vector however never moves the object pointed to.
|
||||
typedef boost::ptr_vector<KIWAY> KIWAYS;
|
||||
|
||||
KIWAYS m_kiways;
|
||||
};
|
||||
|
||||
static KIWAY_MGR kiways;
|
||||
KIWAY Kiway( &Pgm() );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -240,7 +264,7 @@ struct APP_KICAD : public wxApp
|
|||
{
|
||||
bool OnInit() // overload wxApp virtual
|
||||
{
|
||||
if( kiways.OnStart( this ) )
|
||||
// if( Kiways.OnStart( this ) )
|
||||
{
|
||||
return Pgm().OnPgmInit( this );
|
||||
}
|
||||
|
@ -249,13 +273,37 @@ struct APP_KICAD : public wxApp
|
|||
|
||||
int OnExit() // overload wxApp virtual
|
||||
{
|
||||
kiways.OnEnd();
|
||||
// Kiways.OnEnd();
|
||||
|
||||
Pgm().OnPgmExit();
|
||||
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
int OnRun() // overload wxApp virtual
|
||||
{
|
||||
try
|
||||
{
|
||||
return wxApp::OnRun();
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
{
|
||||
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
|
||||
GetChars( FROM_UTF8( typeid(e).name() )),
|
||||
GetChars( FROM_UTF8( e.what() ) ) );;
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( GetChars( ioe.errorText ) );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
wxLogError( wxT( "Unhandled exception of unknown type" ) );
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function MacOpenFile
|
||||
* is specific to MacOSX (not used under Linux or Windows).
|
||||
|
@ -275,10 +323,12 @@ IMPLEMENT_APP( APP_KICAD );
|
|||
// this link image need this function.
|
||||
PROJECT& Prj()
|
||||
{
|
||||
return kiways[0].Prj();
|
||||
return Kiway.Prj();
|
||||
}
|
||||
|
||||
|
||||
#if 0 // there can be only one in C++ project manager.
|
||||
|
||||
bool KIWAY_MGR::OnStart( wxApp* aProcess )
|
||||
{
|
||||
// The C++ project manager supports only one open PROJECT
|
||||
|
@ -292,3 +342,5 @@ bool KIWAY_MGR::OnStart( wxApp* aProcess )
|
|||
void KIWAY_MGR::OnEnd()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_kicad.h>
|
||||
#include <kiway.h>
|
||||
#include <kiway_player.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <macros.h>
|
||||
|
@ -39,13 +41,14 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <menus_helpers.h>
|
||||
|
||||
#define USE_KIFACE 1
|
||||
|
||||
#define TreeFrameWidthEntry wxT( "LeftWinWidth" )
|
||||
#define TreeFrameWidthEntry wxT( "LeftWinWidth" )
|
||||
|
||||
|
||||
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
|
||||
const wxString& title, const wxPoint& pos, const wxSize& size ) :
|
||||
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_TYPE, title, pos, size,
|
||||
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "KicadFrame" ) )
|
||||
{
|
||||
m_leftWinWidth = 60;
|
||||
|
@ -152,26 +155,29 @@ void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
|
|||
|
||||
void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
int px, py;
|
||||
|
||||
UpdateFileHistory( m_ProjectFileName.GetFullPath(), &Pgm().GetFileHistory() );
|
||||
|
||||
if( !IsIconized() ) // save main frame position and size
|
||||
if( Kiway.PlayersClose( false ) )
|
||||
{
|
||||
GetPosition( &px, &py );
|
||||
m_FramePos.x = px;
|
||||
m_FramePos.y = py;
|
||||
int px, py;
|
||||
|
||||
GetSize( &px, &py );
|
||||
m_FrameSize.x = px;
|
||||
m_FrameSize.y = py;
|
||||
UpdateFileHistory( m_ProjectFileName.GetFullPath(), &Pgm().GetFileHistory() );
|
||||
|
||||
if( !IsIconized() ) // save main frame position and size
|
||||
{
|
||||
GetPosition( &px, &py );
|
||||
m_FramePos.x = px;
|
||||
m_FramePos.y = py;
|
||||
|
||||
GetSize( &px, &py );
|
||||
m_FrameSize.x = px;
|
||||
m_FrameSize.y = py;
|
||||
}
|
||||
|
||||
Event.SetCanVeto( true );
|
||||
|
||||
m_LeftWin->Show( false );
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
||||
Event.SetCanVeto( true );
|
||||
|
||||
m_LeftWin->Show( false );
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,10 +244,21 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
|
|||
legacy_board.SetExt( LegacyPcbFileExtension );
|
||||
kicad_board.SetExt( KiCadPcbFileExtension );
|
||||
|
||||
if( !legacy_board.FileExists() || kicad_board.FileExists() )
|
||||
Execute( this, PCBNEW_EXE, QuoteFullPath( kicad_board ) );
|
||||
else
|
||||
Execute( this, PCBNEW_EXE, QuoteFullPath( legacy_board ) );
|
||||
wxFileName& board = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
|
||||
kicad_board : legacy_board;
|
||||
|
||||
#if USE_KIFACE
|
||||
KIWAY_PLAYER* frame = Kiway.Player( FRAME_PCB, false );
|
||||
if( !frame )
|
||||
{
|
||||
frame = Kiway.Player( FRAME_PCB, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, board.GetFullPath() ) );
|
||||
frame->Show( true );
|
||||
}
|
||||
frame->Raise();
|
||||
#else
|
||||
Execute( this, PCBNEW_EXE, QuoteFullPath( board ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -250,25 +267,57 @@ void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event )
|
|||
wxFileName fn( m_ProjectFileName );
|
||||
|
||||
fn.SetExt( NetlistFileExtension );
|
||||
|
||||
#if USE_KIFACE
|
||||
KIWAY_PLAYER* frame = Kiway.Player( FRAME_CVPCB, false );
|
||||
if( !frame )
|
||||
{
|
||||
frame = Kiway.Player( FRAME_CVPCB, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
frame->Show( true );
|
||||
}
|
||||
frame->Raise();
|
||||
#else
|
||||
Execute( this, CVPCB_EXE, QuoteFullPath( fn ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn( m_ProjectFileName );
|
||||
|
||||
fn.SetExt( SchematicFileExtension );
|
||||
Execute( this, EESCHEMA_EXE, QuoteFullPath( fn ) );
|
||||
|
||||
#if USE_KIFACE
|
||||
KIWAY_PLAYER* frame = Kiway.Player( FRAME_SCH, false );
|
||||
if( !frame )
|
||||
{
|
||||
frame = Kiway.Player( FRAME_SCH, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
frame->Show( true );
|
||||
}
|
||||
frame->Raise();
|
||||
#else
|
||||
Execute( this, EESCHEMA_EXE, QuoteFullPath( fn ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnRunGerbview( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn( m_ProjectFileName );
|
||||
|
||||
wxString path = wxT( "\"" );
|
||||
|
||||
path += fn.GetPath( wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME ) + wxT( "\"" );
|
||||
|
||||
#if USE_KIFACE && 0
|
||||
|
||||
// I cannot make sense of the fn.
|
||||
|
||||
#else
|
||||
Execute( this, GERBVIEW_EXE, path );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -338,10 +387,11 @@ void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
*/
|
||||
void KICAD_MANAGER_FRAME::PrintPrjInfo()
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Working dir: %s\nProject: %s\n" ),
|
||||
GetChars( wxGetCwd() ),
|
||||
GetChars( m_ProjectFileName.GetFullPath() ) );
|
||||
wxString msg = wxString::Format( _(
|
||||
"Working dir: %s\nProject: %s\n" ),
|
||||
GetChars( wxGetCwd() ),
|
||||
GetChars( m_ProjectFileName.GetFullPath() )
|
||||
);
|
||||
PrintMsg( msg );
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ if( USE_KIWAY_DLLS )
|
|||
${PL_EDITOR_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=PL_EDITOR_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( pl_editor
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
|
|
@ -54,7 +54,7 @@ static struct IFACE : public KIFACE_I
|
|||
KIFACE_I( aName, aType )
|
||||
{}
|
||||
|
||||
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
|
||||
void OnKifaceEnd();
|
||||
|
||||
|
@ -62,7 +62,7 @@ static struct IFACE : public KIFACE_I
|
|||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case PL_EDITOR_FRAME_TYPE:
|
||||
case FRAME_PL_EDITOR:
|
||||
{
|
||||
PL_EDITOR_FRAME* frame = new PL_EDITOR_FRAME( aKiway, aParent );
|
||||
|
||||
|
@ -126,9 +126,9 @@ PGM_BASE& Pgm()
|
|||
}
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
start_common();
|
||||
start_common( aCtlBits );
|
||||
|
||||
// Must be called before creating the main frame in order to
|
||||
// display the real hotkeys in menus or tool tips
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define PL_EDITOR_FRAME_NAME wxT( "PlEditorFrame" )
|
||||
|
||||
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
EDA_DRAW_FRAME( aKiway, aParent, PL_EDITOR_FRAME_TYPE, wxT( "PlEditorFrame" ),
|
||||
EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME )
|
||||
{
|
||||
m_FrameName = PL_EDITOR_FRAME_NAME;
|
||||
|
|
|
@ -55,7 +55,7 @@ static struct IFACE : public KIFACE_I
|
|||
KIFACE_I( aName, aType )
|
||||
{}
|
||||
|
||||
bool OnKifaceStart( PGM_BASE* aProgram );
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
|
||||
void OnKifaceEnd();
|
||||
|
||||
|
@ -117,9 +117,9 @@ PGM_BASE& Pgm()
|
|||
}
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
start_common();
|
||||
start_common( aCtlBits );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -517,7 +517,7 @@ if( USE_KIWAY_DLLS )
|
|||
${PCBNEW_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp pcbnew.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PCB;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( pcbnew
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
@ -619,7 +619,7 @@ else() # milestone A) kills this off:
|
|||
${PCBNEW_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\""
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PCB;PGM_DATA_FILE_EXT=\"kicad_pcb\""
|
||||
)
|
||||
target_link_libraries( pcbnew
|
||||
3d-viewer
|
||||
|
|
|
@ -516,12 +516,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
|
|||
if( DrawSegm->GetLayer() != EDGE_N )
|
||||
break;
|
||||
|
||||
TmpSegm.SetStart( DrawSegm->GetStart() );
|
||||
TmpSegm.SetEnd( DrawSegm->GetEnd() );
|
||||
TmpSegm.SetShape( DrawSegm->GetShape() );
|
||||
TmpSegm.m_Param = DrawSegm->GetAngle();
|
||||
|
||||
TraceSegmentPcb( &TmpSegm, HOLE | CELL_is_EDGE,
|
||||
TraceSegmentPcb( DrawSegm, HOLE | CELL_is_EDGE,
|
||||
RoutingMatrix.m_GridRouting, WRITE_CELL );
|
||||
break;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
|
||||
class BOARD;
|
||||
class DRAWSEGMENT;
|
||||
|
||||
|
||||
#define TOP 0
|
||||
|
@ -195,6 +196,7 @@ void PlacePad( D_PAD* pt_pad, int type, int marge, int op_logic );
|
|||
|
||||
/* Draws a segment of track on the board. */
|
||||
void TraceSegmentPcb( TRACK* pt_segm, int type, int marge, int op_logic );
|
||||
void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int type, int marge, int op_logic );
|
||||
|
||||
/* Uses the color value of all cells included in the board
|
||||
* coord of the rectangle ux0, uy0 (top right corner)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <math_for_graphics.h>
|
||||
#include <class_board.h>
|
||||
#include <class_track.h>
|
||||
#include <class_drawsegment.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <autorout.h>
|
||||
|
@ -256,29 +257,52 @@ void TraceFilledCircle( int cx, int cy, int radius,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic )
|
||||
void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int color, int marge, int op_logic )
|
||||
{
|
||||
int half_width;
|
||||
int ux0, uy0, ux1, uy1;
|
||||
|
||||
half_width = ( pt_segm->GetWidth() / 2 ) + marge;
|
||||
int half_width = ( pt_segm->GetWidth() / 2 ) + marge;
|
||||
|
||||
// Calculate the bounding rectangle of the segment (if H, V or Via)
|
||||
ux0 = pt_segm->GetStart().x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy0 = pt_segm->GetStart().y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
ux1 = pt_segm->GetEnd().x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy1 = pt_segm->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
int ux0 = pt_segm->GetStart().x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
int uy0 = pt_segm->GetStart().y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
int ux1 = pt_segm->GetEnd().x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
int uy1 = pt_segm->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
|
||||
// Test if VIA (filled circle was drawn)
|
||||
if( pt_segm->Type() == PCB_VIA_T )
|
||||
LAYER_NUM layer = pt_segm->GetLayer();
|
||||
|
||||
if( color == VIA_IMPOSSIBLE )
|
||||
layer = UNDEFINED_LAYER;
|
||||
|
||||
switch( pt_segm->GetShape() )
|
||||
{
|
||||
// The segment is here a straight line or a circle or an arc.:
|
||||
case S_CIRCLE:
|
||||
TraceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
TraceArc( ux0, uy0, ux1, uy1, pt_segm->GetAngle(), half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
// The segment is here a line segment.
|
||||
default:
|
||||
DrawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
|
||||
{
|
||||
int half_width = ( aTrack->GetWidth() / 2 ) + marge;
|
||||
|
||||
// Test if VIA (filled circle need to be drawn)
|
||||
if( aTrack->Type() == PCB_VIA_T )
|
||||
{
|
||||
LAYER_MSK layer_mask = NO_LAYERS;
|
||||
|
||||
if( pt_segm->IsOnLayer( g_Route_Layer_BOTTOM ) )
|
||||
if( aTrack->IsOnLayer( g_Route_Layer_BOTTOM ) )
|
||||
layer_mask = GetLayerMask( g_Route_Layer_BOTTOM );
|
||||
|
||||
if( pt_segm->IsOnLayer( g_Route_Layer_TOP ) )
|
||||
if( aTrack->IsOnLayer( g_Route_Layer_TOP ) )
|
||||
{
|
||||
if( layer_mask == 0 )
|
||||
layer_mask = GetLayerMask( g_Route_Layer_TOP );
|
||||
|
@ -290,39 +314,25 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic )
|
|||
layer_mask = FULL_LAYERS;
|
||||
|
||||
if( layer_mask )
|
||||
TraceFilledCircle( pt_segm->GetStart().x, pt_segm->GetStart().y,
|
||||
TraceFilledCircle( aTrack->GetStart().x, aTrack->GetStart().y,
|
||||
half_width, layer_mask, color, op_logic );
|
||||
return;
|
||||
}
|
||||
|
||||
LAYER_NUM layer = pt_segm->GetLayer();
|
||||
|
||||
if( color == VIA_IMPOSSIBLE )
|
||||
layer = UNDEFINED_LAYER;
|
||||
|
||||
// The segment is here a straight line or a circle or an arc.:
|
||||
if( pt_segm->GetShape() == S_CIRCLE )
|
||||
else
|
||||
{
|
||||
TraceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
return;
|
||||
}
|
||||
// Calculate the bounding rectangle of the segment
|
||||
int ux0 = aTrack->GetStart().x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
int uy0 = aTrack->GetStart().y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
int ux1 = aTrack->GetEnd().x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
|
||||
if( pt_segm->GetShape() == S_ARC )
|
||||
{
|
||||
TraceArc( ux0, uy0, ux1, uy1, pt_segm->m_Param, half_width, layer, color, op_logic );
|
||||
return;
|
||||
}
|
||||
// Ordinary track
|
||||
LAYER_NUM layer = aTrack->GetLayer();
|
||||
|
||||
if( color == VIA_IMPOSSIBLE )
|
||||
layer = UNDEFINED_LAYER;
|
||||
|
||||
// The segment is here a line segment.
|
||||
if( ( ux0 != ux1 ) && ( uy0 != uy1 ) ) // Segment tilts.
|
||||
{
|
||||
DrawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
return;
|
||||
}
|
||||
|
||||
// The segment is horizontal or vertical.
|
||||
// F4EXB 051018-01
|
||||
DrawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -225,7 +225,6 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
|
||||
// Place outlines of modules on matrix routing, if they are on a copper layer
|
||||
// or on the edge layer
|
||||
TRACK tmpSegm( NULL ); // A dummy track used to create segments.
|
||||
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
|
@ -236,21 +235,13 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
case PCB_MODULE_EDGE_T:
|
||||
{
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) item;
|
||||
EDGE_MODULE tmpEdge( *edge );
|
||||
|
||||
tmpSegm.SetLayer( edge->GetLayer() );
|
||||
if( tmpEdge.GetLayer() == EDGE_N )
|
||||
tmpEdge.SetLayer( UNDEFINED_LAYER );
|
||||
|
||||
if( tmpSegm.GetLayer() == EDGE_N )
|
||||
tmpSegm.SetLayer( UNDEFINED_LAYER );
|
||||
|
||||
tmpSegm.SetStart( edge->GetStart() );
|
||||
tmpSegm.SetEnd( edge->GetEnd() );
|
||||
tmpSegm.SetShape( edge->GetShape() );
|
||||
tmpSegm.SetWidth( edge->GetWidth() );
|
||||
tmpSegm.m_Param = edge->GetAngle();
|
||||
tmpSegm.SetNetCode( -1 );
|
||||
|
||||
TraceSegmentPcb( &tmpSegm, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
TraceSegmentPcb( &tmpEdge, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( &tmpEdge, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -271,7 +262,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
|
||||
int type_cell = HOLE;
|
||||
DrawSegm = (DRAWSEGMENT*) item;
|
||||
tmpSegm.SetLayer( DrawSegm->GetLayer() );
|
||||
DRAWSEGMENT tmpSegm( DrawSegm );
|
||||
|
||||
if( DrawSegm->GetLayer() == EDGE_N )
|
||||
{
|
||||
|
@ -279,13 +270,6 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
type_cell |= CELL_is_EDGE;
|
||||
}
|
||||
|
||||
tmpSegm.SetStart( DrawSegm->GetStart() );
|
||||
tmpSegm.SetEnd( DrawSegm->GetEnd() );
|
||||
tmpSegm.SetShape( DrawSegm->GetShape() );
|
||||
tmpSegm.SetWidth( DrawSegm->GetWidth() );
|
||||
tmpSegm.m_Param = DrawSegm->GetAngle();
|
||||
tmpSegm.SetNetCode( -1 );
|
||||
|
||||
TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL );
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1159,14 +1159,11 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
|||
static void OrCell_Trace( BOARD* pcb, int col, int row,
|
||||
int side, int orient, int current_net_code )
|
||||
{
|
||||
int dx0, dy0, dx1, dy1;
|
||||
TRACK* newTrack;
|
||||
|
||||
if( orient == HOLE ) // placement of a via
|
||||
{
|
||||
newTrack = new SEGVIA( pcb );
|
||||
VIA *newVia = new VIA( pcb );
|
||||
|
||||
g_CurrentTrackList.PushBack( newTrack );
|
||||
g_CurrentTrackList.PushBack( newVia );
|
||||
|
||||
g_CurrentTrackSegment->SetState( TRACK_AR, true );
|
||||
g_CurrentTrackSegment->SetLayer( 0x0F );
|
||||
|
@ -1178,13 +1175,15 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
g_CurrentTrackSegment->SetEnd( g_CurrentTrackSegment->GetStart() );
|
||||
|
||||
g_CurrentTrackSegment->SetWidth( pcb->GetCurrentViaSize() );
|
||||
g_CurrentTrackSegment->SetShape( pcb->GetDesignSettings().m_CurrentViaType );
|
||||
newVia->SetViaType( pcb->GetDesignSettings().m_CurrentViaType );
|
||||
|
||||
g_CurrentTrackSegment->SetNetCode( current_net_code );
|
||||
}
|
||||
else // placement of a standard segment
|
||||
{
|
||||
newTrack = new TRACK( pcb );
|
||||
TRACK *newTrack = new TRACK( pcb );
|
||||
int dx0, dy0, dx1, dy1;
|
||||
|
||||
|
||||
g_CurrentTrackList.PushBack( newTrack );
|
||||
|
||||
|
@ -1301,12 +1300,14 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
|||
g_CurrentTrackList.PushBack( newTrack );
|
||||
}
|
||||
|
||||
g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment, FLG_START );
|
||||
g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment,
|
||||
ENDPOINT_START );
|
||||
|
||||
if( g_FirstTrackSegment->start )
|
||||
g_FirstTrackSegment->SetState( BEGIN_ONPAD, true );
|
||||
|
||||
g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment, FLG_END );
|
||||
g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment,
|
||||
ENDPOINT_END );
|
||||
|
||||
if( g_CurrentTrackSegment->end )
|
||||
g_CurrentTrackSegment->SetState( END_ONPAD, true );
|
||||
|
|
|
@ -130,7 +130,7 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
|
|||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName ) :
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
|
|
|
@ -233,31 +233,38 @@ void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
|
|||
int atmp = track->GetWidth();
|
||||
track->SetWidth( image->GetWidth() );
|
||||
image->SetWidth( atmp );
|
||||
atmp = track->GetShape();
|
||||
track->SetShape( image->GetShape() );
|
||||
image->SetShape( atmp );
|
||||
|
||||
atmp = track->GetDrillValue();
|
||||
if( Type() == PCB_VIA_T )
|
||||
{
|
||||
VIA *via = static_cast<VIA*>( this );
|
||||
VIA *viaimage = static_cast<VIA*>( aImage );
|
||||
|
||||
if( track->IsDrillDefault() )
|
||||
atmp = -1;
|
||||
VIATYPE_T viatmp = via->GetViaType();
|
||||
via->SetViaType( viaimage->GetViaType() );
|
||||
viaimage->SetViaType( viatmp );
|
||||
|
||||
int itmp = image->GetDrillValue();
|
||||
int drilltmp = via->GetDrillValue();
|
||||
|
||||
if( image->IsDrillDefault() )
|
||||
itmp = -1;
|
||||
if( via->IsDrillDefault() )
|
||||
drilltmp = -1;
|
||||
|
||||
EXCHG(itmp, atmp );
|
||||
int itmp = viaimage->GetDrillValue();
|
||||
|
||||
if( atmp > 0 )
|
||||
track->SetDrill( atmp );
|
||||
else
|
||||
track->SetDrillDefault();
|
||||
if( viaimage->IsDrillDefault() )
|
||||
itmp = -1;
|
||||
|
||||
if( itmp > 0 )
|
||||
image->SetDrill( itmp );
|
||||
else
|
||||
image->SetDrillDefault();
|
||||
EXCHG(itmp, drilltmp );
|
||||
|
||||
if( drilltmp > 0 )
|
||||
via->SetDrill( drilltmp );
|
||||
else
|
||||
via->SetDrillDefault();
|
||||
|
||||
if( itmp > 0 )
|
||||
viaimage->SetDrill( itmp );
|
||||
else
|
||||
viaimage->SetDrillDefault();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_
|
|||
segment = m_Track; candidate = NULL;
|
||||
NbSegm = 0;
|
||||
|
||||
while( ( segment = ::GetTrace( segment, NULL, aPosition, aLayerMask ) ) != NULL )
|
||||
while( ( segment = ::GetTrack( segment, NULL, aPosition, aLayerMask ) ) != NULL )
|
||||
{
|
||||
if( segment->GetState( BUSY ) ) // already found and selected: skip it
|
||||
{
|
||||
|
@ -1172,7 +1172,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
|||
|
||||
#if 0 // both these are on same list, so we must scan it twice in order
|
||||
// to get VIA priority, using new #else code below.
|
||||
// But we are not using separate lists for TRACKs and SEGVIAs, because
|
||||
// But we are not using separate lists for TRACKs and VIA, because
|
||||
// items are ordered (sorted) in the linked
|
||||
// list by netcode AND by physical distance:
|
||||
// when created, if a track or via is connected to an existing track or
|
||||
|
@ -1561,29 +1561,17 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
|
|||
}
|
||||
|
||||
|
||||
TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer)
|
||||
VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer) const
|
||||
{
|
||||
TRACK* track;
|
||||
|
||||
for( track = m_Track; track; track = track->Next() )
|
||||
for( VIA *via = GetFirstVia( m_Track); via; via = GetFirstVia( via->Next() ) )
|
||||
{
|
||||
if( track->Type() != PCB_VIA_T )
|
||||
continue;
|
||||
|
||||
if( track->GetStart() != aPosition )
|
||||
continue;
|
||||
|
||||
if( track->GetState( BUSY | IS_DELETED ) )
|
||||
continue;
|
||||
|
||||
if( aLayer == UNDEFINED_LAYER )
|
||||
break;
|
||||
|
||||
if( track->IsOnLayer( aLayer ) )
|
||||
break;
|
||||
if( (via->GetStart() == aPosition) &&
|
||||
(via->GetState( BUSY | IS_DELETED ) == 0) &&
|
||||
((aLayer == UNDEFINED_LAYER) || (via->IsOnLayer( aLayer ))) )
|
||||
return via;
|
||||
}
|
||||
|
||||
return track;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1603,22 +1591,13 @@ D_PAD* BOARD::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
|
|||
}
|
||||
|
||||
|
||||
D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
|
||||
D_PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
|
||||
{
|
||||
D_PAD* pad = NULL;
|
||||
wxPoint aPosition;
|
||||
const wxPoint &aPosition = aTrace->GetEndPoint( aEndPoint );
|
||||
|
||||
LAYER_MSK aLayerMask = GetLayerMask( aTrace->GetLayer() );
|
||||
|
||||
if( aEndPoint == FLG_START )
|
||||
{
|
||||
aPosition = aTrace->GetStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
aPosition = aTrace->GetEnd();
|
||||
}
|
||||
|
||||
for( MODULE* module = m_Modules; module; module = module->Next() )
|
||||
{
|
||||
pad = module->GetPad( aPosition, aLayerMask );
|
||||
|
@ -1777,9 +1756,10 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNe
|
|||
}
|
||||
|
||||
|
||||
TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask )
|
||||
TRACK* BOARD::GetTrack( TRACK* aTrace, const wxPoint& aPosition,
|
||||
LAYER_MSK aLayerMask ) const
|
||||
{
|
||||
for( TRACK* track = aTrace; track; track = track->Next() )
|
||||
for( TRACK* track = aTrace; track; track = track->Next() )
|
||||
{
|
||||
LAYER_NUM layer = track->GetLayer();
|
||||
|
||||
|
@ -1846,16 +1826,16 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
|
|||
if( aTrace->Type() == PCB_VIA_T )
|
||||
{
|
||||
TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL;
|
||||
Segm1 = ::GetTrace( m_Track, NULL, aTrace->GetStart(), layerMask );
|
||||
Segm1 = ::GetTrack( m_Track, NULL, aTrace->GetStart(), layerMask );
|
||||
|
||||
if( Segm1 )
|
||||
{
|
||||
Segm2 = ::GetTrace( Segm1->Next(), NULL, aTrace->GetStart(), layerMask );
|
||||
Segm2 = ::GetTrack( Segm1->Next(), NULL, aTrace->GetStart(), layerMask );
|
||||
}
|
||||
|
||||
if( Segm2 )
|
||||
{
|
||||
Segm3 = ::GetTrace( Segm2->Next(), NULL, aTrace->GetStart(), layerMask );
|
||||
Segm3 = ::GetTrack( Segm2->Next(), NULL, aTrace->GetStart(), layerMask );
|
||||
}
|
||||
|
||||
if( Segm3 ) // More than 2 segments are connected to this via. the track" is only this via
|
||||
|
@ -1903,7 +1883,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
|
|||
|
||||
layerMask = via->GetLayerMask();
|
||||
|
||||
TRACK* track = ::GetTrace( m_Track, NULL, via->GetStart(), layerMask );
|
||||
TRACK* track = ::GetTrack( m_Track, NULL, via->GetStart(), layerMask );
|
||||
|
||||
// GetTrace does not consider tracks flagged BUSY.
|
||||
// So if no connected track found, this via is on the current track
|
||||
|
@ -1925,7 +1905,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
|
|||
*/
|
||||
LAYER_NUM layer = track->GetLayer();
|
||||
|
||||
while( ( track = ::GetTrace( track->Next(), NULL, via->GetStart(), layerMask ) ) != NULL )
|
||||
while( ( track = ::GetTrack( track->Next(), NULL, via->GetStart(), layerMask ) ) != NULL )
|
||||
{
|
||||
if( layer != track->GetLayer() )
|
||||
{
|
||||
|
@ -2127,10 +2107,10 @@ BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LAYER_MSK a
|
|||
}
|
||||
|
||||
/* No pad has been located so check for a segment of the trace. */
|
||||
TRACK* segment = ::GetTrace( m_Track, NULL, aPosition, aLayerMask );
|
||||
TRACK* segment = ::GetTrack( m_Track, NULL, aPosition, aLayerMask );
|
||||
|
||||
if( segment == NULL )
|
||||
segment = GetTrace( m_Track, aPosition, aLayerMask );
|
||||
segment = GetTrack( m_Track, aPosition, aLayerMask );
|
||||
|
||||
return segment;
|
||||
}
|
||||
|
@ -2199,7 +2179,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
|
|||
aSegment->end = newTrack;
|
||||
aSegment->SetState( END_ONPAD, false );
|
||||
|
||||
D_PAD * pad = GetPad( newTrack, FLG_START );
|
||||
D_PAD * pad = GetPad( newTrack, ENDPOINT_START );
|
||||
|
||||
if ( pad )
|
||||
{
|
||||
|
|
|
@ -284,7 +284,7 @@ public:
|
|||
|
||||
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
|
||||
DLIST<MODULE> m_Modules; // linked list of MODULEs
|
||||
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
|
||||
DLIST<TRACK> m_Track; // linked list of TRACKs and VIAs
|
||||
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
|
||||
|
||||
/// Ratsnest list for the BOARD
|
||||
|
@ -1368,9 +1368,9 @@ public:
|
|||
* </p>
|
||||
* @param aPosition The wxPoint to HitTest() against.
|
||||
* @param aLayer The layer to search. Use -1 for a don't care.
|
||||
* @return TRACK* A point a to the SEGVIA object if found, else NULL.
|
||||
* @return VIA* A point a to the VIA object if found, else NULL.
|
||||
*/
|
||||
TRACK* GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
|
||||
VIA* GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER ) const;
|
||||
|
||||
/**
|
||||
* Function GetPad
|
||||
|
@ -1390,7 +1390,7 @@ public:
|
|||
* @param aEndPoint The end point of \a aTrace the hit test against.
|
||||
* @return A pointer to a D_PAD object if found or NULL if not found.
|
||||
*/
|
||||
D_PAD* GetPad( TRACK* aTrace, int aEndPoint );
|
||||
D_PAD* GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint );
|
||||
|
||||
/**
|
||||
* Function GetPadFast
|
||||
|
@ -1436,7 +1436,7 @@ public:
|
|||
void GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNetCode = -1 );
|
||||
|
||||
/**
|
||||
* Function GetTrace
|
||||
* Function GetTrack
|
||||
* find the segment of \a aTrace at \a aPosition on \a aLayer if \a Layer is visible.
|
||||
* Traces that are flagged as deleted or busy are ignored.
|
||||
*
|
||||
|
@ -1446,7 +1446,7 @@ public:
|
|||
* layer mask.
|
||||
* @return A TRACK object pointer if found otherwise NULL.
|
||||
*/
|
||||
TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
|
||||
TRACK* GetTrack( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ) const;
|
||||
|
||||
/**
|
||||
* Function MarkTrace
|
||||
|
|
|
@ -69,9 +69,6 @@ public:
|
|||
/// skip the linked list stuff, and parent
|
||||
const DRAWSEGMENT& operator = ( const DRAWSEGMENT& rhs );
|
||||
|
||||
DRAWSEGMENT* Next() const { return (DRAWSEGMENT*) Pnext; }
|
||||
DRAWSEGMENT* Back() const { return (DRAWSEGMENT*) Pback; }
|
||||
|
||||
void SetWidth( int aWidth ) { m_Width = aWidth; }
|
||||
int GetWidth() const { return m_Width; }
|
||||
|
||||
|
|
|
@ -51,9 +51,6 @@ public:
|
|||
|
||||
~EDGE_MODULE();
|
||||
|
||||
EDGE_MODULE* Next() const { return (EDGE_MODULE*) Pnext; }
|
||||
EDGE_MODULE* Back() const { return (EDGE_MODULE*) Pback; }
|
||||
|
||||
/// skip the linked list stuff, and parent
|
||||
const EDGE_MODULE& operator = ( const EDGE_MODULE& rhs );
|
||||
|
||||
|
|
|
@ -56,9 +56,6 @@ public:
|
|||
|
||||
~PCB_TARGET();
|
||||
|
||||
PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; }
|
||||
PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; }
|
||||
|
||||
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // override
|
||||
const wxPoint& GetPosition() const { return m_Pos; } // override
|
||||
|
||||
|
|
|
@ -422,9 +422,12 @@ EDA_RECT MODULE::GetFootprintRect() const
|
|||
area.SetEnd( m_Pos );
|
||||
area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
|
||||
|
||||
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
|
||||
if( edge->Type() == PCB_MODULE_EDGE_T )
|
||||
for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() )
|
||||
{
|
||||
const EDGE_MODULE *edge = dynamic_cast<const EDGE_MODULE*>( item );
|
||||
if( edge )
|
||||
area.Merge( edge->GetBoundingBox() );
|
||||
}
|
||||
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
area.Merge( pad->GetBoundingBox() );
|
||||
|
|
|
@ -77,8 +77,8 @@ public:
|
|||
|
||||
~MODULE();
|
||||
|
||||
MODULE* Next() const { return (MODULE*) Pnext; }
|
||||
MODULE* Back() const { return (MODULE*) Pback; }
|
||||
MODULE* Next() const { return static_cast<MODULE*>( Pnext ); }
|
||||
MODULE* Back() const { return static_cast<MODULE*>( Pback ); }
|
||||
|
||||
void Copy( MODULE* Module ); // Copy structure
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -234,7 +234,7 @@ private:
|
|||
|
||||
|
||||
/**
|
||||
* Class NETINFO
|
||||
* Class NETINFO_LIST
|
||||
* is a container class for NETINFO_ITEM elements, which are the nets. That makes
|
||||
* this class a container for the nets.
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue