Commit 555b1c5a authored by charras's avatar charras

code cleaning

parent b256efc5
No preview for this file type
This diff is collapsed.
......@@ -7,7 +7,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
# Many of the commented out ones are nested in *.cpp files for dialogs
set(PCBNEW_SRCS
affiche.cpp
attribut.cpp
automove.cpp
autoplac.cpp
......
/**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "autorout.h"
#include "3d_struct.h"
#include "protos.h"
/* Routines locales */
/*******************************************************************/
void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame )
/*******************************************************************/
/* Affiche les infos relatives a une equipot: nb de pads, nets , connexions.. */
{
int nb_vias = 0, ii;
EDA_BaseStruct* Struct;
wxString txt;
MODULE* module;
D_PAD* pad;
EQUIPOT* equipot;
double lengthnet = 0;
frame->MsgPanel->EraseMsgBox();
equipot = frame->GetBoard()->FindNet( netcode );
if( equipot )
Affiche_1_Parametre( frame, 1, _( "Net Name" ), equipot->GetNetname(), RED );
else
Affiche_1_Parametre( frame, 1, _( "No Net (not connected)" ), wxEmptyString, RED );
txt.Printf( wxT( "%d" ), netcode );
Affiche_1_Parametre( frame, 30, _( "Net Code" ), txt, RED );
for( ii = 0, module = frame->GetBoard()->m_Modules; module != 0;
module = module->Next() )
{
for( pad = module->m_Pads; pad != 0; pad = pad->Next() )
{
if( pad->GetNet() == netcode )
ii++;
}
}
txt.Printf( wxT( "%d" ), ii );
Affiche_1_Parametre( frame, 40, _( "Pads" ), txt, DARKGREEN );
for( ii = 0, Struct = frame->GetBoard()->m_Track; Struct != NULL; Struct = Struct->Next() )
{
ii++;
if( Struct->Type() == TYPE_VIA )
if( ( (SEGVIA*) Struct )->GetNet() == netcode )
nb_vias++;
if( Struct->Type() == TYPE_TRACK )
if( ( (TRACK*) Struct )->GetNet() == netcode )
lengthnet += ( (TRACK*) Struct )->GetLength();
}
txt.Printf( wxT( "%d" ), nb_vias );
Affiche_1_Parametre( frame, 50, _( "Vias" ), txt, BLUE );
valeur_param( (int) lengthnet, txt );
Affiche_1_Parametre( frame, 60, _( "Net Length" ), txt, RED );
}
......@@ -4,10 +4,9 @@
#include "fctsys.h"
#include "wxstruct.h"
#include "gr_basic.h"
#include "common.h"
#include "kicad_string.h"
#include "pcbnew.h"
#include "protos.h"
/*********************************************************/
......@@ -128,6 +127,62 @@ void EQUIPOT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPo
}
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void EQUIPOT::DisplayInfo( WinEDA_DrawFrame* frame )
{
int count;
EDA_BaseStruct* Struct;
wxString txt;
MODULE* module;
D_PAD* pad;
double lengthnet = 0;
frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Net Name" ), GetNetname(), RED );
txt.Printf( wxT( "%d" ), GetNet() );
Affiche_1_Parametre( frame, 30, _( "Net Code" ), txt, RED );
count = 0;
module = ((WinEDA_BasePcbFrame*)frame)->GetBoard()->m_Modules;
for( ; module != 0; module = module->Next() )
{
for( pad = module->m_Pads; pad != 0; pad = pad->Next() )
{
if( pad->GetNet() == GetNet() )
count++;
}
}
txt.Printf( wxT( "%d" ), count );
Affiche_1_Parametre( frame, 40, _( "Pads" ), txt, DARKGREEN );
count = 0;
Struct = ((WinEDA_BasePcbFrame*)frame)->GetBoard()->m_Track;
for( ; Struct != NULL; Struct = Struct->Next() )
{
if( Struct->Type() == TYPE_VIA )
if( ( (SEGVIA*) Struct )->GetNet() == GetNet() )
count++;
if( Struct->Type() == TYPE_TRACK )
if( ( (TRACK*) Struct )->GetNet() == GetNet() )
lengthnet += ( (TRACK*) Struct )->GetLength();
}
txt.Printf( wxT( "%d" ), count );
Affiche_1_Parametre( frame, 50, _( "Vias" ), txt, BLUE );
valeur_param( (int) lengthnet, txt );
Affiche_1_Parametre( frame, 60, _( "Net Length" ), txt, RED );
}
#if defined(DEBUG)
/**
......
......@@ -94,6 +94,15 @@ public:
}
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void DisplayInfo( WinEDA_DrawFrame* frame );
#if defined(DEBUG)
/**
* Function Show
......
......@@ -904,6 +904,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
/* Ecriture de l'entete PCB : */
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
DateAndTime( line ) );
fprintf( aFile, "# Created by Pcbnew%s\n\n", CONV_TO_UTF8( GetBuildVersion() ) );
WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile );
......
......@@ -138,7 +138,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( netcode < 0 )
GetBoard()->DisplayInfo( this );
else
Affiche_Infos_Equipot( netcode, this );
{
EQUIPOT * net = GetBoard()->FindNet(netcode);
if ( net )
net->DisplayInfo( this );
}
}
break;
......
......@@ -330,11 +330,6 @@ void Trace_Block( WinEDA_DrawPanel* panel, wxDC* DC, int ox, int oy, int fx,
* (toujours en mode XOR) */
/*****************************************************************/
/* AFFICHE.CPP: (Fonctions d'affichage de messages, parametres... */
/*****************************************************************/
void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame );
/************/
/* ZONES.CPP */
/************/
......
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