Commit 8080a2c9 authored by charras's avatar charras

code cleaning and a bug in eeschema (print all not working) solved

parent 5a27f272
......@@ -5,6 +5,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Juil-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema:
Added component sheet X,Y location in BOM.
Netlist generation: now spaces in names are replaced by '_' for pcbnew (which does not accept spaces)
Bug: print all pages did not work.
Please note in complex hierarchy, the current "Print All" function needs to be enhanced,
because it does not draw all sheets but only all different sheets
2008-Jule-08 UPDATE Andrey Fedorushkov <andrf@mail.ru>
================================================================================
+pcbnew:
......
......@@ -30,8 +30,8 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w
wxString Line;
Ki_WorkSheetData* WsItem;
int scale = m_InternalUnits / 1000;
wxSize size( SIZETEXT* scale, SIZETEXT* scale );
wxSize size_ref( SIZETEXT_REF* scale, SIZETEXT_REF* scale );
wxSize size( SIZETEXT * scale, SIZETEXT * scale );
wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale );
wxString msg;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
......@@ -41,7 +41,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w
if( Sheet == NULL )
{
DisplayError( this,
wxT( "WinEDA_DrawFrame::TraceWorkSheet() error: m_CurrentSheet NULL" ) );
wxT( "WinEDA_DrawFrame::TraceWorkSheet() error: NULL Sheet" ) );
return;
}
......@@ -315,6 +315,61 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w
}
/************************************************************************************************/
wxString WinEDA_DrawFrame::GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition )
/************************************************************************************************/
/** Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits)
*/
{
Ki_PageDescr* Sheet = aScreen->m_CurrentSheetDesc;
int ii, xg, yg, ipas, gxpas, gypas;
int refx, refy;
wxString msg;
if( Sheet == NULL )
{
DisplayError( this,
wxT( "WinEDA_DrawFrame::GetXYSheetReferences() error: NULL Sheet" ) );
return msg;
}
refx = Sheet->m_LeftMargin;
refy = Sheet->m_TopMargin; /* Upper left corner */
xg = Sheet->m_Size.x - Sheet->m_RightMargin;
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
/* Get the Y axis identifier (A symbol A ... Z) */
if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits
msg << wxT( "?" );
else
{
ipas = (yg - refy) / PAS_REF; // ipas = Y count sections
gypas = ( yg - refy) / ipas; // gypas = Y section size
ii = (aPosition.y - refy) / gypas;
msg.Printf( wxT( "%c" ), 'A' + ii );
}
/* Get the X axis identifier (A number 1 ... n) */
if( aPosition.x < refx || aPosition.x > xg ) // Ouside of X limits
msg << wxT( "?" );
else
{
ipas = (xg - refx) / PAS_REF; // ipas = X count sections
gxpas = ( xg - refx) / ipas; // gxpas = X section size
ii = (aPosition.x - refx) / gxpas;
msg << ii + 1;
}
return msg;
}
/*********************************************************************/
wxString WinEDA_DrawFrame::GetScreenDesc()
/*********************************************************************/
......
This diff is collapsed.
......@@ -57,7 +57,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" )
* or "# EESchema Netliste"
*/
fgets( Line, 255, source );
fgets( Line, BUFFER_CHAR_SIZE, source );
/* test for netlist type PCB2 */
i = strnicmp( Line, "( {", 3 );
if( i != 0 )
......@@ -310,7 +310,7 @@ int ReadPinConnection( STORECMP* Cmp )
memset( net, 0, sizeof(net) );
memset( numpin, 0, sizeof(numpin) );
/* Read pi name , 4 letters */
/* Read pin name , 4 letters */
for( jj = 0; jj < 4; jj++, i++ )
{
if( Line[i] == ' ' )
......
......@@ -312,8 +312,8 @@ int BuildComponentsListFromSchematic( ListComponent* aList )
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
sizeof( aList->m_Ref ) );
// @todo the above line is probably a bug, because it will not always nul terminate m_Ref.
// Ensure always nul terminate m_Ref.
aList->m_Ref[sizeof( aList->m_Ref ) - 1 ] = 0;
aList++;
}
}
......@@ -670,7 +670,11 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol );
if( aIncludeSubComponents )
{
fprintf( f, "%csheet path", s_ExportSeparatorSymbol );
fprintf( f, "%clocation", s_ExportSeparatorSymbol );
}
if( m_AddFootprintField->IsChecked() )
fprintf( f, "%cfootprint", s_ExportSeparatorSymbol );
......@@ -737,9 +741,17 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
{
msg = aList[ii].m_SheetList.PathHumanReadable();
if( CompactForm )
{
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
}
else
{
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
}
}
PrintFieldData( f, DrawLibItem, CompactForm );
......@@ -811,6 +823,8 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
{
msg = aList[ii].m_SheetList.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
}
PrintFieldData( f, DrawLibItem );
......
......@@ -137,16 +137,20 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************************/
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask )
/*******************************************************************************/
/** PrintPage
* used to print a page.
* Print the page pointed by ActiveScreen, set by the calling print function
* @param DC = wxDC given by the calling print function
* @param Print_Sheet_Ref = true to print page references
* @param PrintMask = not used here
*/
{
BASE_SCREEN* screen;
wxBeginBusyCursor();
ActiveScreen = screen = m_Parent->GetBaseScreen();
RedrawStructList( this, DC, screen->EEDrawList, GR_COPY );
RedrawStructList( this, DC, ActiveScreen->EEDrawList, GR_COPY );
if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, screen, g_DrawMinimunLineWidth );
m_Parent->TraceWorkSheet( DC, ActiveScreen, g_DrawMinimunLineWidth );
wxEndBusyCursor();
}
......
This diff is collapsed.
......@@ -236,11 +236,13 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
{
if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
{
NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetName;
wxString lnet = NetName;
NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable();
// If sheet path is too long, use the time stamp name insteed
if ( NetName.Length() > 32 )
NetName = g_TabObjNet[jj].m_SheetList.Path();
NetName += lnet;
}
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
else
{
......@@ -619,7 +621,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
continue;
wxString netname = ReturnPinNetName( Pin, wxT( "N-%.6d" ) );
if( netname.IsEmpty() )
netname = wxT( " ?" );
netname = wxT( "?" );
netname.Replace( wxT( " " ), wxT( "_" ) );
fprintf( f, " ( %4.4s %s )\n", (char*) &Pin->m_PinNum,
CONV_TO_UTF8( netname ) );
}
......
......@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
# include "config.h"
(wxT(KICAD_SVN_VERSION))
# else
(wxT("(20080715"))
(wxT("(20080731.r1175"))
# endif
#endif
;
......
......@@ -20,8 +20,7 @@
#define PAD_SMD 1 // Smd pad, appears on the layer paste (default)
#define PAD_CONN 2 // Like smd, does not appear on the layer paste (default)
// reserved, but not yet really used:
#define PAD_P_HOLE 3 // trou simple, utile sur pad stack
#define PAD_MECA 4 // PAD "mecanique" (fixation, zone cuivre...)
#define PAD_HOLE_NOT_PLATED 3 // like PAD_STANDARD, but not plated (no connection between copper layers)
#endif // PAD_SHAPES_H_
......
......@@ -298,6 +298,14 @@ public:
void OnActivate( wxActivateEvent& event );
void ReDrawPanel();
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
/** Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits)
*/
wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
void DisplayToolMsg( const wxString msg );
void Process_Zoom( wxCommandEvent& event );
void Process_Grid( wxCommandEvent& event );
......
......@@ -747,9 +747,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
if( strncmp( BufLine, "CONN", 4 ) == 0 )
m_Attribut = PAD_CONN;
if( strncmp( BufLine, "HOLE", 4 ) == 0 )
m_Attribut = PAD_P_HOLE;
if( strncmp( BufLine, "MECA", 4 ) == 0 )
m_Attribut = PAD_MECA;
m_Attribut = PAD_HOLE_NOT_PLATED;
break;
case 'N': /* Lecture du netname */
......@@ -777,7 +775,9 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
}
/*************************************/
bool D_PAD::Save( FILE* aFile ) const
/*************************************/
{
int cshape;
const char* texttype;
......@@ -833,12 +833,9 @@ bool D_PAD::Save( FILE* aFile ) const
case PAD_CONN:
texttype = "CONN"; break;
case PAD_P_HOLE:
case PAD_HOLE_NOT_PLATED:
texttype = "HOLE"; break;
case PAD_MECA:
texttype = "MECA"; break;
default:
texttype = "STD";
DisplayError( NULL, wxT( "Invalid Pad attribute" ) );
......@@ -1144,8 +1141,7 @@ static const char* ShowPadAttr( int aPadAttr )
case PAD_STANDARD: return "STD";
case PAD_SMD: return "SMD";
case PAD_CONN: return "CONN";
case PAD_P_HOLE: return "HOLE";
case PAD_MECA: return "MECA";
case PAD_HOLE_NOT_PLATED: return "HOLE";
default: return "??unkown??";
}
}
......
......@@ -144,7 +144,7 @@ void WinEDA_PadPropertiesFrame::CreateControls()
{
SetFont(*g_DialogFont);
////@begin WinEDA_PadPropertiesFrame content construction
// Generated by DialogBlocks, 27/08/2007 21:03:59 (unregistered)
// Generated by DialogBlocks, 30/07/2008 22:05:19 (unregistered)
WinEDA_PadPropertiesFrame* itemDialog1 = this;
......@@ -205,8 +205,6 @@ void WinEDA_PadPropertiesFrame::CreateControls()
m_PadTypeStrings.Add(_("Standard"));
m_PadTypeStrings.Add(_("SMD"));
m_PadTypeStrings.Add(_("Conn"));
m_PadTypeStrings.Add(_("Hole"));
m_PadTypeStrings.Add(_("Mechanical"));
m_PadType = new wxRadioBox( itemDialog1, ID_LISTBOX_TYPE_PAD, _("Pad Type:"), wxDefaultPosition, wxDefaultSize, m_PadTypeStrings, 1, wxRA_SPECIFY_COLS );
m_PadType->SetSelection(0);
m_PadOptSizer->Add(m_PadType, 0, wxGROW|wxALL, 5);
......@@ -234,7 +232,7 @@ void WinEDA_PadPropertiesFrame::CreateControls()
m_PadLayerCmp->SetValue(false);
itemStaticBoxSizer18->Add(m_PadLayerCmp, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
itemStaticBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemStaticBoxSizer18->Add(5, 5, 0, wxGROW|wxALL, 5);
m_PadLayerAdhCmp = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Adhesive Cmp"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_PadLayerAdhCmp->SetValue(false);
......@@ -386,7 +384,7 @@ void WinEDA_PadPropertiesFrame::OnListboxShapePadSelected( wxCommandEvent& event
void WinEDA_PadPropertiesFrame::OnListboxTypePadSelected( wxCommandEvent& event )
{
PadTypeSelectedEvent(event);
PadTypeSelected();
}
......
......@@ -58,7 +58,7 @@ class wxBoxSizer;
#define ID_CHECKBOX10 10016
#define ID_CHECKBOX11 10017
#define ID_CHECKBOX12 10018
#define SYMBOL_WINEDA_PADPROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WINEDA_PADPROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_PADPROPERTIESFRAME_TITLE _("Pad properties")
#define SYMBOL_WINEDA_PADPROPERTIESFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_PADPROPERTIESFRAME_SIZE wxSize(400, 300)
......@@ -131,7 +131,6 @@ public:
void PadPropertiesAccept(wxCommandEvent& event);
void PadTypeSelected();
void PadTypeSelectedEvent(wxCommandEvent& event);
void PadOrientEvent(wxCommandEvent& event);
void SetPadLayersList(long layer_mask);
void SetOthersControls();
......
This diff is collapsed.
......@@ -26,22 +26,26 @@ int CodeShape[NBSHAPES] = /* forme des pads */
};
#define NBTYPES 5
#define NBTYPES 4
int CodeType[NBTYPES] =
{
PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_P_HOLE, PAD_MECA
PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
};
// Default mask layers for pads according to the pas type
static long Std_Pad_Layers[NBTYPES] =
{
// PAD_STANDARD:
ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP,
// PAD_CONN:
CMP_LAYER | SOLDERPASTE_LAYER_CMP | SOLDERMASK_LAYER_CMP,
// PAD_SMD:
CMP_LAYER | SOLDERMASK_LAYER_CMP,
ALL_CU_LAYERS | SILKSCREEN_LAYER_CU | SILKSCREEN_LAYER_CMP |
SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP,
ALL_CU_LAYERS | SILKSCREEN_LAYER_CU | SILKSCREEN_LAYER_CMP |
SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP
//PAD_HOLE_NOT_PLATED:
ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP
};
......@@ -247,18 +251,12 @@ void WinEDA_PadPropertiesFrame::PadOrientEvent( wxCommandEvent& event )
}
/**************************************************************************/
void WinEDA_PadPropertiesFrame::PadTypeSelectedEvent( wxCommandEvent& event )
/**************************************************************************/
/* calcule un layer_mask type selon la selection du type du pad
*/
{
PadTypeSelected();
}
/************************************************/
void WinEDA_PadPropertiesFrame::PadTypeSelected()
/************************************************/
/* Adjust the better mask layer according to the selected pad type
*/
{
long layer_mask;
int ii;
......@@ -524,8 +522,11 @@ void WinEDA_PadPropertiesFrame::PadPropertiesAccept( wxCommandEvent& event )
CurrentPad->m_Drill = wxSize( 0, 0 );
break;
case PAD_P_HOLE:
case PAD_MECA:
case PAD_HOLE_NOT_PLATED:
break;
default:
DisplayError(this, wxT("Error: unknown pad type"));
break;
}
......
......@@ -132,6 +132,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
int ii;
FILE* source;
wxString msg;
char cbuf[1024];
ActiveScreen = GetScreen();
......
......@@ -794,6 +794,7 @@ int WinEDA_ModuleEditFrame::Create_Librairie( const wxString& LibName )
{
FILE* lib_module;
wxString msg;
char cbuf[256];
if( wxFileExists( LibName ) )
{
......@@ -835,6 +836,7 @@ static bool CreateDocLibrary( const wxString& LibName )
*/
{
char Line[1024];
char cbuf[256];
wxString Name, Doc, KeyWord;
wxString LibDocName;
FILE* LibMod, * LibDoc;
......
......@@ -212,10 +212,7 @@ eda_global char* adr_himem; /* adresse haute limite de la memoire disponible
eda_global char* adr_max; /* adresse haute maxi utilisee pour la memoire */
/* variables g�erales */
eda_global char cbuf[1024]; /* buffer for some text printing */
eda_global BOARD* g_ModuleEditor_Pcb; /* board used to edit footprints (used by modedit)*/
/* variables generales */
eda_global int g_TimeOut; // Timer for automatic saving
eda_global int g_SaveTime; // Time for next saving
......@@ -320,6 +317,7 @@ eda_global int g_PadCMPColor;
#endif
eda_global PCB_SCREEN* ScreenPcb; /* Ecran principal */
eda_global BOARD* g_ModuleEditor_Pcb; /* board used to edit footprints (used by modedit)*/
eda_global PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */
......
......@@ -367,6 +367,7 @@ void trace_1_pastille_OVALE_GERBER( wxPoint pos, wxSize size, int orient )
*/
{
D_CODE* dcode_ptr;
char cbuf[256];
int x0, y0, x1, y1, delta;
if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */
......@@ -420,6 +421,7 @@ void Plot_1_CIRCLE_pad_GERBER( wxPoint pos, int diametre )
*/
{
D_CODE* dcode_ptr;
char cbuf[256];
wxSize size( diametre, diametre );
......@@ -451,6 +453,7 @@ void PlotRectangularPad_GERBER( wxPoint pos, wxSize size, int orient )
*/
{
D_CODE* dcode_ptr;
char cbuf[256];
/* Trace de la forme flashee */
switch( orient )
......@@ -630,6 +633,7 @@ void PlotGERBERLine( wxPoint start, wxPoint end, int large )
*/
{
D_CODE* dcode_ptr;
char cbuf[256];
UserToDeviceCoordinate( start );
UserToDeviceCoordinate( end );
......@@ -865,6 +869,7 @@ int WinEDA_BasePcbFrame::Gen_D_CODE_File( FILE* penfile )
*/
{
D_CODE* ptr_tool;
char cbuf[1024];
int nb_dcodes = 0;
/* Init : */
......
......@@ -499,6 +499,7 @@ void trace_1_pastille_RONDE_HPGL( wxPoint pos, int diametre, int modetrace )
/**************************************************************************/
/* Trace 1 pastille RONDE (via,pad rond) en position pos */
{
char cbuf[1024];
int rayon, delta;
UserToDeviceCoordinate( pos );
......
......@@ -237,8 +237,7 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
fprintf( outfile, " %d", 2 );
break;
case PAD_P_HOLE:
case PAD_MECA:
case PAD_HOLE_NOT_PLATED:
fprintf( outfile, " %d", 4 );
break;
}
......
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