Commit c3b448b6 authored by Maciej Suminski's avatar Maciej Suminski

Upstream merge.

parents e7ea0480 fca1ba67
......@@ -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();
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,21 +528,20 @@ 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 )
// Add via holes
for( VIA* via = GetFirstVia( pcb->m_Track ); via != NULL;
via = GetFirstVia( via->Next() ) )
{
int shape = track->GetShape();
int holediameter = track->GetDrillValue();
VIATYPE_T viatype = via->GetViaType();
int holediameter = via->GetDrillValue();
int hole_outer_radius = (holediameter + thickness) / 2;
if( shape == VIA_THROUGH )
if( viatype == VIA_THROUGH )
TransformCircleToPolygon( allLayerHoles,
track->GetStart(), hole_outer_radius,
via->GetStart(), hole_outer_radius,
segcountLowQuality );
}
}
// draw pads holes
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
......@@ -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 );
}
}
......@@ -821,13 +821,18 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold )
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")
......@@ -880,10 +885,10 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
}
// 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();
......
///////////////////////////////////////////////////////////////////////////
// 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();
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// 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 );
......
This diff is collapsed.
/*
* 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 );
}
#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.
}
#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,43 @@ PGM_BASE& Pgm()
struct APP_SINGLE_TOP : public wxApp
{
bool OnInit() // overload wxApp virtual
{
try
{
return Pgm().OnPgmInit( this );
}
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 false;
}
int OnExit() // overload wxApp virtual
{
Pgm().OnPgmExit();
return wxApp::OnExit();
}
int OnRun() // overload wxApp virtual
{
int ret = -1;
try
{
return wxApp::OnRun();
ret = wxApp::OnRun();
}
catch( const std::exception& e )
{
......@@ -241,16 +198,16 @@ 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 ret;
}
/**
......@@ -307,10 +264,30 @@ static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
// No further reporting required here.
}
else
{
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
(void) dso.Detach();
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 )
{
if( !aPart )
break;
Pin = (LIB_PIN*) objectToSync;
LIB_PIN* pin = (LIB_PIN*) aComponent;
if( Pin->GetNumber() )
if( pin->GetNumber() )
{
wxString pinnum;
Pin->PinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
pin->PinStringNum( pinnum );
return StrPrintf( "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
else
{
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
}
SendCommand( MSG_TO_PCB, Line );
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
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.
......
This diff is collapsed.
......@@ -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,11 +764,25 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
{
fn.SetExt( PcbFileExtension );
if( Kiface().IsSingle() )
{
wxString filename = QuoteFullPath( fn );
ExecuteFile( this, PCBNEW_EXE, filename );
}
else
{
KIWAY_PLAYER* player = Kiway().Player( FRAME_PCB, false ); // test open already.
if( !player )
{
player = Kiway().Player( FRAME_PCB, true );
player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
player->Show( true );
}
player->Raise();
}
}
else
{
ExecuteFile( this, PCBNEW_EXE );
}
......@@ -782,10 +796,25 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
fn.SetExt( NetlistFileExtension );
if( fn.IsOk() && fn.FileExists() )
{
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
{
ExecuteFile( this, CVPCB_EXE );
}
......@@ -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,
......
#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()
};
......
......@@ -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_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 );
// If you change the vtable, recompile all of KiCad.
/**
* 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 );
// Don't change the order of these VTBL_ENTRYs, add new ones at the end,
// unless you recompile all of KiCad.
/**
* 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 );
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad );
/**
* 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();
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 );
/// hooked into m_top in SetTop(), marks child frame as closed.
void playerDestroyHandler( wxWindowDestroyEvent& event );
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
static int m_kiface_version[KIWAY_FACE_COUNT];
// 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
PGM_BASE* m_program;
wxFrame* m_top;
KIFACE* m_kiface[FACE_COUNT];
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_
#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_
#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_
#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 );
......
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
install( TARGETS kicad
DESTINATION ${KICAD_BIN}
COMPONENT binary)
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;
......
......@@ -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" )
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,6 +155,8 @@ void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( Kiway.PlayersClose( false ) )
{
int px, py;
UpdateFileHistory( m_ProjectFileName.GetFullPath(), &Pgm().GetFileHistory() );
......@@ -172,6 +177,7 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
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" ),
wxString msg = wxString::Format( _(
"Working dir: %s\nProject: %s\n" ),
GetChars( wxGetCwd() ),
GetChars( m_ProjectFileName.GetFullPath() ) );
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.
......
This diff is collapsed.
......@@ -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;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment