Commit e13f8621 authored by Maciej Suminski's avatar Maciej Suminski

Merged upstream.

parents c7bc1e15 3e3869ed
...@@ -3,13 +3,16 @@ boost_root ...@@ -3,13 +3,16 @@ boost_root
common/netlist_keywords.* common/netlist_keywords.*
common/netlist_lexer.h common/netlist_lexer.h
common/pcb_plot_params_lexer.h common/pcb_plot_params_lexer.h
common/page_layout_reader_keywords.cpp common/page_layout/page_layout_reader_keywords.cpp
common/fp_lib_table_keywords.* common/fp_lib_table_keywords.*
include/fp_lib_table_lexer.h include/fp_lib_table_lexer.h
include/netlist_lexer.h include/netlist_lexer.h
include/page_layout_reader_lexer.h include/page_layout_reader_lexer.h
eeschema/cmp_library_lexer.h eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.* eeschema/cmp_library_keywords.*
eeschema/dialogs/dialog_bom_cfg_keywords.cpp
eeschema/dialogs/dialog_bom_cfg_lexer.h
eeschema/dialogs/dialog_bom_help_html.h
eeschema/template_fieldnames_keywords.* eeschema/template_fieldnames_keywords.*
eeschema/template_fieldnames_lexer.h eeschema/template_fieldnames_lexer.h
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
......
...@@ -489,24 +489,24 @@ void EDA_3D_CANVAS::InitGL() ...@@ -489,24 +489,24 @@ void EDA_3D_CANVAS::InitGL()
m_ZTop = 10.0; m_ZTop = 10.0;
glDisable( GL_CULL_FACE ); // show back faces glDisable( GL_CULL_FACE ); // show back faces
glEnable( GL_DEPTH_TEST ); // Enable z-buferring glEnable( GL_DEPTH_TEST ); // Enable z-buferring
glEnable( GL_ALPHA_TEST );
glEnable( GL_LINE_SMOOTH ); glEnable( GL_LINE_SMOOTH );
// glEnable(GL_POLYGON_SMOOTH); // creates issues with some graphic cards
glShadeModel( GL_SMOOTH );
glEnable( GL_COLOR_MATERIAL ); glEnable( GL_COLOR_MATERIAL );
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
/* speedups */ // speedups
glEnable( GL_DITHER ); glEnable( GL_DITHER );
glShadeModel( GL_SMOOTH );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE ); glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST ); // can be GL_FASTEST glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
/* blend */ // Initialize alpha blending function.
glEnable( GL_BLEND ); glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
} }
// set viewing projection // set viewing projection
......
This diff is collapsed.
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <info3d_visu.h> #include <info3d_visu.h>
#include <3d_draw_basic_functions.h> #include <3d_draw_basic_functions.h>
// Imported function: // Imported function:
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits ); extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void CheckGLError(); extern void CheckGLError();
...@@ -122,7 +121,7 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList, ...@@ -122,7 +121,7 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
} }
void SetGLColor( EDA_COLOR_T color ) void SetGLColor( EDA_COLOR_T color, double alpha )
{ {
double red, green, blue; double red, green, blue;
const StructColors &colordata = g_ColorRefs[ColorGetBase( color )]; const StructColors &colordata = g_ColorRefs[ColorGetBase( color )];
...@@ -130,7 +129,7 @@ void SetGLColor( EDA_COLOR_T color ) ...@@ -130,7 +129,7 @@ void SetGLColor( EDA_COLOR_T color )
red = colordata.m_Red / 255.0; red = colordata.m_Red / 255.0;
blue = colordata.m_Blue / 255.0; blue = colordata.m_Blue / 255.0;
green = colordata.m_Green / 255.0; green = colordata.m_Green / 255.0;
glColor3f( red, green, blue ); glColor4f( red, green, blue, alpha );
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* @param aThickness = thickness in board internal units * @param aThickness = thickness in board internal units
* @param aBiuTo3DUnits = board internal units to 3D units scaling value * @param aBiuTo3DUnits = board internal units to 3D units scaling value
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos. * If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
* If aThickness 1 0, a solid object is drawn. * If aThickness > 0, a solid object is drawn.
* The top side is located at aZpos + aThickness / 2 * The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2 * The bottom side is located at aZpos - aThickness / 2
*/ */
...@@ -118,5 +118,12 @@ void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius, ...@@ -118,5 +118,12 @@ void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius,
void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos, void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
int aRadius, int aHeight, int aThickness, int aRadius, int aHeight, int aThickness,
int aZpos, double aBiuTo3DUnits ); int aZpos, double aBiuTo3DUnits );
/**
* Set the current 3D color from a Kicad color, with optional transparency
* @param aColor = a EDA_COLOR_T kicad color index
* @param aTransparency = the color transparency (default = 1.0 = no transparency)
*/
void SetGLColor( EDA_COLOR_T aColor, double aTransparency = 1.0 );
#endif // _3D_DRAW_BASIC_FUNCTIONS_H_ #endif // _3D_DRAW_BASIC_FUNCTIONS_H_
...@@ -47,6 +47,7 @@ static const wxString keySizey( wxT( "Size_y" ) ); ...@@ -47,6 +47,7 @@ static const wxString keySizey( wxT( "Size_y" ) );
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) ); static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) ); static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) ); static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
static const wxString keyShowRealisticMode( wxT( "ShowRealisticMode" ) );
static const wxString keyShowAxis( wxT( "ShowAxis" ) ); static const wxString keyShowAxis( wxT( "ShowAxis" ) );
static const wxString keyShowZones( wxT( "ShowZones" ) ); static const wxString keyShowZones( wxT( "ShowZones" ) );
static const wxString keyShowFootprints( wxT( "ShowFootprints" ) ); static const wxString keyShowFootprints( wxT( "ShowFootprints" ) );
...@@ -56,6 +57,7 @@ static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) ) ...@@ -56,6 +57,7 @@ static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) )
static const wxString keyShowSolderMaskLayers( wxT( "ShowSolderMasLayers" ) ); static const wxString keyShowSolderMaskLayers( wxT( "ShowSolderMasLayers" ) );
static const wxString keyShowSolderPasteLayers( wxT( "ShowSolderPasteLayers" ) ); static const wxString keyShowSolderPasteLayers( wxT( "ShowSolderPasteLayers" ) );
static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) ); static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) );
static const wxString keyShowBoardBody( wxT( "ShowBoardBody" ) );
static const wxString keyShowEcoLayers( wxT( "ShowEcoLayers" ) ); static const wxString keyShowEcoLayers( wxT( "ShowEcoLayers" ) );
BEGIN_EVENT_TABLE( EDA_3D_FRAME, wxFrame ) BEGIN_EVENT_TABLE( EDA_3D_FRAME, wxFrame )
...@@ -152,6 +154,7 @@ void EDA_3D_FRAME::GetSettings() ...@@ -152,6 +154,7 @@ void EDA_3D_FRAME::GetSettings()
{ {
wxString text; wxString text;
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
class INFO3D_VISU& prms = g_Parm_3D_Visu;
if( config ) if( config )
{ {
...@@ -166,19 +169,43 @@ void EDA_3D_FRAME::GetSettings() ...@@ -166,19 +169,43 @@ void EDA_3D_FRAME::GetSettings()
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 ); config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 ); config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
class INFO3D_VISU& prms = g_Parm_3D_Visu;
config->Read( keyShowAxis, &prms.m_DrawFlags[prms.FL_AXIS], true ); bool tmp;
config->Read( keyShowFootprints, &prms.m_DrawFlags[prms.FL_MODULE], true ); config->Read( keyShowRealisticMode, &tmp, false );
config->Read( keyShowCopperThickness, prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
&prms.m_DrawFlags[prms.FL_USE_COPPER_THICKNESS],
false ); config->Read( keyShowAxis, &tmp, true );
config->Read( keyShowZones, &prms.m_DrawFlags[prms.FL_ZONE], true ); prms.SetFlag( FL_AXIS, tmp );
config->Read( keyShowAdhesiveLayers, &prms.m_DrawFlags[prms.FL_ADHESIVE], true );
config->Read( keyShowSilkScreenLayers, &prms.m_DrawFlags[prms.FL_SILKSCREEN], true ); config->Read( keyShowFootprints, &tmp, true );
config->Read( keyShowSolderMaskLayers, &prms.m_DrawFlags[prms.FL_SOLDERMASK], true ); prms.SetFlag( FL_MODULE, tmp );
config->Read( keyShowSolderPasteLayers, &prms.m_DrawFlags[prms.FL_SOLDERPASTE], true );
config->Read( keyShowCommentsLayer, &prms.m_DrawFlags[prms.FL_COMMENTS], true ); config->Read( keyShowCopperThickness, &tmp, false );
config->Read( keyShowEcoLayers, &prms.m_DrawFlags[prms.FL_ECO], true ); prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
config->Read( keyShowZones, &tmp, true );
prms.SetFlag( FL_ZONE, tmp );
config->Read( keyShowAdhesiveLayers, &tmp, true );
prms.SetFlag( FL_ADHESIVE, tmp );
config->Read( keyShowSilkScreenLayers, &tmp, true );
prms.SetFlag( FL_SILKSCREEN, tmp );
config->Read( keyShowSolderMaskLayers, &tmp, true );
prms.SetFlag( FL_SOLDERMASK, tmp );
config->Read( keyShowSolderPasteLayers, &tmp, true );
prms.SetFlag( FL_SOLDERPASTE, tmp );
config->Read( keyShowCommentsLayer, &tmp, true );
prms.SetFlag( FL_COMMENTS, tmp );
config->Read( keyShowEcoLayers, &tmp, true );
prms.SetFlag( FL_ECO, tmp );
config->Read( keyShowBoardBody, &tmp, true );
prms.SetFlag( FL_SHOW_BOARD_BODY, tmp );
} }
} }
...@@ -195,16 +222,18 @@ void EDA_3D_FRAME::SaveSettings() ...@@ -195,16 +222,18 @@ void EDA_3D_FRAME::SaveSettings()
config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green ); config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue ); config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
class INFO3D_VISU& prms = g_Parm_3D_Visu; class INFO3D_VISU& prms = g_Parm_3D_Visu;
config->Write( keyShowAxis, prms.m_DrawFlags[prms.FL_AXIS] ); config->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
config->Write( keyShowFootprints, prms.m_DrawFlags[prms.FL_MODULE] ); config->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
config->Write( keyShowCopperThickness, prms.m_DrawFlags[prms.FL_USE_COPPER_THICKNESS] ); config->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
config->Write( keyShowZones, prms.m_DrawFlags[prms.FL_ZONE] ); config->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
config->Write( keyShowAdhesiveLayers, prms.m_DrawFlags[prms.FL_ADHESIVE] ); config->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
config->Write( keyShowSilkScreenLayers, prms.m_DrawFlags[prms.FL_SILKSCREEN] ); config->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
config->Write( keyShowSolderMaskLayers, prms.m_DrawFlags[prms.FL_SOLDERMASK] ); config->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
config->Write( keyShowSolderPasteLayers, prms.m_DrawFlags[prms.FL_SOLDERPASTE] ); config->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
config->Write( keyShowCommentsLayer, prms.m_DrawFlags[prms.FL_COMMENTS] ); config->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
config->Write( keyShowEcoLayers, prms.m_DrawFlags[prms.FL_ECO] ); config->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
config->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
config->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
if( IsIconized() ) if( IsIconized() )
return; return;
...@@ -355,53 +384,63 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -355,53 +384,63 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
Set3DBgColor(); Set3DBgColor();
return; return;
case ID_MENU3D_REALISTIC_MODE:
g_Parm_3D_Visu.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
NewDisplay();
return;
case ID_MENU3D_SHOW_BOARD_BODY:
g_Parm_3D_Visu.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
NewDisplay();
return;
case ID_MENU3D_AXIS_ONOFF: case ID_MENU3D_AXIS_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS] = isChecked; g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_MODULE_ONOFF: case ID_MENU3D_MODULE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] = isChecked; g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_USE_COPPER_THICKNESS: case ID_MENU3D_USE_COPPER_THICKNESS:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] = isChecked; g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_ZONE_ONOFF: case ID_MENU3D_ZONE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] = isChecked; g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_ADHESIVE_ONOFF: case ID_MENU3D_ADHESIVE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] = isChecked; g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_SILKSCREEN_ONOFF: case ID_MENU3D_SILKSCREEN_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] = isChecked; g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_SOLDER_MASK_ONOFF: case ID_MENU3D_SOLDER_MASK_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] = isChecked; g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_SOLDER_PASTE_ONOFF: case ID_MENU3D_SOLDER_PASTE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] = isChecked; g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_COMMENTS_ONOFF: case ID_MENU3D_COMMENTS_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] = isChecked; g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
NewDisplay(); NewDisplay();
return; return;
case ID_MENU3D_ECO_ONOFF: case ID_MENU3D_ECO_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] = isChecked; g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
NewDisplay(); NewDisplay();
return; return;
...@@ -431,26 +470,26 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event ) ...@@ -431,26 +470,26 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_MENU3D_GRID_NOGRID: case ID_MENU3D_GRID_NOGRID:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = false; g_Parm_3D_Visu.SetFlag( FL_GRID, false );
break; break;
case ID_MENU3D_GRID_10_MM: case ID_MENU3D_GRID_10_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true; g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 10.0; g_Parm_3D_Visu.m_3D_Grid = 10.0;
break; break;
case ID_MENU3D_GRID_5_MM: case ID_MENU3D_GRID_5_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true; g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 5.0; g_Parm_3D_Visu.m_3D_Grid = 5.0;
break; break;
case ID_MENU3D_GRID_2P5_MM: case ID_MENU3D_GRID_2P5_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true; g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 2.5; g_Parm_3D_Visu.m_3D_Grid = 2.5;
break; break;
case ID_MENU3D_GRID_1_MM: case ID_MENU3D_GRID_1_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true; g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 1.0; g_Parm_3D_Visu.m_3D_Grid = 1.0;
break; break;
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -158,17 +158,19 @@ void EDA_3D_FRAME::CreateMenuBar() ...@@ -158,17 +158,19 @@ void EDA_3D_FRAME::CreateMenuBar()
menuBar->Append( prefsMenu, _( "&Preferences" ) ); menuBar->Append( prefsMenu, _( "&Preferences" ) );
AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
_( "Realistic Mode" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_BGCOLOR_SELECTION, AddMenuItem( prefsMenu, ID_MENU3D_BGCOLOR_SELECTION,
_( "Choose background color" ), KiBitmap( palette_xpm ) ); _( "Choose background color" ), KiBitmap( palette_xpm ) );
wxMenuItem* item; AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
item = AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK ); _( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS]);
// Creates grid menu // Creates grid menu
wxMenu * gridlistMenu = new wxMenu; wxMenu * gridlistMenu = new wxMenu;
item = AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID, AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
_( "3D Grid" ), KiBitmap( grid_xpm ) ); _( "3D Grid" ), KiBitmap( grid_xpm ) );
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true ); gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true ); gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
...@@ -178,36 +180,42 @@ void EDA_3D_FRAME::CreateMenuBar() ...@@ -178,36 +180,42 @@ void EDA_3D_FRAME::CreateMenuBar()
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true ); gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true ); gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
item = AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS, prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_SHOW_BOARD_BODY,
_( "Show Board Body" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS,
_( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK ); _( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF,
_( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK ); _( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
_( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK ); _( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF, prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF,
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK ); _( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE]);
item = AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF,
_( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK ); _( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK ); _( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK ); _( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK ); _( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
item = AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF, AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF,
_( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK ); _( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
SetMenuBarOptionsState();
SetMenuBar( menuBar ); SetMenuBar( menuBar );
SetMenuBarOptionsState();
} }
void EDA_3D_FRAME::SetMenuBarOptionsState() void EDA_3D_FRAME::SetMenuBarOptionsState()
...@@ -219,32 +227,41 @@ void EDA_3D_FRAME::SetMenuBarOptionsState() ...@@ -219,32 +227,41 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
wxMenuItem* item; wxMenuItem* item;
// Set the state of toggle menus according to the current display options // Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
item->Check(g_Parm_3D_Visu.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
item->Check(g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) );
item = menuBar->FindItem( ID_MENU3D_USE_COPPER_THICKNESS ); item = menuBar->FindItem( ID_MENU3D_USE_COPPER_THICKNESS );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS]); item->Check(g_Parm_3D_Visu.GetFlag( FL_USE_COPPER_THICKNESS ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF ); item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE]); item->Check(g_Parm_3D_Visu.GetFlag( FL_MODULE ) );
item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF ); item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE]); item->Check(g_Parm_3D_Visu.GetFlag( FL_ZONE ) );
item = menuBar->FindItem( ID_MENU3D_AXIS_ONOFF );
item->Check(g_Parm_3D_Visu.GetFlag( FL_AXIS ) );
item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF ); item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE]); item->Check(g_Parm_3D_Visu.GetFlag( FL_ADHESIVE ) );
item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF ); item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN]); item->Check(g_Parm_3D_Visu.GetFlag( FL_SILKSCREEN ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF ); item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK]); item->Check(g_Parm_3D_Visu.GetFlag( FL_SOLDERMASK ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF ); item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE]); item->Check(g_Parm_3D_Visu.GetFlag( FL_SOLDERPASTE ) );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF ); item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS]); item->Check(g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF ); item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO]); item->Check(g_Parm_3D_Visu.GetFlag( FL_ECO ));
} }
void EDA_3D_FRAME::SetToolbars() void EDA_3D_FRAME::SetToolbars()
......
...@@ -39,6 +39,8 @@ enum id_3dview_frm ...@@ -39,6 +39,8 @@ enum id_3dview_frm
ID_MENU3D_SOLDER_MASK_ONOFF, ID_MENU3D_SOLDER_MASK_ONOFF,
ID_MENU3D_COMMENTS_ONOFF, ID_MENU3D_COMMENTS_ONOFF,
ID_MENU3D_ECO_ONOFF, ID_MENU3D_ECO_ONOFF,
ID_MENU3D_SHOW_BOARD_BODY,
ID_MENU3D_REALISTIC_MODE,
ID_END_COMMAND_3D, ID_END_COMMAND_3D,
ID_TOOL_SET_VISIBLE_ITEMS, ID_TOOL_SET_VISIBLE_ITEMS,
......
...@@ -10,6 +10,7 @@ public: ...@@ -10,6 +10,7 @@ public:
private: private:
EDA_3D_FRAME* m_parent; EDA_3D_FRAME* m_parent;
INFO3D_VISU & m_3Dprms;
void initDialog(); void initDialog();
...@@ -31,7 +32,7 @@ void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event ) ...@@ -31,7 +32,7 @@ void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent ) DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
:DIALOG_3D_VIEW_OPTIONS_BASE( parent ) :DIALOG_3D_VIEW_OPTIONS_BASE( parent ), m_3Dprms( g_Parm_3D_Visu )
{ {
m_parent = parent; m_parent = parent;
...@@ -55,24 +56,15 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog() ...@@ -55,24 +56,15 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) ); m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
// Check/uncheck checkboxes // Check/uncheck checkboxes
m_checkBoxCuThickness->SetValue( m_checkBoxCuThickness->SetValue( m_3Dprms.GetFlag( FL_USE_COPPER_THICKNESS ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] ); m_checkBox3Dshapes->SetValue( m_3Dprms.GetFlag( FL_MODULE ) );
m_checkBox3Dshapes->SetValue( m_checkBoxAreas->SetValue( m_3Dprms.GetFlag( FL_ZONE ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] ); m_checkBoxSilkscreen->SetValue( m_3Dprms.GetFlag( FL_SILKSCREEN ) );
m_checkBoxAreas->SetValue( m_checkBoxSolderMask->SetValue( m_3Dprms.GetFlag( FL_SOLDERMASK ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] ); m_checkBoxSolderpaste->SetValue( m_3Dprms.GetFlag( FL_SOLDERPASTE ) );
m_checkBoxSilkscreen->SetValue( m_checkBoxAdhesive->SetValue( m_3Dprms.GetFlag( FL_ADHESIVE ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] ); m_checkBoxComments->SetValue( m_3Dprms.GetFlag( FL_COMMENTS ) );
m_checkBoxSolderMask->SetValue( m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] );
m_checkBoxSolderpaste->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] );
m_checkBoxAdhesive->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] );
m_checkBoxComments->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] );
m_checkBoxECO->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] );
} }
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event ) void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
...@@ -105,24 +97,16 @@ void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event ) ...@@ -105,24 +97,16 @@ void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event ) void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
{ {
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] = m_3Dprms.SetFlag( FL_USE_COPPER_THICKNESS,
m_checkBoxCuThickness->GetValue(); m_checkBoxCuThickness->GetValue() );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] = m_3Dprms.SetFlag( FL_MODULE, m_checkBox3Dshapes->GetValue() );
m_checkBox3Dshapes->GetValue(); m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] = m_3Dprms.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() );
m_checkBoxAreas->GetValue(); m_3Dprms.SetFlag( FL_SOLDERMASK, m_checkBoxSolderMask->GetValue() );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] = m_3Dprms.SetFlag( FL_SOLDERPASTE, m_checkBoxSolderpaste->GetValue() );
m_checkBoxSilkscreen->GetValue(); m_3Dprms.SetFlag( FL_ADHESIVE, m_checkBoxAdhesive->GetValue() );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] = m_3Dprms.SetFlag( FL_COMMENTS, m_checkBoxComments->GetValue() );
m_checkBoxSolderMask->GetValue(); m_3Dprms.SetFlag( FL_ECO, m_checkBoxECO->GetValue( ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] =
m_checkBoxSolderpaste->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] =
m_checkBoxAdhesive->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] =
m_checkBoxComments->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] =
m_checkBoxECO->GetValue();
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
// Thickness of copper // Thickness of copper
// TODO: define the actual copper thickness by user // TODO: define the actual copper thickness by user
#define COPPER_THICKNESS KiROUND( 0.035 * IU_PER_MM ) // for 35 µm #define COPPER_THICKNESS KiROUND( 0.035 * IU_PER_MM ) // for 35 um
#define TECH_LAYER_THICKNESS KiROUND( 0.04 * IU_PER_MM ) #define TECH_LAYER_THICKNESS KiROUND( 0.04 * IU_PER_MM )
#define EPOXY_THICKNESS KiROUND( 1.6 * IU_PER_MM ) // for 1.6 mm #define EPOXY_THICKNESS KiROUND( 1.6 * IU_PER_MM ) // for 1.6 mm
...@@ -68,10 +68,10 @@ INFO3D_VISU::INFO3D_VISU() ...@@ -68,10 +68,10 @@ INFO3D_VISU::INFO3D_VISU()
// default all special item layers Visible // default all special item layers Visible
for( ii = 0; ii < FL_LAST; ii++ ) for( ii = 0; ii < FL_LAST; ii++ )
m_DrawFlags[ii] = true; m_drawFlags[ii] = true;
m_DrawFlags[FL_GRID] = false; SetFlag( FL_GRID, false );
m_DrawFlags[FL_USE_COPPER_THICKNESS] = false; SetFlag( FL_USE_COPPER_THICKNESS, false );
} }
...@@ -124,8 +124,10 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) ...@@ -124,8 +124,10 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
m_EpoxyThickness * layer / (copper_layers_cnt - 1); m_EpoxyThickness * layer / (copper_layers_cnt - 1);
} }
double zpos_copper_back = m_LayerZcoord[0]; #define layerThicknessMargin 1.1
double zpos_copper_front = m_EpoxyThickness; double zpos_offset = m_NonCopperLayerThickness * layerThicknessMargin;
double zpos_copper_back = m_LayerZcoord[0] - layerThicknessMargin*m_CopperThickness/2;
double zpos_copper_front = m_EpoxyThickness + layerThicknessMargin*m_CopperThickness/2;
// Fill remaining unused copper layers and front layer zpos // Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness // with m_EpoxyThickness
...@@ -138,54 +140,44 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) ...@@ -138,54 +140,44 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ ) for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
{ {
double zpos; double zpos;
#define NonCopperLayerThicknessMargin 1.1
switch( layer_id ) switch( layer_id )
{ {
case ADHESIVE_N_BACK: case ADHESIVE_N_BACK:
zpos = zpos_copper_back - zpos = zpos_copper_back - 4 * zpos_offset;
4 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case ADHESIVE_N_FRONT: case ADHESIVE_N_FRONT:
zpos = zpos_copper_front + zpos = zpos_copper_front + 4 * zpos_offset;
4 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case SOLDERPASTE_N_BACK: case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back - zpos = zpos_copper_back - 3 * zpos_offset;
3 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case SOLDERPASTE_N_FRONT: case SOLDERPASTE_N_FRONT:
zpos = zpos_copper_front + zpos = zpos_copper_front + 3 * zpos_offset;
3 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case SOLDERMASK_N_BACK: case SOLDERMASK_N_BACK:
zpos = zpos_copper_back - zpos = zpos_copper_back - 1 * zpos_offset;
1 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case SOLDERMASK_N_FRONT: case SOLDERMASK_N_FRONT:
zpos = zpos_copper_front + zpos = zpos_copper_front + 1 * zpos_offset;
1 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case SILKSCREEN_N_BACK: case SILKSCREEN_N_BACK:
zpos = zpos_copper_back - zpos = zpos_copper_back - 2 * zpos_offset;
2 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
case SILKSCREEN_N_FRONT: case SILKSCREEN_N_FRONT:
zpos = zpos_copper_front + zpos = zpos_copper_front + 2 * zpos_offset;
2 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
default: default:
zpos = zpos_copper_front + zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 5) * (layer_id - FIRST_NON_COPPER_LAYER + 5) * zpos_offset;
m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break; break;
} }
......
...@@ -63,25 +63,27 @@ public: S3D_COLOR() ...@@ -63,25 +63,27 @@ public: S3D_COLOR()
}; };
/* information needed to display 3D board */ /* information needed to display 3D board */
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_ADHESIVE, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE,
FL_COMMENTS, FL_ECO,
FL_GRID,
FL_USE_COPPER_THICKNESS,
FL_SHOW_BOARD_BODY,
FL_USE_REALISTIC_MODE,
FL_LAST
};
class INFO3D_VISU class INFO3D_VISU
{ {
public: public:
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_ADHESIVE, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE,
FL_COMMENTS, FL_ECO,
FL_GRID,
FL_USE_COPPER_THICKNESS,
FL_LAST
};
double m_Beginx, m_Beginy; // position of mouse (used in drag commands) double m_Beginx, m_Beginy; // position of mouse (used in drag commands)
double m_Quat[4]; // orientation of 3D view double m_Quat[4]; // orientation of 3D view
double m_Rot[4]; // rotation parameters of 3D view double m_Rot[4]; // rotation parameters of 3D view
double m_Zoom; // 3D zoom value double m_Zoom; // 3D zoom value
double m_3D_Grid; // 3D grid value, in mm double m_3D_Grid; // 3D grid value, in mm
S3D_COLOR m_BgColor; S3D_COLOR m_BgColor;
bool m_DrawFlags[FL_LAST]; // Enable/disable flags (see DISPLAY3D_FLG list)
wxPoint m_BoardPos; // center board actual position in board units wxPoint m_BoardPos; // center board actual position in board units
wxSize m_BoardSize; // board actual size in board units wxSize m_BoardSize; // board actual size in board units
int m_CopperLayersCount; // Number of copper layers actually used by the board int m_CopperLayersCount; // Number of copper layers actually used by the board
...@@ -98,10 +100,18 @@ private: ...@@ -98,10 +100,18 @@ private:
double m_CopperThickness; // Copper thickness (normalized) double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized) double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness double m_NonCopperLayerThickness; // Non copper layers thickness
bool m_drawFlags[FL_LAST]; // Enable/disable flags (see DISPLAY3D_FLG list)
public: INFO3D_VISU(); public: INFO3D_VISU();
~INFO3D_VISU(); ~INFO3D_VISU();
// Accessors
bool GetFlag( DISPLAY3D_FLG aFlag ) const { return m_drawFlags[aFlag]; }
bool SetFlag( DISPLAY3D_FLG aFlag, bool aState )
{
return m_drawFlags[aFlag] = aState;
}
/** /**
* Function InitSettings * Function InitSettings
* Initialize info 3D Parameters from aBoard * Initialize info 3D Parameters from aBoard
...@@ -133,11 +143,14 @@ public: INFO3D_VISU(); ...@@ -133,11 +143,14 @@ public: INFO3D_VISU();
* note: the thickness (Z size) of the copper is not the thickness * note: the thickness (Z size) of the copper is not the thickness
* of the layer (the thickness of the layer is the epoxy thickness / layer count) * of the layer (the thickness of the layer is the epoxy thickness / layer count)
* *
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0 * Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set,
* and normal mode, returns 0
*/ */
int GetCopperThicknessBIU() const int GetCopperThicknessBIU() const
{ {
return m_DrawFlags[FL_USE_COPPER_THICKNESS] ? bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
KiROUND( m_CopperThickness / m_BiuTo3Dunits ) KiROUND( m_CopperThickness / m_BiuTo3Dunits )
: 0; : 0;
} }
...@@ -156,11 +169,13 @@ public: INFO3D_VISU(); ...@@ -156,11 +169,13 @@ public: INFO3D_VISU();
* @return the thickness (Z size) of a technical layer, * @return the thickness (Z size) of a technical layer,
* in Board Internal Units * in Board Internal Units
* *
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0 * Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
*/ */
int GetNonCopperLayerThicknessBIU() const int GetNonCopperLayerThicknessBIU() const
{ {
return m_DrawFlags[FL_USE_COPPER_THICKNESS] ? bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits ) KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits )
: 0; : 0;
} }
...@@ -170,7 +185,7 @@ public: INFO3D_VISU(); ...@@ -170,7 +185,7 @@ public: INFO3D_VISU();
* @return the thickness (Z size) of the copper or a technical layer, * @return the thickness (Z size) of the copper or a technical layer,
* in Board Internal Units, depending on the layer id * in Board Internal Units, depending on the layer id
* *
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0 * Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
*/ */
int GetLayerObjectThicknessBIU( int aLayerId) const int GetLayerObjectThicknessBIU( int aLayerId) const
{ {
...@@ -178,6 +193,8 @@ public: INFO3D_VISU(); ...@@ -178,6 +193,8 @@ public: INFO3D_VISU();
GetNonCopperLayerThicknessBIU() : GetNonCopperLayerThicknessBIU() :
GetCopperThicknessBIU(); GetCopperThicknessBIU();
} }
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
}; };
extern INFO3D_VISU g_Parm_3D_Visu; extern INFO3D_VISU g_Parm_3D_Visu;
......
This diff is collapsed.
...@@ -56,11 +56,7 @@ macro( create_bzr_version_header ) ...@@ -56,11 +56,7 @@ macro( create_bzr_version_header )
if( Kicad_REPO_LAST_CHANGED_DATE ) if( Kicad_REPO_LAST_CHANGED_DATE )
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3" string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
_kicad_bzr_date ${Kicad_REPO_LAST_CHANGED_DATE} ) _kicad_bzr_date ${Kicad_REPO_LAST_CHANGED_DATE} )
if( KICAD_GOST ) set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION})" )
set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION} GOST)" )
else( KICAD_GOST )
set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION})" )
endif( KICAD_GOST )
# Definition to conditionally use date and revision returned from the # Definition to conditionally use date and revision returned from the
# Bazaar log command instead of hand coded date and revision in # Bazaar log command instead of hand coded date and revision in
......
...@@ -55,3 +55,17 @@ function( make_lexer inputFile outHeaderFile outCppFile enum ) ...@@ -55,3 +55,17 @@ function( make_lexer inputFile outHeaderFile outCppFile enum )
endfunction() endfunction()
# Is a macro instead of function so there's a higher probability that the
# scope of CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA is global
macro( add_conffiles )
if( ${ARGC} STREQUAL "0" )
# remove the file when user passes no arguments, which he should do exactly once at top
file( REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conffiles )
else()
foreach( filename ${ARGV} )
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/conffiles "${filename}\n" )
endforeach()
set( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_BINARY_DIR}/conffiles )
endif()
endmacro( add_conffiles )
...@@ -63,11 +63,11 @@ macro(perform_feature_checks) ...@@ -63,11 +63,11 @@ macro(perform_feature_checks)
# included in pyport.h which is where the problem ocurrs without this # included in pyport.h which is where the problem ocurrs without this
# fix. # fix.
check_include_file("stdint.h" HAVE_STDINT_H) check_include_file("stdint.h" HAVE_STDINT_H)
if( HAVE_STDINT_H ) if( HAVE_STDINT_H )
add_definitions( -DHAVE_STDINT_H ) add_definitions( -DHAVE_STDINT_H )
endif() endif()
# no place is this used, and "HAVE_STRINGS_H", if present in config.h then # no place is this used, and "HAVE_STRINGS_H", if present in config.h then
# conflicts with /usr/include/python2.6/Python.h. Please rename the macro if # conflicts with /usr/include/python2.6/Python.h. Please rename the macro if
# re-introduce this. # re-introduce this.
...@@ -81,14 +81,8 @@ macro(perform_feature_checks) ...@@ -81,14 +81,8 @@ macro(perform_feature_checks)
# Some platforms define malloc and free in malloc.h instead of stdlib.h. # Some platforms define malloc and free in malloc.h instead of stdlib.h.
check_symbol_exists(malloc "stdlib.h" MALLOC_IN_STDLIB_H) check_symbol_exists(malloc "stdlib.h" MALLOC_IN_STDLIB_H)
# Use ISO C++ conformant names to disable Visual C++ warnings.
check_symbol_exists(_stricmp "string.h" HAVE_ISO_STRICMP)
check_symbol_exists(_strnicmp "string.h" HAVE_ISO_STRNICMP)
check_symbol_exists(_snprintf "stdio.h" HAVE_ISO_SNPRINTF)
# Check for functions in math.h. # Check for functions in math.h.
check_include_file("math.h" HAVE_MATH_H) check_include_file("math.h" HAVE_MATH_H)
check_symbol_exists(_hypot "math.h" HAVE_ISO_HYPOT)
# Check for functions in C++ cmath. # Check for functions in C++ cmath.
check_include_file_cxx(cmath HAVE_CXX_CMATH) check_include_file_cxx(cmath HAVE_CXX_CMATH)
......
...@@ -8,13 +8,13 @@ string( REGEX REPLACE "\n" ";" files "${files}" ) ...@@ -8,13 +8,13 @@ string( REGEX REPLACE "\n" ";" files "${files}" )
foreach( file ${files} ) foreach( file ${files} )
message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" ) message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" )
if( EXISTS "$ENV{DESTDIR}${file}" ) if( EXISTS "$ENV{DESTDIR}${file}" )
EXEC_PROGRAM( exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval RETURN_VALUE rm_retval
) )
if( NOT "${rm_retval}" STREQUAL 0 ) if( NOT "${rm_retval}" STREQUAL "0" )
message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" ) message( STATUS "Problem when removing \"$ENV{DESTDIR}${file}\"" )
endif() endif()
else() else()
message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." ) message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )
......
...@@ -7,27 +7,9 @@ ...@@ -7,27 +7,9 @@
#cmakedefine HAVE_STRNCASECMP #cmakedefine HAVE_STRNCASECMP
#cmakedefine HAVE_ISO_STRICMP
#cmakedefine HAVE_ISO_STRNICMP
#cmakedefine HAVE_ISO_SNPRINTF
#if defined( HAVE_ISO_SNPRINTF )
#define snprintf _snprintf
#endif
// Handle platform differences in math.h // Handle platform differences in math.h
#cmakedefine HAVE_MATH_H #cmakedefine HAVE_MATH_H
#cmakedefine HAVE_ISO_HYPOT
#if defined( HAVE_ISO_HYPOT )
#define hypot _hypot
#endif
// Handle platform differences in C++ cmath. // Handle platform differences in C++ cmath.
#cmakedefine HAVE_CXX_CMATH #cmakedefine HAVE_CXX_CMATH
...@@ -57,14 +39,10 @@ ...@@ -57,14 +39,10 @@
#if defined( HAVE_STRCASECMP ) #if defined( HAVE_STRCASECMP )
#define stricmp strcasecmp #define stricmp strcasecmp
#elif defined( HAVE_ISO_STRICMP )
#define stricmp _stricmp
#endif #endif
#if defined( HAVE_STRNCASECMP ) #if defined( HAVE_STRNCASECMP )
#define strnicmp strncasecmp #define strnicmp strncasecmp
#elif defined( HAVE_ISO_STRNICMP )
#define strnicmp _strnicmp
#endif #endif
// Use Posix getc_unlocked() instead of getc() when it's available. // Use Posix getc_unlocked() instead of getc() when it's available.
......
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Download av_http and install into ${PREFIX}, typically in our KiCad source tree.
# Assumes include( ExternalProject ) was done inline previous to this file
# and that set( DOWNLOAD_DIR ... ) was set in a higher context.
#-----<configure>-------------------------------------------------------------------------------------
# soon cmake will have https support, switch to a true download then:
#set( AVHTTP_RELEASE ??? )
#set( AVHTTP_MD5 ???? ) # re-calc this on every RELEASE change
#-----</configure>-----------------------------------------------------------------------------------
# Where the library is to be installed.
set( PREFIX ${DOWNLOAD_DIR}/avhttp )
# Install the AVHTTP header only library ${PREFIX}
ExternalProject_Add( avhttp
PREFIX ${PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_DIR} # no true download yet
# grab it from a local zip file for now, cmake caller's source dir
URL ${CMAKE_CURRENT_SOURCE_DIR}/avhttp-master.zip
DEPENDS boost
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR> <INSTALL_DIR>
)
set( AVHTTP_INCLUDE_DIR "${PREFIX}/include" CACHE FILEPATH "AVHTTP include directory" )
mark_as_advanced( AVHTTP_INCLUDE_DIR )
...@@ -29,13 +29,8 @@ ...@@ -29,13 +29,8 @@
#-----<configure>---------------------------------------------------------------- #-----<configure>----------------------------------------------------------------
if( false ) set( BOOST_RELEASE 1.54.0 )
set( BOOST_RELEASE 1.53.0 ) set( BOOST_MD5 15cb8c0803064faef0c4ddf5bc5ca279 ) # re-calc this on every RELEASE change
set( BOOST_MD5 a00d22605d5dbcfb4c9936a9b35bc4c2 ) # re-calc this on every RELEASE change
else()
set( BOOST_RELEASE 1.54.0 )
set( BOOST_MD5 15cb8c0803064faef0c4ddf5bc5ca279 ) # re-calc this on every RELEASE change
endif()
# The boost headers [and static libs if built] go here, at the top of KiCad # The boost headers [and static libs if built] go here, at the top of KiCad
# source tree in boost_root. # source tree in boost_root.
...@@ -44,15 +39,22 @@ set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/boost_root" ) ...@@ -44,15 +39,22 @@ set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/boost_root" )
if( BUILD_GITHUB_PLUGIN ) if( BUILD_GITHUB_PLUGIN )
# Space separated list which indicates the subset of boost libraries to compile. # Space separated list which indicates the subset of boost libraries to compile.
# Chosen libraries are based on AVHTTP requirements, and possibly
# unit_test_framework for its own worth.
set( BOOST_LIBS_BUILT set( BOOST_LIBS_BUILT
#filesystem #context
system #coroutine
#regex date_time
#program_options
#date_time
#thread
#exception #exception
unit_test_framework filesystem
iostreams
locale
program_options
regex
#signals
system
thread
#unit_test_framework
) )
endif() endif()
...@@ -73,35 +75,54 @@ set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} ) ...@@ -73,35 +75,54 @@ set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
set( headers_src "${PREFIX}/src/boost/boost" ) set( headers_src "${PREFIX}/src/boost/boost" )
# don't look at this:
function( set_boost_lib_names libs output ) function( set_boost_lib_names libs output )
foreach( lib ${libs} ) foreach( lib ${libs} )
set( fullpath_lib, "${BOOST_ROOT}/lib/libboost_${lib}.a" ) set( fullpath_lib "${BOOST_ROOT}/lib/libboost_${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
message( STATUS "fullpath_lib:${fullpath_lib}" ) list( APPEND results ${fullpath_lib} )
set( output ${output} ${fullpath_lib} )
endforeach() endforeach()
# set the results into variable represented by output into caller's scope
set( ${output} ${results} PARENT_SCOPE )
endfunction() endfunction()
if( BUILD_GITHUB_PLUGIN ) if( BUILD_GITHUB_PLUGIN )
# (BTW "test" yields "unit_test_framework" when passed to bootstrap.{sh,bat} ). # It will probably be simpler to make this the only path in the future.
message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" )
string( REPLACE "unit_test_framework" "test" libs_csv "${BOOST_LIBS_BUILT}" )
message( STATUS "REPLACE libs_csv:${libs_csv}" )
string( REGEX REPLACE "\\;" "," libs_csv "${libs_csv}" ) # (BTW "test" yields "unit_test_framework" when passed to bootstrap.sh ).
message( STATUS "libs_csv:${libs_csv}" ) #message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" )
string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" )
#message( STATUS "REPLACE libs_csv:${boost_libs_list}" )
if( MINGW ) if( MINGW )
set( bootstrap "bootstart.bat mingw" ) if( MSYS )
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
# bootstrap.bat with cmd.exe does. It's ugly but it works. At least for Boost
# version 1.54.
set( bootstrap cmd.exe /c "bootstrap.bat mingw" )
else()
set( bootstrap ./bootstrap.bat mingw )
endif()
foreach( lib ${boost_libs_list} )
set( b2_libs ${b2_libs} --with-${lib} )
endforeach()
unset( PIC_STUFF )
else() else()
set( bootstrap bootstrap.sh ) string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
#message( STATUS "libs_csv:${libs_csv}" )
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
# pass to *both* C and C++ compilers
set( PIC_STUFF "cflags=${PIC_FLAG}" )
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
unset( b2_libs )
endif() endif()
ExternalProject_Add( boost ExternalProject_Add( boost
PREFIX "${PREFIX}" PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}" DOWNLOAD_DIR "${DOWNLOAD_DIR}"
INSTALL_DIR "${BOOST_ROOT}"
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2 URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
URL_MD5 ${BOOST_MD5} URL_MD5 ${BOOST_MD5}
...@@ -114,27 +135,55 @@ if( BUILD_GITHUB_PLUGIN ) ...@@ -114,27 +135,55 @@ if( BUILD_GITHUB_PLUGIN )
BINARY_DIR "${PREFIX}/src/boost/" BINARY_DIR "${PREFIX}/src/boost/"
CONFIGURE_COMMAND ${bootstrap} CONFIGURE_COMMAND ${bootstrap}
--with-libraries=${libs_csv}
BUILD_COMMAND b2 BUILD_COMMAND ./b2
variant=release variant=release
threading=multi threading=multi
toolset=gcc toolset=gcc
link=static ${PIC_STUFF}
--prefix=${BOOST_ROOT} ${b2_libs}
#link=static
--prefix=<INSTALL_DIR>
install install
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
file( GLOB boost_libs "${BOOST_ROOT}/lib/*" ) if( MINGW )
#message( STATUS BOOST_ROOT:${BOOST_ROOT} boost_libs:${boost_libs} ) execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" ) OUTPUT_VARIABLE GCC_VERSION
set( Boost_INCLUDE_DIR "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" ) OUTPUT_STRIP_TRAILING_WHITESPACE )
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.[0-9]+.*" "\\1\\2" BOOST_GCC_VERSION ${GCC_VERSION} )
#message( STATUS "BOOST_GCC_VERSION: ${BOOST_GCC_VERSION}" )
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9])" "\\1_\\2" BOOST_LIB_VERSION ${BOOST_RELEASE} )
#message( STATUS "BOOST_LIB_VERSION: ${BOOST_LIB_VERSION}" )
# adjust the names of the libraries to suit the build. There's no
# symbolic links provided on the MinGW build to allow us to use
# generic names for the libs
foreach( lib ${BOOST_LIBS_BUILT} )
set( mingw_boost_libs ${mingw_boost_libs} ${lib}-mgw${BOOST_GCC_VERSION}-mt-${BOOST_LIB_VERSION} )
endforeach()
set( BOOST_LIBS_BUILT ${mingw_boost_libs} )
set( BOOST_INCLUDE "${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION}" )
unset( mingw_boost_libs )
endif()
set( boost_libs "" )
set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
else( BUILD_GITHUB_PLUGIN ) set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" )
set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )
mark_as_advanced( Boost_LIBRARIES Boost_INCLUDE_DIR )
#message( STATUS "BOOST_ROOT:${BOOST_ROOT} BOOST_LIBRARIES:${BOOST_LIBRARIES}" )
#message( STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}" )
else( BUILD_GITHUB_PLUGIN )
ExternalProject_Add( boost ExternalProject_Add( boost
PREFIX "${PREFIX}" PREFIX "${PREFIX}"
......
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Download OPENSSL and install into ${PREFIX}, typically in our KiCad source tree.
# Assumes include( ExternalProject ) was done inline previous to this file
# and that set( DOWNLOAD_DIR ... ) was set in a higher context.
#-----<configure>-------------------------------------------------------------------------------------
set( OPENSSL_RELEASE "1.0.1e" )
set( OPENSSL_MD5 66bf6f10f060d561929de96f9dfe5b8c ) # re-calc on every RELEASE change
#-----</configure>-----------------------------------------------------------------------------------
unset( PIC_FLAG )
set( CFLAGS CFLAGS=${CMAKE_C_FLAGS} )
if( MINGW ) # either MINGW or cross compiling?
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set( MINGW32 true )
set( MACHINE x86_32 )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( MINGW64 true )
set( MACHINE x86_64 )
endif()
if( MINGW32 )
set( HOST "--host=i586-pc-mingw32" )
elseif( MINGW64 )
set( HOST "--host=x86_64-pc-mingw32" )
endif()
set( CC "CC=${CMAKE_C_COMPILER}" )
set( RANLIB "RANLIB=${CMAKE_RANLIB}" )
set( AR "AR=${CMAKE_AR}" )
else()
set( PIC_FLAG -fPIC )
endif()
string( TOLOWER ${CMAKE_HOST_SYSTEM_NAME} build )
# Force some configure scripts into knowing this is a cross-compilation, if it is.
set( BUILD --build=${CMAKE_HOST_SYSTEM_PROCESSOR}-pc-${build} )
# http://www.blogcompiler.com/2011/12/21/openssl-for-windows/
# http://qt-project.org/wiki/Compiling-OpenSSL-with-MinGW
set( PREFIX ${DOWNLOAD_DIR}/openssl-${OPENSSL_RELEASE} )
unset( CROSS )
if( MINGW32 )
set( MW mingw )
set( CROSS "CROSS_COMPILE=${CROSS_COMPILE}" )
elseif( MINGW64 )
set( MW mingw64 )
set( CROSS "CROSS_COMPILE=${CROSS_COMPILE}" )
endif()
ExternalProject_Add(
openssl
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${PREFIX}
TIMEOUT 60
URL http://www.openssl.org/source/openssl-${OPENSSL_RELEASE}.tar.gz
URL_MD5 ${OPENSSL_MD5}
# mingw uses msvcrt.dll's printf() which cannot handle %zd, so having
# BIO_snprintf() reference printf()'s formating attributes is a bug, since
# BIO_snprintf() does its own formatting and is different from msvcrt's printf().
# This one would be easier if Windows folks could be asked to install "patch.exe"
# PATCH_COMMAND patch -p0 < ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch
# This one requires the bzr commit below, since bzr patch only knows a working tree.
PATCH_COMMAND bzr patch -p0 ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch
# this requires that perl be installed:
CONFIGURE_COMMAND
${CROSS}
<SOURCE_DIR>/Configure
${MW}
--prefix=<INSTALL_DIR>
${PIC_FLAG} # empty for MINGW
shared
BUILD_IN_SOURCE 1
BUILD_COMMAND make depend
COMMAND make
INSTALL_COMMAND make install
)
# In order to use "bzr patch", we have to have a bzr working tree, this means a bzr repo
# must be created and source committed to it. These extra steps do that.
set( target "openssl" )
ExternalProject_Add_Step( ${target} bzr_commit_${target}
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
COMMENT "committing pristine ${target} files to '${target} scratch repo'"
DEPENDERS patch
)
ExternalProject_Add_Step( ${target} bzr_add_${target}
COMMAND bzr add -q <SOURCE_DIR>
COMMENT "adding pristine ${target} files to '${target} scratch repo'"
DEPENDERS bzr_commit_${target}
)
ExternalProject_Add_Step( ${target} bzr_init_${target}
COMMAND bzr init -q <SOURCE_DIR>
COMMENT "creating '${target} scratch repo' specifically for tracking ${target} patches"
DEPENDERS bzr_add_${target}
DEPENDEES download
)
# The spelling of these is always taken from CMake Module's FindXYZ.cmake file:
set( OPENSSL_INCLUDE_DIR
${PREFIX}/include
CACHE FILEPATH "OPENSSL include directory"
)
set( OPENSSL_LIBRARIES
${PREFIX}/lib/libssl.a
${PREFIX}/lib/libcrypto.a
CACHE STRING "OPENSSL libraries"
)
set( OPENSSL_FOUND true )
...@@ -111,11 +111,6 @@ This option is used to enable or disable building KiCad with images in menu ...@@ -111,11 +111,6 @@ This option is used to enable or disable building KiCad with images in menu
items. If this is not defined when CMake is used to create the build files, items. If this is not defined when CMake is used to create the build files,
images will be included in menu items on all platforms except OSX. images will be included in menu items on all platforms except OSX.
KICAD_GOST (ON/OFF)
-------------------
This option is used to enable or disable the GOST notation for multiple gates
per package in Eeschema. The default is OFF
KICAD_KEEPCASE (ON/OFF) KICAD_KEEPCASE (ON/OFF)
----------------------- -----------------------
This option enables or disables turning off the automatic component name This option enables or disables turning off the automatic component name
......
...@@ -73,4 +73,11 @@ Dialogs: ...@@ -73,4 +73,11 @@ Dialogs:
within the dialog, but for testing purposes please do not exceed this dialog within the dialog, but for testing purposes please do not exceed this dialog
size should the user have selected a font size of 13 points. size should the user have selected a font size of 13 points.
Quoting:
Filenames and paths should be emphasized with <> angle brackets. Anything
else should be emphasized with single quotes ''. e.g.:
<filename.kicad_pcb>
<longpath/subdir>
'FOOTPRINTNAME'
'anything else'
...@@ -128,13 +128,17 @@ project is created. ...@@ -128,13 +128,17 @@ project is created.
Installation from source code Installation from source code
----------------------------- -----------------------------
Some dependencies must be satisfied for the correct installation of KiCad: Some dependencies must be satisfied for the correct installation of KiCad:
under Linux: under Linux:
wxWidgets >= 2.8.11 http://www.wxwidgets.org/ wxWidgets >= 2.8.11 http://www.wxwidgets.org/
(needs to be compiled with unicode support)
under Windows:MacOSX under Windows:MacOSX
wxWidgets >= 2.9.3 http://www.wxwidgets.org/ wxWidgets >= 2.9.4 http://www.wxwidgets.org/
CMake >= 2.6.4 http://www.cmake.org/
Boost C++ Libraries (files used by kicad are provided in kicad sources) http://www.boost.org/ CMake >= 2.8.1 http://www.cmake.org/
Boost C++ Libraries:
files used by kicad are autmatically downloaded and patched if needed
from boost site ( http://www.boost.org/ )
OpenGL OpenGL
Linux: Mesa 3D Graphics Library http://www.mesa3d.org/ Linux: Mesa 3D Graphics Library http://www.mesa3d.org/
Windows: built-in Windows: built-in
...@@ -186,12 +190,6 @@ configured and builded with "--enable-monolithic --disable-shared" parameters. ...@@ -186,12 +190,6 @@ configured and builded with "--enable-monolithic --disable-shared" parameters.
For building dinamically linked executables. Can be used only if wxWidgets For building dinamically linked executables. Can be used only if wxWidgets
configured and builded with "--disable-monolithic --enable-shared" parameters. configured and builded with "--disable-monolithic --enable-shared" parameters.
-DwxUSE_UNICODE=ON
Require on locale utf8 for build the KiCad with cyrillic fonts support.
-DKICAD_GOST=ON
Build the KiCad with russian GOST support.
-DKICAD_KEEPCASE=ON -DKICAD_KEEPCASE=ON
Build the KiCad with no component name conversion to uppercase (if you want your Build the KiCad with no component name conversion to uppercase (if you want your
ADuC.../Si.../bq... components named as just so). ADuC.../Si.../bq... components named as just so).
......
...@@ -140,25 +140,20 @@ PCBNew ...@@ -140,25 +140,20 @@ PCBNew
various zoom factors. I believe that a fixed distance in pixels might make various zoom factors. I believe that a fixed distance in pixels might make
for a friendlier UI. for a friendlier UI.
*) Check that the new load visibility BOARD settings is properly setting the toolbar
buttons like show grid or ratsnest. Add PCB_EDIT_FRAME::SetVisibleElements() so
toolbar crap is not known to a BOARD.
*) Finish removing global access requirements from PLUGINs, so that:
*) a BOARD is a fully self contained document description.
*) plugin developers do not have to access globals, since a plugin could
very well be a dynamically loaded DLL/DSO in the future.
One final problem remains is the BASE_SCREEN's grid origin. An easy
solution is to move just that one field into the BOARD.
*) Add ::Footprint*() functions to EAGLE_PLUGIN, so that Eagle footprint libraries
can be used in situ.
*) Add a library table for Pcbnew like that in the sweet library and get rid of the
damn search path strategy. This will enable concurrent usage of various types
of PLUGIN::Footprint*() functions. At least LEGACY and KICAD are both needed
concurrently.
*) Add a hot key to toggle the 45 degree constraint on and off so that it can be *) Add a hot key to toggle the 45 degree constraint on and off so that it can be
changed when drawing a trace. changed when drawing a trace.
Dick's Final TODO List:
======================
*) Rewrite
PCB_BASE_FRAME::Save_Module_In_Library
PCB_EDIT_FRAME::ArchiveModulesOnBoard
to use FP_LIB_TABLE mechanisms.
*) write options dialog for fp table dialog.
*) Apply Fabrizio and Alexander's linux desktop patches after unifying them.
*) Get licensing cleaned up.
*) Re-arrange the repo architecture.
*) Merge KiCad GAL/TOM/ORSON if nobody else does.
*) DLL-ization of pcbnew & eeschema
http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
...@@ -126,6 +126,7 @@ set(COMMON_SRCS ...@@ -126,6 +126,7 @@ set(COMMON_SRCS
filter_reader.cpp filter_reader.cpp
gestfich.cpp gestfich.cpp
getrunningmicrosecs.cpp getrunningmicrosecs.cpp
grid_tricks.cpp
gr_basic.cpp gr_basic.cpp
hotkeys_basic.cpp hotkeys_basic.cpp
hotkey_grid_table.cpp hotkey_grid_table.cpp
...@@ -212,11 +213,15 @@ set(PCB_COMMON_SRCS ...@@ -212,11 +213,15 @@ set(PCB_COMMON_SRCS
../pcbnew/sel_layer.cpp ../pcbnew/sel_layer.cpp
../pcbnew/pcb_plot_params.cpp ../pcbnew/pcb_plot_params.cpp
../pcbnew/io_mgr.cpp ../pcbnew/io_mgr.cpp
../pcbnew/plugin.cpp
../pcbnew/eagle_plugin.cpp ../pcbnew/eagle_plugin.cpp
../pcbnew/legacy_plugin.cpp ../pcbnew/legacy_plugin.cpp
../pcbnew/kicad_plugin.cpp ../pcbnew/kicad_plugin.cpp
../pcbnew/gpcb_plugin.cpp ../pcbnew/gpcb_plugin.cpp
../pcbnew/pcb_netlist.cpp ../pcbnew/pcb_netlist.cpp
../pcbnew/specctra.cpp
../pcbnew/specctra_export.cpp
../pcbnew/specctra_keywords.cpp
pcb_plot_params_keywords.cpp pcb_plot_params_keywords.cpp
pcb_keywords.cpp pcb_keywords.cpp
../pcbnew/pcb_parser.cpp ../pcbnew/pcb_parser.cpp
...@@ -237,6 +242,17 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES ...@@ -237,6 +242,17 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
add_library(pcbcommon STATIC ${PCB_COMMON_SRCS}) add_library(pcbcommon STATIC ${PCB_COMMON_SRCS})
# auto-generate specctra_lexer.h and specctra_keywords.cpp
make_lexer(
${PROJECT_SOURCE_DIR}/pcbnew/specctra.keywords
${PROJECT_SOURCE_DIR}/pcbnew/specctra_lexer.h
${PROJECT_SOURCE_DIR}/pcbnew/specctra_keywords.cpp
DSN
# Pass header file with dependency on *_lexer.h as extra_arg
specctra.h
)
# auto-generate netlist_lexer.h and netlist_keywords.cpp # auto-generate netlist_lexer.h and netlist_keywords.cpp
make_lexer( make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/netlist.keywords ${CMAKE_CURRENT_SOURCE_DIR}/netlist.keywords
...@@ -255,7 +271,7 @@ make_lexer( ...@@ -255,7 +271,7 @@ make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp
PCBPLOTPARAMS_T PCBPLOTPARAMS_T
# Pass header file with dependency on *_lexer.h as extra_arg # Pass header file with dependencies on *_lexer.h as extra_arg
${PROJECT_SOURCE_DIR}/pcbnew/pcb_plot_params.h ${PROJECT_SOURCE_DIR}/pcbnew/pcb_plot_params.h
) )
...@@ -287,11 +303,7 @@ make_lexer( ...@@ -287,11 +303,7 @@ make_lexer(
TB_READER_T TB_READER_T
) )
# The dsntest may not build properly using MS Visual Studio. # This one gets made only when testing.
if(NOT MSVC) # to build it, first enable #define STAND_ALONE at top of dsnlexer.cpp
# This one gets made only when testing. add_executable( dsntest EXCLUDE_FROM_ALL dsnlexer.cpp )
# to build it, first enable #define STAND_ALONE at top of dsnlexer.cpp target_link_libraries( dsntest common ${wxWidgets_LIBRARIES} rt )
add_executable( dsntest EXCLUDE_FROM_ALL dsnlexer.cpp )
target_link_libraries( dsntest common ${wxWidgets_LIBRARIES} rt )
endif( NOT MSVC )
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
#include "../eeschema/dialogs/dialog_schematic_find.h" #include "../eeschema/dialogs/dialog_schematic_find.h"
const wxString traceFindReplace( wxT( "KicadFindReplace" ) );
enum textbox { enum textbox {
ID_TEXTBOX_LIST = 8010 ID_TEXTBOX_LIST = 8010
}; };
...@@ -190,8 +194,28 @@ bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText ) ...@@ -190,8 +194,28 @@ bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText )
wxCHECK_MSG( IsReplaceable(), false, wxCHECK_MSG( IsReplaceable(), false,
wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) ); wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
return aText.Replace( aSearchData.GetFindString(), wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText.Upper() : aText;
aSearchData.GetReplaceString(), false ) != 0;
int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
aSearchData.GetFindString() :
aSearchData.GetFindString().Upper() );
if( result == wxNOT_FOUND )
return false;
wxString prefix = aText.Left( result );
wxString suffix;
if( aSearchData.GetFindString().length() + result < aText.length() )
suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
GetChars( suffix ) );
aText = prefix + aSearchData.GetReplaceString() + suffix;
return true;
} }
...@@ -336,6 +360,36 @@ bool EDA_RECT::Contains( const EDA_RECT& aRect ) const ...@@ -336,6 +360,36 @@ bool EDA_RECT::Contains( const EDA_RECT& aRect ) const
} }
/* Intersects
* test for a common area between segment and rect.
* return true if at least a common point is found
*/
bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const
{
wxPoint point2, point4;
if( Contains( aPoint1 ) || Contains( aPoint2 ) )
return true;
point2.x = GetEnd().x;
point2.y = GetOrigin().y;
point4.x = GetOrigin().x;
point4.y = GetEnd().y;
//Only need to test 3 sides since a straight line cant enter and exit on same side
if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin() , point2 ) )
return true;
if( SegmentIntersectsSegment( aPoint1, aPoint2, point2 , GetEnd() ) )
return true;
if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd() , point4 ) )
return true;
return false;
}
/* Intersects /* Intersects
* test for a common area between 2 rect. * test for a common area between 2 rect.
* return true if at least a common point is found * return true if at least a common point is found
......
...@@ -46,11 +46,12 @@ ...@@ -46,11 +46,12 @@
BITMAP_BASE::BITMAP_BASE( const wxPoint& pos ) BITMAP_BASE::BITMAP_BASE( const wxPoint& pos )
{ {
m_Scale = 1.0; // 1.0 = original bitmap size m_Scale = 1.0; // 1.0 = original bitmap size
m_bitmap = NULL; m_bitmap = NULL;
m_image = NULL; m_image = NULL;
m_pixelScaleFactor = 3.33; // a value OK for bitmaps using 300 PPI m_ppi = 300; // the bitmap definition. the default is 300PPI
// (Eeschema uses currently 1000PPI m_pixelScaleFactor = 1000.0 / m_ppi; // a value OK for bitmaps using 300 PPI
// for Eeschema which uses currently 1000PPI
} }
...@@ -72,6 +73,7 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem ) ...@@ -72,6 +73,7 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem )
*m_image = *aItem->m_image; *m_image = *aItem->m_image;
*m_bitmap = *aItem->m_bitmap; *m_bitmap = *aItem->m_bitmap;
m_Scale = aItem->m_Scale; m_Scale = aItem->m_Scale;
m_ppi = aItem->m_ppi;
m_pixelScaleFactor = aItem->m_pixelScaleFactor; m_pixelScaleFactor = aItem->m_pixelScaleFactor;
} }
...@@ -121,6 +123,35 @@ bool BITMAP_BASE::SaveData( FILE* aFile ) const ...@@ -121,6 +123,35 @@ bool BITMAP_BASE::SaveData( FILE* aFile ) const
return true; return true;
} }
void BITMAP_BASE::SaveData( wxArrayString& aPngStrings ) const
{
if( m_image )
{
wxMemoryOutputStream stream;
m_image->SaveFile( stream, wxBITMAP_TYPE_PNG );
// Write binary data in hexadecimal form (ASCII)
wxStreamBuffer* buffer = stream.GetOutputStreamBuffer();
char* begin = (char*) buffer->GetBufferStart();
wxString line;
for( int ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
{
if( ii >= 32 )
{
ii = 0;
aPngStrings.Add( line );
line.Empty();
}
line << wxString::Format( wxT("%2.2X "), *begin & 0xFF );
}
// Add last line:
if( !line.IsEmpty() )
aPngStrings.Add( line );
}
}
bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg ) bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg )
{ {
...@@ -130,9 +161,13 @@ bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -130,9 +161,13 @@ bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg )
while( true ) while( true )
{ {
if( !aLine.ReadLine() ) if( !aLine.ReadLine() )
{
aErrorMsg = wxT("Unexpected end of data");
return false; return false;
}
line = aLine.Line(); line = aLine.Line();
if( strnicmp( line, "EndData", 4 ) == 0 ) if( strnicmp( line, "EndData", 4 ) == 0 )
{ {
// all the PNG date is read. // all the PNG date is read.
......
...@@ -67,6 +67,10 @@ bool GERBER_PLOTTER::StartPlot() ...@@ -67,6 +67,10 @@ bool GERBER_PLOTTER::StartPlot()
if( outputFile == NULL ) if( outputFile == NULL )
return false; return false;
/* Set coordinate format to 3.4 absolute, leading zero omitted */
fputs( "%FSLAX34Y34*%\n", outputFile );
fputs( "G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*\n", outputFile );
wxString Title = creator + wxT( " " ) + GetBuildVersion(); wxString Title = creator + wxT( " " ) + GetBuildVersion();
fprintf( outputFile, "G04 (created by %s) date %s*\n", fprintf( outputFile, "G04 (created by %s) date %s*\n",
TO_UTF8( Title ), TO_UTF8( DateAndTime() ) ); TO_UTF8( Title ), TO_UTF8( DateAndTime() ) );
...@@ -74,10 +78,6 @@ bool GERBER_PLOTTER::StartPlot() ...@@ -74,10 +78,6 @@ bool GERBER_PLOTTER::StartPlot()
/* Mass parameter: unit = INCHES */ /* Mass parameter: unit = INCHES */
fputs( "%MOIN*%\n", outputFile ); fputs( "%MOIN*%\n", outputFile );
/* Set coordinate format to 3.4 absolute, leading zero omitted */
fputs( "G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*\n%FSLAX34Y34*%\n",
outputFile );
/* Specify linear interpol (G01), unit = INCH (G70), abs format (G90) */ /* Specify linear interpol (G01), unit = INCH (G70), abs format (G90) */
fputs( "G01*\nG70*\nG90*\n", outputFile ); fputs( "G01*\nG70*\nG90*\n", outputFile );
fputs( "G04 APERTURE LIST*\n", outputFile ); fputs( "G04 APERTURE LIST*\n", outputFile );
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <drawtxt.h> #include <drawtxt.h>
#include <class_title_block.h> #include <class_title_block.h>
#include "worksheet_shape_builder.h" #include "worksheet_shape_builder.h"
#include "class_worksheet_dataitem.h"
#include <wx/filename.h> #include <wx/filename.h>
...@@ -137,6 +138,20 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, ...@@ -137,6 +138,20 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
poly->IsFilled() ? FILLED_SHAPE : NO_FILL ); poly->IsFilled() ? FILLED_SHAPE : NO_FILL );
} }
break; break;
case WS_DRAW_ITEM_BASE::wsg_bitmap:
{
WS_DRAW_ITEM_BITMAP* bm = (WS_DRAW_ITEM_BITMAP*) item;
WORKSHEET_DATAITEM_BITMAP* parent = (WORKSHEET_DATAITEM_BITMAP*)bm->GetParent();
if( parent->m_ImageBitmap == NULL )
break;
parent->m_ImageBitmap->PlotImage( plotter, bm->GetPosition(),
plotColor, PLOTTER::DEFAULT_LINE_WIDTH );
}
break;
} }
} }
} }
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file confirm.cpp * @file confirm.cpp
* @brief utilities to display some error, warning and info short messges * @brief utilities to display some error, warning and info short messges
...@@ -7,6 +31,7 @@ ...@@ -7,6 +31,7 @@
#include <common.h> #include <common.h>
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/html/htmlwin.h> #include <wx/html/htmlwin.h>
#include <wx/stockitem.h>
#include <html_messagebox.h> #include <html_messagebox.h>
#include <dialog_exit_base.h> #include <dialog_exit_base.h>
#include <bitmaps.h> #include <bitmaps.h>
...@@ -14,22 +39,25 @@ ...@@ -14,22 +39,25 @@
class DIALOG_EXIT: public DIALOG_EXIT_BASE class DIALOG_EXIT: public DIALOG_EXIT_BASE
{ {
public: public:
DIALOG_EXIT( wxWindow * parent, const wxString& aMessage ) : DIALOG_EXIT( wxWindow *aParent, const wxString& aMessage ) :
DIALOG_EXIT_BASE( parent ) DIALOG_EXIT_BASE( aParent )
{ {
m_bitmap->SetBitmap( KiBitmap( dialog_warning_xpm ) ); m_bitmap->SetBitmap( KiBitmap( dialog_warning_xpm ) );
if( ! aMessage.IsEmpty() )
if( !aMessage.IsEmpty() )
m_TextInfo->SetLabel( aMessage ); m_TextInfo->SetLabel( aMessage );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
}; };
private: private:
void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_OK ); } void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_YES ); }
void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); }
void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); } void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); }
}; };
int DisplayExitDialog( wxWindow* parent, const wxString& aMessage ) int DisplayExitDialog( wxWindow* parent, const wxString& aMessage )
{ {
DIALOG_EXIT dlg( parent, aMessage ); DIALOG_EXIT dlg( parent, aMessage );
...@@ -38,6 +66,7 @@ int DisplayExitDialog( wxWindow* parent, const wxString& aMessage ) ...@@ -38,6 +66,7 @@ int DisplayExitDialog( wxWindow* parent, const wxString& aMessage )
return ret; return ret;
} }
void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
{ {
wxMessageDialog* dialog; wxMessageDialog* dialog;
...@@ -76,14 +105,52 @@ void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title, ...@@ -76,14 +105,52 @@ void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
} }
bool IsOK( wxWindow* parent, const wxString& text ) bool IsOK( wxWindow* aParent, const wxString& aMessage )
{
wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
wxYES_NO | wxCENTRE | wxICON_HAND );
return dlg.ShowModal() == wxID_YES;
}
class DIALOG_YES_NO_CANCEL : public DIALOG_EXIT
{ {
int ii; public:
DIALOG_YES_NO_CANCEL( wxWindow *aParent,
const wxString& aPrimaryMessage,
const wxString& aSecondaryMessage = wxEmptyString,
const wxString& aYesButtonText = wxEmptyString,
const wxString& aNoButtonText = wxEmptyString,
const wxString& aCancelButtonText = wxEmptyString ) :
DIALOG_EXIT( aParent, aSecondaryMessage )
{
m_TextInfo->SetLabel( aPrimaryMessage );
if( aSecondaryMessage.IsEmpty() )
m_staticText2->Hide();
m_buttonSaveAndExit->SetLabel( aYesButtonText.IsEmpty() ? wxGetStockLabel( wxID_YES ) :
aYesButtonText );
m_buttonExitNoSave->SetLabel( aNoButtonText.IsEmpty() ? wxGetStockLabel( wxID_NO ) :
aNoButtonText );
m_buttonCancel->SetLabel( aCancelButtonText.IsEmpty() ? wxGetStockLabel( wxID_CANCEL ) :
aCancelButtonText );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
};
};
ii = wxMessageBox( text, _( "Confirmation" ), wxYES_NO | wxCENTRE | wxICON_HAND, parent );
if( ii == wxYES ) int YesNoCancelDialog( wxWindow* aParent,
return true; const wxString& aPrimaryMessage,
const wxString& aSecondaryMessage,
const wxString& aYesButtonText,
const wxString& aNoButtonText,
const wxString& aCancelButtonText )
{
DIALOG_YES_NO_CANCEL dlg( aParent, aPrimaryMessage, aSecondaryMessage,
aYesButtonText, aNoButtonText, aCancelButtonText );
return false; return dlg.ShowModal();
} }
...@@ -54,7 +54,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, ...@@ -54,7 +54,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent,
m_hotkeys = hotkeys; m_hotkeys = hotkeys;
m_curEditingRow = -1; m_curEditingRow = -1;
m_table = new HotkeyGridTable( hotkeys ); m_table = new HOTKEY_EDITOR_GRID_TABLE( hotkeys );
m_hotkeyGrid->SetTable( m_table, true ); m_hotkeyGrid->SetTable( m_table, true );
m_hotkeyGrid->AutoSizeColumn( 0 ); m_hotkeyGrid->AutoSizeColumn( 0 );
...@@ -76,7 +76,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, ...@@ -76,7 +76,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent,
void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
{ {
/* edit the live hotkey table */ /* edit the live hotkey table */
HotkeyGridTable::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys(); HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys();
EDA_HOTKEY_CONFIG* section; EDA_HOTKEY_CONFIG* section;
...@@ -91,7 +91,7 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) ...@@ -91,7 +91,7 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
EDA_HOTKEY* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
/* find the corresponding hotkey */ /* find the corresponding hotkey */
HotkeyGridTable::hotkey_spec_vector::iterator i; HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector::iterator i;
for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i ) for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i )
{ {
...@@ -158,7 +158,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) ...@@ -158,7 +158,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
int newRow = event.GetRow(); int newRow = event.GetRow();
if( ( event.GetCol() != 1 ) || ( m_table->isHeader( newRow ) ) ) if( ( event.GetCol() != 1 ) || ( m_table->IsHeader( newRow ) ) )
{ {
m_curEditingRow = -1; m_curEditingRow = -1;
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -55,8 +55,10 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind ...@@ -55,8 +55,10 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
m_undoButton = new wxButton( this, wxID_CANCEL, _("Undo"), wxDefaultPosition, wxDefaultSize, 0 ); m_undoButton = new wxButton( this, wxID_CANCEL, _("Undo"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 ); b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_hotkeys_editor_base__ #ifndef __DIALOG_HOTKEYS_EDITOR_BASE_H__
#define __dialog_hotkeys_editor_base__ #define __DIALOG_HOTKEYS_EDITOR_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/string.h> #include <wx/string.h>
...@@ -26,7 +30,7 @@ ...@@ -26,7 +30,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class HOTKEYS_EDITOR_DIALOG_BASE /// Class HOTKEYS_EDITOR_DIALOG_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class HOTKEYS_EDITOR_DIALOG_BASE : public wxDialog class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
{ {
private: private:
...@@ -47,9 +51,9 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public wxDialog ...@@ -47,9 +51,9 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public wxDialog
public: public:
HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 304,235 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 304,235 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~HOTKEYS_EDITOR_DIALOG_BASE(); ~HOTKEYS_EDITOR_DIALOG_BASE();
}; };
#endif //__dialog_hotkeys_editor_base__ #endif //__DIALOG_HOTKEYS_EDITOR_BASE_H__
...@@ -258,12 +258,15 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event ) ...@@ -258,12 +258,15 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{ {
m_orientationComboBox->Enable( true ); m_orientationComboBox->Enable( true );
if( paperType.Contains( wxT( "A4" ) ) && IsGOST() ) #if 0
// ForcePortrait() does not exist, but could be useful.
// so I leave these lines, which could be seen as a todo feature
if( paperType.ForcePortrait() )
{ {
m_orientationComboBox->SetStringSelection( _( "Portrait" ) ); m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
m_orientationComboBox->Enable( false ); m_orientationComboBox->Enable( false );
} }
#endif
m_TextUserSizeX->Enable( false ); m_TextUserSizeX->Enable( false );
m_TextUserSizeY->Enable( false ); m_TextUserSizeY->Enable( false );
m_customFmt = false; m_customFmt = false;
......
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
#include <trigo.h> // RotatePoint #include <trigo.h> // RotatePoint
#include <class_drawpanel.h> // EDA_DRAW_PANEL #include <class_drawpanel.h> // EDA_DRAW_PANEL
// until bzr rev 4410, 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. // Conversion to application internal units defined at build time.
#if defined( PCBNEW ) #if defined( PCBNEW )
...@@ -90,6 +97,16 @@ int EDA_TEXT::LenSize( const wxString& aLine ) const ...@@ -90,6 +97,16 @@ int EDA_TEXT::LenSize( const wxString& aLine ) const
return ReturnGraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold ); return ReturnGraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold );
} }
/**
* Function GetInterline
* return the distance between 2 text lines
* has meaning only for multiline texts
*/
int EDA_TEXT::GetInterline( int aTextThickness ) const
{
int thickness = aTextThickness <= 0 ? m_Thickness : aTextThickness;
return (( m_Size.y * 14 ) / 10) + thickness;
}
EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
{ {
...@@ -98,6 +115,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const ...@@ -98,6 +115,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
wxArrayString* list = NULL; wxArrayString* list = NULL;
wxString text = m_Text; wxString text = m_Text;
int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness; int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness;
int linecount = 1;
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
...@@ -109,12 +127,14 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const ...@@ -109,12 +127,14 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
text = list->Item( aLine ); text = list->Item( aLine );
else else
text = list->Item( 0 ); text = list->Item( 0 );
linecount = list->GetCount();
} }
} }
// calculate the H and V size // calculate the H and V size
int dx = LenSize( text ); int dx = LenSize( text );
int dy = GetInterline(); int dy = GetInterline( aThickness );
/* Creates bounding box (rectangle) for an horizontal text */ /* Creates bounding box (rectangle) for an horizontal text */
wxSize textsize = wxSize( dx, dy ); wxSize textsize = wxSize( dx, dy );
...@@ -175,7 +195,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const ...@@ -175,7 +195,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
break; break;
case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER:
rect.SetY( rect.GetY() - (dy / 2) ); rect.SetY( rect.GetY() - ( dy / 2) );
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
...@@ -183,6 +203,30 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const ...@@ -183,6 +203,30 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
break; break;
} }
if( linecount > 1 )
{
#ifdef FIX_MULTILINE_VERT_JUSTIF
int yoffset;
linecount -= 1;
switch( m_VJustify )
{
case GR_TEXT_VJUSTIFY_TOP:
break;
case GR_TEXT_VJUSTIFY_CENTER:
yoffset = linecount * GetInterline() / 2;
rect.SetY( rect.GetY() - yoffset );
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
yoffset = linecount * GetInterline( aThickness );
rect.SetY( rect.GetY() - yoffset );
break;
}
#endif
}
rect.Inflate( thickness / 2 ); rect.Inflate( thickness / 2 );
rect.Normalize(); // Make h and v sizes always >= 0 rect.Normalize(); // Make h and v sizes always >= 0
...@@ -227,15 +271,31 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, ...@@ -227,15 +271,31 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
offset.y = GetInterline(); offset.y = GetInterline();
#ifdef FIX_MULTILINE_VERT_JUSTIF
if( list->Count() > 1 )
{
switch( m_VJustify )
{
case GR_TEXT_VJUSTIFY_TOP:
break;
case GR_TEXT_VJUSTIFY_CENTER:
pos.y -= ( list->Count() - 1 ) * offset.y / 2;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
pos.y -= ( list->Count() - 1 ) * offset.y;
break;
}
}
#endif
RotatePoint( &offset, m_Orient ); RotatePoint( &offset, m_Orient );
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
drawOneLineOfText( aClipBox, aDC, aOffset, aColor, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, aDrawMode, aFillMode, txt, pos );
i ? UNSPECIFIED_COLOR : aAnchor_color,
txt, pos );
pos += offset; pos += offset;
} }
...@@ -243,15 +303,21 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, ...@@ -243,15 +303,21 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
} }
else else
drawOneLineOfText( aClipBox, aDC, aOffset, aColor, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, aDrawMode, aFillMode, m_Text, m_Pos );
aAnchor_color, m_Text, m_Pos );
// Draw text anchor, if requested
if( aAnchor_color != UNSPECIFIED_COLOR )
{
GRDrawAnchor( aClipBox, aDC,
m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
DIM_ANCRE_TEXTE, aAnchor_color );
}
} }
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC, void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, EDA_COLOR_T aColor, const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
EDA_COLOR_T aAnchor_color,
wxString& aText, wxPoint aPos ) wxString& aText, wxPoint aPos )
{ {
int width = m_Thickness; int width = m_Thickness;
...@@ -262,14 +328,6 @@ void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC, ...@@ -262,14 +328,6 @@ void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
if( aDrawMode != UNSPECIFIED_DRAWMODE ) if( aDrawMode != UNSPECIFIED_DRAWMODE )
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
// Draw text anchor, if requested
if( aAnchor_color != UNSPECIFIED_COLOR )
{
GRDrawAnchor( aClipBox, aDC,
aPos.x + aOffset.x, aPos.y + aOffset.y,
DIM_ANCRE_TEXTE, aAnchor_color );
}
if( aFillMode == SKETCH ) if( aFillMode == SKETCH )
width = -width; width = -width;
......
...@@ -43,9 +43,12 @@ ...@@ -43,9 +43,12 @@
#include <class_module.h> #include <class_module.h>
#if !defined( USE_FP_LIB_TABLE )
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintLibNames )
{ {
bool retv = true;
// Clear data before reading files // Clear data before reading files
m_filesNotFound.Empty(); m_filesNotFound.Empty();
m_filesInvalid.Empty(); m_filesInvalid.Empty();
...@@ -56,10 +59,10 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) ...@@ -56,10 +59,10 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
// Parse Libraries Listed // Parse Libraries Listed
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ ) for( unsigned ii = 0; ii < aFootprintLibNames.GetCount(); ii++ )
{ {
// Footprint library file names can be fully qualified or file name only. // Footprint library file names can be fully qualified or file name only.
wxFileName filename = aFootprintsLibNames[ii]; wxFileName filename = aFootprintLibNames[ii];
if( !filename.FileExists() ) if( !filename.FileExists() )
{ {
...@@ -67,19 +70,20 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) ...@@ -67,19 +70,20 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
if( !filename.FileExists() ) if( !filename.FileExists() )
{ {
filename = wxFileName( wxEmptyString, aFootprintsLibNames[ii], filename = wxFileName( wxEmptyString, aFootprintLibNames[ii],
LegacyFootprintLibPathExtension ); LegacyFootprintLibPathExtension );
filename = wxGetApp().FindLibraryPath( filename.GetFullName() ); filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
} }
} }
wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintsLibNames[ii] ), wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintLibNames[ii] ),
GetChars( filename.GetFullPath() ) ); GetChars( filename.GetFullPath() ) );
if( !filename.FileExists() ) if( !filename.IsOk() || !filename.FileExists() )
{ {
m_filesNotFound << aFootprintsLibNames[ii] << wxT( "\n" ); m_filesNotFound << aFootprintLibNames[ii] << wxT( "\n" );
retv = false;
continue; continue;
} }
...@@ -110,6 +114,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) ...@@ -110,6 +114,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
m_filesInvalid << ioe.errorText << wxT( "\n" ); m_filesInvalid << ioe.errorText << wxT( "\n" );
retv = false;
} }
} }
} }
...@@ -124,45 +129,49 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) ...@@ -124,45 +129,49 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
m_List.sort(); m_List.sort();
return true; return retv;
} }
#else
bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable ) bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname )
{ {
bool retv = true;
// Clear data before reading files // Clear data before reading files
m_filesNotFound.Empty(); m_filesNotFound.Empty();
m_filesInvalid.Empty(); m_filesInvalid.Empty();
m_List.clear(); m_List.clear();
std::vector< wxString > libNickNames = aTable.GetLogicalLibs(); std::vector< wxString > nicknames;
// Parse Libraries Listed if( !aNickname )
for( unsigned ii = 0; ii < libNickNames.size(); ii++ ) // do all of them
nicknames = aTable->GetLogicalLibs();
else
nicknames.push_back( *aNickname );
for( unsigned ii = 0; ii < nicknames.size(); ii++ )
{ {
const FP_LIB_TABLE::ROW* row = aTable.FindRow( libNickNames[ii] ); const wxString& nickname = nicknames[ii];
wxCHECK2_MSG( row != NULL, continue,
wxString::Format( wxT( "No library name <%s> found in footprint library "
"table." ), GetChars( libNickNames[ii] ) ) );
try try
{ {
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::EnumFromStr( row->GetType() ) ) ); wxArrayString fpnames = aTable->FootprintEnumerate( nickname );
wxString path = FP_LIB_TABLE::ExpandSubstitutions( row->GetFullURI() );
wxArrayString fpnames = pi->FootprintEnumerate( path );
for( unsigned i=0; i<fpnames.GetCount(); ++i ) for( unsigned i=0; i<fpnames.GetCount(); ++i )
{ {
std::auto_ptr<MODULE> m( pi->FootprintLoad( path, fpnames[i] ) ); std::auto_ptr<MODULE> m( aTable->FootprintLoad( nickname, fpnames[i] ) );
// we're loading what we enumerated, all must be there. // we're loading what we enumerated, all must be there.
wxASSERT( m.get() ); wxASSERT( m.get() );
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO(); FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
fpinfo->SetLibraryName( libNickNames[ii] ); fpinfo->SetLibraryName( nickname );
fpinfo->SetLibraryPath( path );
//fpinfo->SetLibraryPath( path );
fpinfo->m_Module = fpnames[i]; fpinfo->m_Module = fpnames[i];
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH ); fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords(); fpinfo->m_KeyWord = m->GetKeywords();
...@@ -174,16 +183,18 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable ) ...@@ -174,16 +183,18 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
m_filesInvalid << ioe.errorText << wxT( "\n" ); m_filesInvalid << ioe.errorText << wxT( "\n" );
retv = false;
} }
} }
m_List.sort(); m_List.sort();
return true; return retv;
} }
#endif // USE_FP_LIB_TABLE
FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString & aFootprintName ) FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
{ {
BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_List ) BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_List )
{ {
......
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <grid_tricks.h>
#include <wx/tokenzr.h>
#include <wx/arrstr.h>
#include <wx/clipbrd.h>
// It works for table data on clipboard for an Excell spreadsheet,
// why not us too for now.
#define COL_SEP wxT( '\t' )
#define ROW_SEP wxT( '\n' )
enum
{
MYID_FIRST = -1,
MYID_CUT,
MYID_COPY,
MYID_PASTE,
MYID_SELECT,
MYID_LAST,
};
GRID_TRICKS::GRID_TRICKS( wxGrid* aGrid ):
m_grid( aGrid )
{
aGrid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GRID_TRICKS::onGridCellRightClick ), NULL, this );
aGrid->Connect( MYID_FIRST, MYID_LAST, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GRID_TRICKS::onPopupSelection ), NULL, this );
aGrid->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( GRID_TRICKS::onKeyDown ), NULL, this );
aGrid->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( GRID_TRICKS::onRightDown ), NULL, this );
}
void GRID_TRICKS::getSelectedArea()
{
wxGridCellCoordsArray topLeft = m_grid->GetSelectionBlockTopLeft();
wxGridCellCoordsArray botRight = m_grid->GetSelectionBlockBottomRight();
wxArrayInt cols = m_grid->GetSelectedCols();
wxArrayInt rows = m_grid->GetSelectedRows();
DBG(printf("topLeft.Count():%zd botRight:Count():%zd\n", topLeft.Count(), botRight.Count() );)
if( topLeft.Count() && botRight.Count() )
{
m_sel_row_start = topLeft[0].GetRow();
m_sel_col_start = topLeft[0].GetCol();
m_sel_row_count = botRight[0].GetRow() - m_sel_row_start + 1;
m_sel_col_count = botRight[0].GetCol() - m_sel_col_start + 1;
}
else if( cols.Count() )
{
m_sel_col_start = cols[0];
m_sel_col_count = cols.Count();
m_sel_row_start = 0;
m_sel_row_count = m_grid->GetNumberRows();
}
else if( rows.Count() )
{
m_sel_col_start = 0;
m_sel_col_count = m_grid->GetNumberCols();
m_sel_row_start = rows[0];
m_sel_row_count = rows.Count();
}
else
{
m_sel_row_start = -1;
m_sel_col_start = -1;
m_sel_row_count = 0;
m_sel_col_count = 0;
}
//DBG(printf("m_sel_row_start:%d m_sel_col_start:%d m_sel_row_count:%d m_sel_col_count:%d\n", m_sel_row_start, m_sel_col_start, m_sel_row_count, m_sel_col_count );)
}
void GRID_TRICKS::showPopupMenu()
{
wxMenu menu;
menu.Append( MYID_CUT, _( "Cut\tCTRL+X" ), _( "Clear selected cells pasting original contents to clipboard" ) );
menu.Append( MYID_COPY, _( "Copy\tCTRL+C" ), _( "Copy selected cells to clipboard" ) );
menu.Append( MYID_PASTE, _( "Paste\tCTRL+V" ), _( "Paste clipboard cells to matrix at current cell" ) );
menu.Append( MYID_SELECT, _( "Select All\tCTRL+A" ), _( "Select all cells" ) );
getSelectedArea();
// if nothing is selected, disable cut and copy.
if( !m_sel_row_count && !m_sel_col_count )
{
menu.Enable( MYID_CUT, false );
menu.Enable( MYID_COPY, false );
}
bool have_cb_text = false;
if( wxTheClipboard->Open() )
{
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
have_cb_text = true;
wxTheClipboard->Close();
}
if( !have_cb_text )
{
// if nothing on clipboard, disable paste.
menu.Enable( MYID_PASTE, false );
}
m_grid->PopupMenu( &menu );
}
void GRID_TRICKS::onPopupSelection( wxCommandEvent& event )
{
int menu_id = event.GetId();
// assume getSelectedArea() was called by rightClickPopupMenu() and there's
// no way to have gotten here without that having been called.
switch( menu_id )
{
case MYID_CUT:
case MYID_COPY:
cutcopy( menu_id == MYID_CUT );
break;
case MYID_PASTE:
paste_clipboard();
break;
case MYID_SELECT:
m_grid->SelectAll();
break;
default:
;
}
}
void GRID_TRICKS::onKeyDown( wxKeyEvent& ev )
{
if( isCtl( 'A', ev ) )
{
m_grid->SelectAll();
}
else if( isCtl( 'C', ev ) )
{
getSelectedArea();
cutcopy( false );
}
else if( isCtl( 'V', ev ) )
{
getSelectedArea();
paste_clipboard();
}
else if( isCtl( 'X', ev ) )
{
getSelectedArea();
cutcopy( true );
}
else
ev.Skip();
}
void GRID_TRICKS::paste_clipboard()
{
if( wxTheClipboard->Open() )
{
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
{
wxTextDataObject data;
wxTheClipboard->GetData( data );
wxString cb_text = data.GetText();
paste_text( cb_text );
}
wxTheClipboard->Close();
m_grid->ForceRefresh();
}
}
void GRID_TRICKS::paste_text( const wxString& cb_text )
{
wxGridTableBase* tbl = m_grid->GetTable();
const int cur_row = std::max( getCursorRow(), 0 ); // no -1
const int cur_col = std::max( getCursorCol(), 0 );
wxStringTokenizer rows( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY );
// if clipboard rows would extend past end of current table size...
if( int( rows.CountTokens() ) > tbl->GetNumberRows() - cur_row )
{
int newRowsNeeded = rows.CountTokens() - ( tbl->GetNumberRows() - cur_row );
tbl->AppendRows( newRowsNeeded );
}
for( int row = cur_row; rows.HasMoreTokens(); ++row )
{
wxString rowTxt = rows.GetNextToken();
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
for( int col = cur_col; cols.HasMoreTokens(); ++col )
{
wxString cellTxt = cols.GetNextToken();
tbl->SetValue( row, col, cellTxt );
}
}
m_grid->AutoSizeColumns( false );
}
void GRID_TRICKS::cutcopy( bool doCut )
{
if( wxTheClipboard->Open() )
{
wxGridTableBase* tbl = m_grid->GetTable();
wxString txt;
// fill txt with a format that is compatible with most spreadsheets
for( int row = m_sel_row_start; row < m_sel_row_start + m_sel_row_count; ++row )
{
for( int col = m_sel_col_start; col < m_sel_col_start + m_sel_col_count; ++col )
{
txt += tbl->GetValue( row, col );
if( col < m_sel_col_start + m_sel_col_count - 1 ) // that was not last column
txt += COL_SEP;
if( doCut )
tbl->SetValue( row, col, wxEmptyString );
}
txt += ROW_SEP;
}
wxTheClipboard->SetData( new wxTextDataObject( txt ) );
wxTheClipboard->Close();
if( doCut )
{
m_grid->AutoSizeColumns( false );
m_grid->ForceRefresh();
}
}
}
...@@ -4,174 +4,179 @@ ...@@ -4,174 +4,179 @@
* Reads the hotkey table from its stored format into a format suitable * Reads the hotkey table from its stored format into a format suitable
* for a wxGrid. * for a wxGrid.
*/ */
HotkeyGridTable::HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin ) : HOTKEY_EDITOR_GRID_TABLE::HOTKEY_EDITOR_GRID_TABLE( struct EDA_HOTKEY_CONFIG* origin ) :
wxGridTableBase(), wxGridTableBase(), m_hotkeys()
m_hotkeys()
{ {
EDA_HOTKEY_CONFIG* section; EDA_HOTKEY_CONFIG* section;
for( section = origin; section->m_HK_InfoList; section++ ) for( section = origin; section->m_HK_InfoList; section++ )
{ {
hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( NULL, 0, 0 ) ); // Add a dummy hotkey_spec which is a header before each hotkey list
hotkey_spec spec( *section->m_SectionTag, NULL );
m_hotkeys.push_back( spec ); m_hotkeys.push_back( spec );
EDA_HOTKEY** info_ptr; EDA_HOTKEY** hotkey_descr_list;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) // Add hotkeys descr
for( hotkey_descr_list = section->m_HK_InfoList; *hotkey_descr_list;
hotkey_descr_list++ )
{ {
EDA_HOTKEY* info = *info_ptr; EDA_HOTKEY* hotkey_descr = *hotkey_descr_list;
hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( info ) ); hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( hotkey_descr ) );
m_hotkeys.push_back( spec ); m_hotkeys.push_back( spec );
} }
} }
} }
HotkeyGridTable::hotkey_spec_vector& HotkeyGridTable::getHotkeys() HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector& HOTKEY_EDITOR_GRID_TABLE::getHotkeys()
{ {
return m_hotkeys; return m_hotkeys;
} }
int HotkeyGridTable::GetNumberRows() int HOTKEY_EDITOR_GRID_TABLE::GetNumberRows()
{ {
return m_hotkeys.size(); return m_hotkeys.size();
} }
int HotkeyGridTable::GetNumberCols() int HOTKEY_EDITOR_GRID_TABLE::GetNumberCols()
{ {
return 2; return 2;
} }
bool HotkeyGridTable::IsEmptyCell( int row, int col ) bool HOTKEY_EDITOR_GRID_TABLE::IsEmptyCell( int row, int col )
{ {
return col == 1 && m_hotkeys[row].second == 0; return col == 1 && m_hotkeys[row].second == NULL;
} }
wxString HotkeyGridTable::GetValue( int row, int col ) wxString HOTKEY_EDITOR_GRID_TABLE::GetValue( int row, int col )
{ {
EDA_HOTKEY* hotkey_descr = m_hotkeys[row].second;
if( col == 0 ) if( col == 0 )
{ {
if( m_hotkeys[row].second == 0 ) if( hotkey_descr == NULL )
{ {
// section header // section header
return m_hotkeys[row].first; return m_hotkeys[row].first;
} }
else else
{ {
return m_hotkeys[row].second->m_InfoMsg; return hotkey_descr->m_InfoMsg;
} }
} }
else else
{ {
if( m_hotkeys[row].second == 0 ) if( hotkey_descr == NULL )
{ {
return wxString(); // section header
return wxEmptyString;
} }
else else
{ {
return ReturnKeyNameFromKeyCode( m_hotkeys[row].second->m_KeyCode ); return ReturnKeyNameFromKeyCode( hotkey_descr->m_KeyCode );
} }
} }
} }
void HotkeyGridTable::SetValue( int row, int col, const wxString& value ) void HOTKEY_EDITOR_GRID_TABLE::SetValue( int row, int col, const wxString& value )
{ {
} }
wxString HotkeyGridTable::GetTypeName( int row, int col ) wxString HOTKEY_EDITOR_GRID_TABLE::GetTypeName( int row, int col )
{ {
return wxGRID_VALUE_STRING; return wxGRID_VALUE_STRING;
} }
bool HotkeyGridTable::CanGetValueAs( int row, int col, const wxString& typeName ) bool HOTKEY_EDITOR_GRID_TABLE::CanGetValueAs( int row, int col, const wxString& typeName )
{ {
return typeName == wxGRID_VALUE_STRING && col == 2; return typeName == wxGRID_VALUE_STRING && col == 2;
} }
bool HotkeyGridTable::CanSetValueAs( int row, int col, const wxString& typeName ) bool HOTKEY_EDITOR_GRID_TABLE::CanSetValueAs( int row, int col, const wxString& typeName )
{ {
return false; return false;
} }
long HotkeyGridTable::GetValueAsLong( int row, int col ) long HOTKEY_EDITOR_GRID_TABLE::GetValueAsLong( int row, int col )
{ {
return -1L; return -1L;
} }
double HotkeyGridTable::GetValueAsDouble( int row, int col ) double HOTKEY_EDITOR_GRID_TABLE::GetValueAsDouble( int row, int col )
{ {
return 0.0; return 0.0;
} }
bool HotkeyGridTable::GetValueAsBool( int row, int col ) bool HOTKEY_EDITOR_GRID_TABLE::GetValueAsBool( int row, int col )
{ {
return false; return false;
} }
void HotkeyGridTable::SetValueAsLong( int row, int col, long value ) void HOTKEY_EDITOR_GRID_TABLE::SetValueAsLong( int row, int col, long value )
{ {
} }
void HotkeyGridTable::SetValueAsDouble( int row, int col, double value ) void HOTKEY_EDITOR_GRID_TABLE::SetValueAsDouble( int row, int col, double value )
{ {
} }
void HotkeyGridTable::SetValueAsBool( int row, int col, bool value ) void HOTKEY_EDITOR_GRID_TABLE::SetValueAsBool( int row, int col, bool value )
{ {
} }
void* HotkeyGridTable::GetValueAsCustom( int row, int col ) void* HOTKEY_EDITOR_GRID_TABLE::GetValueAsCustom( int row, int col )
{ {
return 0; return 0;
} }
void HotkeyGridTable::SetValueAsCustom( int row, int col, void* value ) void HOTKEY_EDITOR_GRID_TABLE::SetValueAsCustom( int row, int col, void* value )
{ {
} }
wxString HotkeyGridTable::GetColLabelValue( int col ) wxString HOTKEY_EDITOR_GRID_TABLE::GetColLabelValue( int col )
{ {
return col == 0 ? _( "Command" ) : _( "Hotkey" ); return col == 0 ? _( "Command" ) : _( "Hotkey" );
} }
bool HotkeyGridTable::isHeader( int row ) bool HOTKEY_EDITOR_GRID_TABLE::IsHeader( int row )
{ {
return m_hotkeys[row].second == 0; return m_hotkeys[row].second == NULL;
} }
void HotkeyGridTable::SetKeyCode( int row, long key ) void HOTKEY_EDITOR_GRID_TABLE::SetKeyCode( int row, long key )
{ {
m_hotkeys[row].second->m_KeyCode = key; m_hotkeys[row].second->m_KeyCode = key;
} }
void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin ) void HOTKEY_EDITOR_GRID_TABLE::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin )
{ {
int row = 0; int row = 0;
EDA_HOTKEY_CONFIG* section; EDA_HOTKEY_CONFIG* section;
for( section = origin; section->m_HK_InfoList; section++ ) for( section = origin; section->m_HK_InfoList; section++ )
{ {
++row; ++row; // Skip header
EDA_HOTKEY** info_ptr; EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
...@@ -183,15 +188,10 @@ void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin ) ...@@ -183,15 +188,10 @@ void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin )
} }
HotkeyGridTable::~HotkeyGridTable() HOTKEY_EDITOR_GRID_TABLE::~HOTKEY_EDITOR_GRID_TABLE()
{ {
hotkey_spec_vector::iterator i; hotkey_spec_vector::iterator i;
for( i = m_hotkeys.begin(); i != m_hotkeys.end(); ++i ) for( i = m_hotkeys.begin(); i != m_hotkeys.end(); ++i )
{ delete i->second;
if( i->second )
{
delete i->second;
}
}
} }
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, j-p.charras at wanadoo.fr
* Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -212,17 +212,12 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) ...@@ -212,17 +212,12 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
*/ */
static void AddModifierToKey( wxString& aFullKey, const wxString & aKey ) static void AddModifierToKey( wxString& aFullKey, const wxString & aKey )
{ {
#if 0 // set to 0 for new behavior, 1 for old
aFullKey << wxT( " <" ) << aKey << wxT( ">" );
#else
if( (aKey.Length() == 1) && (aKey[0] >= 'A') && (aKey[0] <= 'Z')) if( (aKey.Length() == 1) && (aKey[0] >= 'A') && (aKey[0] <= 'Z'))
// We can use Shift+<key> as accelerator ans <key> for hot key // We can use Shift+<key> as accelerator and <key> for hot key
aFullKey << wxT( "\t" ) << MODIFIER_SHIFT << aKey; aFullKey << wxT( "\t" ) << MODIFIER_SHIFT << aKey;
else else
// We must use Alt+<key> as accelerator ans <key> for hot key // We must use Alt+<key> as accelerator ans <key> for hot key
aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey; aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey;
#endif
} }
/* AddHotkeyName /* AddHotkeyName
...@@ -430,6 +425,10 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescL ...@@ -430,6 +425,10 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescL
if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) ) if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) )
{ {
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode ); keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
// Some chars should be modified, using html encoding, to be
// displayed by DisplayHtmlInfoMessage()
keyname.Replace( wxT("<"), wxT("&lt;") );
keyname.Replace( wxT(">"), wxT("&gt;") );
msg += wxT( "<tr><td>" ) + hk_decr->m_InfoMsg + wxT("</td>"); msg += wxT( "<tr><td>" ) + hk_decr->m_InfoMsg + wxT("</td>");
msg += wxT("<td><b>&nbsp;&nbsp;") + keyname + wxT( "</b></td></tr>" ); msg += wxT("<td><b>&nbsp;&nbsp;") + keyname + wxT( "</b></td></tr>" );
} }
......
...@@ -316,6 +316,7 @@ const wxString WORKSHEET_DATAITEM::GetClassName() const ...@@ -316,6 +316,7 @@ const wxString WORKSHEET_DATAITEM::GetClassName() const
case WS_SEGMENT: name = wxT("Line"); break; case WS_SEGMENT: name = wxT("Line"); break;
case WS_RECT: name = wxT("Rect"); break; case WS_RECT: name = wxT("Rect"); break;
case WS_POLYPOLYGON: name = wxT("Poly"); break; case WS_POLYPOLYGON: name = wxT("Poly"); break;
case WS_BITMAP: name = wxT("Bitmap"); break;
} }
return name; return name;
...@@ -539,3 +540,38 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize() ...@@ -539,3 +540,38 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
} }
} }
/* set the pixel scale factor of the bitmap
* this factor depend on the application internal unit
* and the PPI bitmap factor
* the pixel scale factor should be initialized before drawing the bitmap
*/
void WORKSHEET_DATAITEM_BITMAP::SetPixelScaleFactor()
{
if( m_ImageBitmap )
{
// m_WSunits2Iu is the page layout unit to application internal unit
// i.e. the mm to to application internal unit
// however the bitmap definition is always known in pixels per inches
double scale = m_WSunits2Iu * 25.4 / m_ImageBitmap->GetPPI();
m_ImageBitmap->SetPixelScaleFactor( scale );
}
}
/* return the PPI of the bitmap
*/
int WORKSHEET_DATAITEM_BITMAP::GetPPI() const
{
if( m_ImageBitmap )
return m_ImageBitmap->GetPPI() / m_ImageBitmap->m_Scale;
return 300;
}
/*adjust the PPI of the bitmap
*/
void WORKSHEET_DATAITEM_BITMAP::SetPPI( int aBitmapPPI )
{
if( m_ImageBitmap )
m_ImageBitmap->m_Scale = (double) m_ImageBitmap->GetPPI() / aBitmapPPI;
}
...@@ -156,6 +156,18 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC ) ...@@ -156,6 +156,18 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
} }
} }
break; break;
case WS_DRAW_ITEM_BASE::wsg_bitmap:
{
WS_DRAW_ITEM_BITMAP* bitmap = (WS_DRAW_ITEM_BITMAP*) item;
if( markerSize )
{
drawMarker( aClipBox, aDC, bitmap->GetPosition(),
markerSize );
}
}
break;
} }
} }
} }
...@@ -274,10 +286,10 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition) ...@@ -274,10 +286,10 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition)
*/ */
bool WS_DRAW_ITEM_RECT::HitTestStartPoint( const wxPoint& aPosition) bool WS_DRAW_ITEM_RECT::HitTestStartPoint( const wxPoint& aPosition)
{ {
wxPoint pos = GetStart(); wxPoint dist = GetStart() - aPosition;
if( std::abs( pos.x - aPosition.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 && if( std::abs( dist.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 &&
std::abs( pos.y - aPosition.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 ) std::abs( dist.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 )
return true; return true;
return false; return false;
...@@ -313,10 +325,10 @@ bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition) ...@@ -313,10 +325,10 @@ bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition)
*/ */
bool WS_DRAW_ITEM_LINE::HitTestStartPoint( const wxPoint& aPosition) bool WS_DRAW_ITEM_LINE::HitTestStartPoint( const wxPoint& aPosition)
{ {
wxPoint pos = GetStart(); wxPoint dist = GetStart() - aPosition;
if( std::abs( pos.x - aPosition.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 && if( std::abs( dist.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 &&
std::abs( pos.y - aPosition.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 ) std::abs( dist.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 )
return true; return true;
return false; return false;
...@@ -326,10 +338,10 @@ bool WS_DRAW_ITEM_LINE::HitTestStartPoint( const wxPoint& aPosition) ...@@ -326,10 +338,10 @@ bool WS_DRAW_ITEM_LINE::HitTestStartPoint( const wxPoint& aPosition)
*/ */
bool WS_DRAW_ITEM_LINE::HitTestEndPoint( const wxPoint& aPosition) bool WS_DRAW_ITEM_LINE::HitTestEndPoint( const wxPoint& aPosition)
{ {
wxPoint pos = GetEnd(); wxPoint dist = GetEnd() - aPosition;
if( std::abs( pos.x - aPosition.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 && if( std::abs( dist.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 &&
std::abs( pos.y - aPosition.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 ) std::abs( dist.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 )
return true; return true;
return false; return false;
...@@ -365,3 +377,47 @@ void WS_DRAW_ITEM_LIST::Locate( std::vector <WS_DRAW_ITEM_BASE*>& aList, ...@@ -365,3 +377,47 @@ void WS_DRAW_ITEM_LIST::Locate( std::vector <WS_DRAW_ITEM_BASE*>& aList,
} }
} }
} }
/** The function to draw a WS_DRAW_ITEM_BITMAP
*/
void WS_DRAW_ITEM_BITMAP::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC )
{
WORKSHEET_DATAITEM_BITMAP* parent = (WORKSHEET_DATAITEM_BITMAP*)GetParent();
if( parent->m_ImageBitmap )
{
parent->m_ImageBitmap->DrawBitmap( NULL, aDC, m_pos );
}
}
/**
* Virtual function
* return true if the point aPosition is on bitmap
*/
bool WS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition)
{
WORKSHEET_DATAITEM_BITMAP* parent = (WORKSHEET_DATAITEM_BITMAP*)GetParent();
if( parent->m_ImageBitmap == NULL )
return false;
EDA_RECT rect = parent->m_ImageBitmap->GetBoundingBox();
rect.Move( m_pos );
return rect.Contains( aPosition );
}
/**
* return true if the point aPosition is on the reference point of this item.
*/
bool WS_DRAW_ITEM_BITMAP::HitTestStartPoint( const wxPoint& aPosition)
{
wxPoint dist = m_pos - aPosition;
if( std::abs( dist.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 &&
std::abs( dist.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 )
return true;
return false;
}
...@@ -76,8 +76,11 @@ private: ...@@ -76,8 +76,11 @@ private:
throw( IO_ERROR, PARSE_ERROR ); throw( IO_ERROR, PARSE_ERROR );
void parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem ) void parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
throw( IO_ERROR, PARSE_ERROR ); throw( IO_ERROR, PARSE_ERROR );
void parseBitmap( WORKSHEET_DATAITEM_BITMAP * aItem )
throw( IO_ERROR, PARSE_ERROR );
void parseCoordinate( POINT_COORD& aCoord) throw( IO_ERROR, PARSE_ERROR ); void parseCoordinate( POINT_COORD& aCoord) throw( IO_ERROR, PARSE_ERROR );
void readOption( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR ); void readOption( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR );
void readPngdata( WORKSHEET_DATAITEM_BITMAP * aItem ) throw( IO_ERROR, PARSE_ERROR );
}; };
// PCB_PLOT_PARAMS_PARSER // PCB_PLOT_PARAMS_PARSER
...@@ -131,6 +134,12 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout ) ...@@ -131,6 +134,12 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
aLayout->Append( item ); aLayout->Append( item );
break; break;
case T_bitmap:
item = new WORKSHEET_DATAITEM_BITMAP( NULL );
parseBitmap( (WORKSHEET_DATAITEM_BITMAP*) item );
aLayout->Append( item );
break;
case T_tbtext: case T_tbtext:
NeedSYMBOLorNUMBER(); NeedSYMBOLorNUMBER();
item = new WORKSHEET_DATAITEM_TEXT( FromUTF8() ); item = new WORKSHEET_DATAITEM_TEXT( FromUTF8() );
...@@ -306,6 +315,110 @@ void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON ...@@ -306,6 +315,110 @@ void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON
} }
} }
#include <wx/mstream.h>
void PAGE_LAYOUT_READER_PARSER::parseBitmap( WORKSHEET_DATAITEM_BITMAP * aItem )
throw( IO_ERROR, PARSE_ERROR )
{
T token;
BITMAP_BASE* image = new BITMAP_BASE;
aItem->m_ImageBitmap = image;
while( ( token = NextTok() ) != T_RIGHT )
{
if( token == T_EOF)
break;
if( token == T_LEFT )
token = NextTok();
switch( token )
{
case T_name:
NeedSYMBOLorNUMBER();
aItem->m_Name = FromUTF8();
NeedRIGHT();
break;
case T_pos:
parseCoordinate( aItem->m_Pos );
break;
case T_repeat:
aItem->m_RepeatCount = parseInt( -1, 100 );
NeedRIGHT();
break;
case T_incrx:
aItem->m_IncrementVector.x = parseDouble();
NeedRIGHT();
break;
case T_incry:
aItem->m_IncrementVector.y = parseDouble();
NeedRIGHT();
break;
case T_linewidth:
aItem->m_LineWidth = parseDouble();
NeedRIGHT();
break;
case T_scale:
aItem->m_ImageBitmap->m_Scale = parseDouble();
NeedRIGHT();
break;
case T_pngdata:
readPngdata( aItem );
break;
default:
Unexpected( CurText() );
break;
}
}
}
void PAGE_LAYOUT_READER_PARSER::readPngdata( WORKSHEET_DATAITEM_BITMAP * aItem )
throw( IO_ERROR, PARSE_ERROR )
{
std::string tmp;
T token;
while( ( token = NextTok() ) != T_RIGHT )
{
if( token == T_EOF)
break;
if( token == T_LEFT )
token = NextTok();
switch( token )
{
case T_data:
NeedSYMBOLorNUMBER();
tmp += CurStr();
tmp += "\n";
NeedRIGHT();
break;
default:
Unexpected( CurText() );
break;
}
}
tmp += "EndData";
wxString msg;
STRING_LINE_READER reader( tmp, wxT("Png kicad_wks data") );
if( ! aItem->m_ImageBitmap->LoadData( reader, msg ) )
{
wxLogMessage(msg);
}
}
void PAGE_LAYOUT_READER_PARSER::readOption( WORKSHEET_DATAITEM * aItem ) void PAGE_LAYOUT_READER_PARSER::readOption( WORKSHEET_DATAITEM * aItem )
throw( IO_ERROR, PARSE_ERROR ) throw( IO_ERROR, PARSE_ERROR )
{ {
...@@ -630,7 +743,6 @@ void WORKSHEET_LAYOUT::SetDefaultLayout() ...@@ -630,7 +743,6 @@ void WORKSHEET_LAYOUT::SetDefaultLayout()
try try
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
SetDefaultDescrFlag( true );
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
...@@ -652,7 +764,6 @@ void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append ) ...@@ -652,7 +764,6 @@ void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append )
try try
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
SetDefaultDescrFlag( true );
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
...@@ -716,7 +827,6 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append ...@@ -716,7 +827,6 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
try try
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
SetDefaultDescrFlag( false );
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
......
...@@ -14,6 +14,7 @@ notonpage1 ...@@ -14,6 +14,7 @@ notonpage1
line line
rect rect
polygon polygon
bitmap
tbtext tbtext
ltcorner ltcorner
lbcorner lbcorner
...@@ -23,6 +24,9 @@ name ...@@ -23,6 +24,9 @@ name
pos pos
start start
end end
scale
pngdata
data
pts pts
xy xy
maxlen maxlen
......
...@@ -62,11 +62,6 @@ ...@@ -62,11 +62,6 @@
#include <class_worksheet_dataitem.h> #include <class_worksheet_dataitem.h>
// Temporary include. Will be removed when a GOST page layout descr file is available
#ifdef KICAD_GOST
#include "title_block_shapes_gost.cpp"
#endif
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const PAGE_INFO& aPageInfo, const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock, const TITLE_BLOCK& aTitleBlock,
...@@ -74,16 +69,6 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -74,16 +69,6 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
{ {
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
// Ugly hack: will be removed when a GOST page layout descr file is available
#ifdef KICAD_GOST
if( pglayout.IsDefaultDescr() )
{
((WS_DRAW_ITEM_LIST_GOST*)this)->BuildWorkSheetGraphicListGOST( aPageInfo,
aTitleBlock, aColor, aAltColor );
return;
}
#endif
#define milsTomm (25.4/1000) #define milsTomm (25.4/1000)
m_titleBlock = &aTitleBlock; m_titleBlock = &aTitleBlock;
...@@ -251,6 +236,21 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -251,6 +236,21 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
} }
} }
break; break;
case WORKSHEET_DATAITEM::WS_BITMAP:
((WORKSHEET_DATAITEM_BITMAP*)wsItem)->SetPixelScaleFactor();
for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
{
if( jj && ! wsItem->IsInsidePage( jj ) )
continue;
Append( new WS_DRAW_ITEM_BITMAP( wsItem,
wsItem->GetStartPosUi( jj ) ) );
}
break;
} }
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
page_layout
setup
linewidth
textlinewidth
textsize
comment
line
rect
polygon
tbtext
ltcorner
lbcorner
rbcorner
rtcorner
name
pos
start
end
pts
xy
maxlen
maxheight
font
bold
italic
size
justify
left
center
right
top
bottom
rotate
repeat
incrx
incry
incrlabel
This diff is collapsed.
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include <protos.h> #include <protos.h>
const wxString traceFindReplace( wxT( "KicadFindReplace" ) );
const wxString traceFindItem( wxT( "KicadFindItem" ) ); const wxString traceFindItem( wxT( "KicadFindItem" ) );
......
This diff is collapsed.
...@@ -25,6 +25,8 @@ set( CVPCB_DIALOGS ...@@ -25,6 +25,8 @@ set( CVPCB_DIALOGS
dialogs/dialog_display_options_base.cpp dialogs/dialog_display_options_base.cpp
../pcbnew/dialogs/dialog_fp_lib_table.cpp ../pcbnew/dialogs/dialog_fp_lib_table.cpp
../pcbnew/dialogs/dialog_fp_lib_table_base.cpp ../pcbnew/dialogs/dialog_fp_lib_table_base.cpp
../pcbnew/dialogs/dialog_fp_plugin_options.cpp
../pcbnew/dialogs/dialog_fp_plugin_options_base.cpp
) )
set( CVPCB_SRCS set( CVPCB_SRCS
...@@ -119,6 +121,12 @@ target_link_libraries(cvpcb ...@@ -119,6 +121,12 @@ target_link_libraries(cvpcb
) )
endif(WIN32 AND MSYS) endif(WIN32 AND MSYS)
if( BUILD_GITHUB_PLUGIN )
target_link_libraries( cvpcb github_plugin )
endif()
### ###
# Add cvpcb as install target # Add cvpcb as install target
### ###
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <cvpcb.h> #include <cvpcb.h>
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <class_DisplayFootprintsFrame.h>
#define GROUP wxT("/cvpcb") #define GROUP wxT("/cvpcb")
...@@ -94,9 +95,17 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName ) ...@@ -94,9 +95,17 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
// Attempt to load the project footprint library table if it exists. // Attempt to load the project footprint library table if it exists.
m_footprintLibTable = new FP_LIB_TABLE(); m_footprintLibTable = new FP_LIB_TABLE();
if( m_DisplayFootprintFrame )
m_DisplayFootprintFrame->SetFootprintLibTable( m_footprintLibTable );
wxFileName projectFpLibTableFileName;
projectFpLibTableFileName = FP_LIB_TABLE::GetProjectFileName( fn );
try try
{ {
m_footprintLibTable->Load( fn, m_globalFootprintTable ); m_footprintLibTable->Load( projectFpLibTableFileName, m_globalFootprintTable );
FP_LIB_TABLE::SetProjectPathEnvVariable( projectFpLibTableFileName );
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -71,7 +71,6 @@ set(EESCHEMA_SRCS ...@@ -71,7 +71,6 @@ set(EESCHEMA_SRCS
component_references_lister.cpp component_references_lister.cpp
controle.cpp controle.cpp
cross-probing.cpp cross-probing.cpp
dangling_ends.cpp
database.cpp database.cpp
${EESCHEMA_DLGS} ${EESCHEMA_DLGS}
edit_component_in_schematic.cpp edit_component_in_schematic.cpp
......
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.
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.
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