Code cleanup: Pcbnew: move files relative to exort functions to the new folder exporters

all: remove include <protos.h>  from a lot of  files which do not need it.
This commit is contained in:
jean-pierre charras 2014-01-08 15:18:51 +01:00
commit f905b4697e
70 changed files with 77 additions and 135 deletions

View File

@ -13,19 +13,10 @@ static const wxString HOSTNAME( wxT( "localhost" ) );
// buffer for read and write data in socket connections
#define IPC_BUF_SIZE 4096
static char client_ipc_buffer[IPC_BUF_SIZE];
static wxSocketServer* server;
void (*RemoteFct)(const char* cmd);
void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
{
RemoteFct = remotefct;
}
/**********************************/
/* Routines related to the server */
@ -75,10 +66,7 @@ void EDA_DRAW_FRAME::OnSockRequest( wxSocketEvent& evt )
sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
len = 1 + sock->LastCount();
client_ipc_buffer[len] = 0;
if( RemoteFct )
RemoteFct( client_ipc_buffer );
ExecuteRemoteCommand( client_ipc_buffer );
break;
case wxSOCKET_LOST:

View File

@ -36,7 +36,6 @@
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
const wxString traceFindItem( wxT( "KicadFindItem" ) );

View File

@ -34,7 +34,6 @@
#include <general.h>
#include <class_library.h>
#include <protos.h>
#include <libeditframe.h>

View File

@ -36,7 +36,6 @@
#include <lib_draw_item.h>
#include <lib_pin.h>
#include <general.h>
#include <protos.h>
#include <sch_bus_entry.h>
#include <sch_junction.h>
#include <sch_line.h>

View File

@ -36,7 +36,6 @@
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
#include <sch_bus_entry.h>

View File

@ -37,7 +37,6 @@
#include <richio.h>
#include <general.h>
#include <protos.h>
#include <template_fieldnames.h>
#include <transform.h>
#include <class_library.h>

View File

@ -37,7 +37,6 @@
#include <richio.h>
#include <general.h>
#include <protos.h>
#include <class_library.h>
#include <boost/foreach.hpp>

View File

@ -38,7 +38,6 @@
#include <eeschema_id.h>
#include <general.h>
#include <hotkeys.h>
#include <protos.h>
#include <libeditframe.h>
#include <viewlib_frame.h>
#include <lib_draw_item.h>

View File

@ -35,15 +35,13 @@
#include <general.h>
#include <eeschema_id.h>
#include <protos.h>
#include <lib_draw_item.h>
#include <lib_pin.h>
#include <sch_component.h>
/**
* Function RemoteCommand
* read a remote command sent by Pcbnew via a socket connection.
* Execute a remote command sent by Pcbnew via a socket connection.
* <p>
* When user selects a module or pin in Pcbnew, Eeschema shows that same
* component or pin and moves cursor on the item. The socket port used
@ -57,7 +55,7 @@
* <p>
* @param cmdline = received command from Pcbnew
*/
void RemoteCommand( const char* cmdline )
void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
{
char line[1024];
char* idcmd;

View File

@ -8,7 +8,6 @@
#include <class_drawpanel.h>
#include <general.h>
#include <protos.h>
#include <dialog_color_config.h>
#include <layers_id_colors_and_visibility.h>

View File

@ -35,7 +35,6 @@
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <class_library.h>
#include <sch_component.h>

View File

@ -46,7 +46,6 @@
#include <general.h>
#include <netlist.h>
#include <protos.h>
#include <sch_sheet.h>
#include <dialog_helpers.h>
#include <dialogs/dialog_netlist_base.h>

View File

@ -37,7 +37,6 @@
#include <kicad_device_context.h>
#include <general.h>
#include <protos.h>
#include <sch_text.h>
#include <eeschema_id.h>

View File

@ -39,8 +39,7 @@
#include <general.h>
#include <class_libentry.h>
#include <sch_junction.h>
#include <protos.h>
//#include <sch_junction.h>
#include <hotkeys.h>
#include <dialogs/dialog_color_config.h>
#include <transform.h>
@ -138,11 +137,7 @@ bool EDA_APP::OnInit()
SetTopWindow( frame );
frame->Show( true );
if( CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER ) )
{
// RemoteCommand is in controle.cpp and is called when Pcbnew sends Eeschema a command.
SetupServerFunction( RemoteCommand );
}
CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER );
frame->Zoom_Automatique( true );

View File

@ -36,7 +36,6 @@
#include <netlist.h>
#include <class_netlist_object.h>
#include <lib_pin.h>
#include <protos.h>
#include <erc.h>
#include <sch_marker.h>
#include <sch_component.h>

View File

@ -8,8 +8,6 @@
#include <general.h>
#include <kicad_device_context.h>
#include <wxEeschemaStruct.h>
#include <protos.h>
#include <sch_component.h>
#include <sch_text.h>

View File

@ -33,7 +33,6 @@
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <class_libentry.h>
#include <sch_junction.h>

View File

@ -38,7 +38,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <lib_arc.h>
#include <transform.h>

View File

@ -38,7 +38,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <lib_bezier.h>
#include <transform.h>

View File

@ -39,7 +39,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <lib_circle.h>
#include <transform.h>

View File

@ -32,7 +32,6 @@
#include <wxstruct.h>
#include <msgpanel.h>
#include <protos.h>
#include <general.h>
#include <lib_draw_item.h>

View File

@ -40,7 +40,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <class_libentry.h>
#include <transform.h>
#include <lib_field.h>

View File

@ -40,7 +40,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <class_libentry.h>
#include <lib_pin.h>

View File

@ -38,7 +38,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <lib_polyline.h>
#include <transform.h>

View File

@ -38,7 +38,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <lib_rectangle.h>
#include <transform.h>

View File

@ -39,7 +39,6 @@
#include <lib_draw_item.h>
#include <general.h>
#include <protos.h>
#include <transform.h>
#include <lib_text.h>

View File

@ -37,7 +37,6 @@
#include <general.h>
#include <netlist.h>
#include <protos.h>
#include <class_library.h>
#include <sch_component.h>
#include <sch_sheet.h>

View File

@ -32,7 +32,6 @@
#include <netlist.h>
#include <class_netlist_object.h>
#include <protos.h>
#include <class_library.h>
#include <lib_pin.h>
#include <sch_junction.h>

View File

@ -7,17 +7,9 @@
class EDA_DRAW_PANEL;
class EDA_DRAW_FRAME;
class PICKED_ITEMS_LIST;
class SCH_EDIT_FRAME;
class LIB_EDIT_FRAME;
class CMP_LIBRARY;
class SCH_COMPONENT;
class SCH_SCREEN;
class SCH_ITEM;
/****************/
/* DATABASE.CPP */
/****************/
//void DisplayCmpDoc( wxString& Name );
wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufName );
@ -39,7 +31,8 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false );
/****************/
/* EEREDRAW.CPP */
/****************/
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, EDA_COLOR_T Color );
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& pos, EDA_COLOR_T Color );
/***************/
@ -81,11 +74,4 @@ CMP_LIBRARY* SelectLibraryFromList( EDA_DRAW_FRAME* frame );
*/
int GetNameOfPartToLoad( EDA_DRAW_FRAME* frame, CMP_LIBRARY* Lib, wxString& BufName );
/****************/
/* CONTROLE.CPP */
/****************/
void RemoteCommand( const char* cmdline );
#endif /* __PROTOS_H__ */

View File

@ -37,7 +37,6 @@
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <sch_sheet.h>
#include <dialog_helpers.h>

View File

@ -32,7 +32,6 @@
#include <eeschema_id.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <dialog_helpers.h>

View File

@ -33,7 +33,6 @@
#include <eeschema_id.h>
#include <general.h>
#include <protos.h>
#include <hotkeys.h>
#include <class_library.h>
#include <viewlib_frame.h>

View File

@ -23,6 +23,5 @@
wxSocketServer* CreateServer( wxWindow * window, int port, bool local = true );
bool SendCommand( int port, const char* cmdline );
void SetupServerFunction( void (*remotefct) (const char* remotecmd) );
#endif // EDA_DDE_H_

View File

@ -362,6 +362,14 @@ public:
void InstallConfigFrame( wxCommandEvent& event );
/**
* Execute a remote command send by Pcbnew via a socket,
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
* @param cmdline = received command from socket
*/
virtual void ExecuteRemoteCommand( const char* cmdline );
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );

View File

@ -232,6 +232,14 @@ public:
void OnQuit( wxCommandEvent& event );
/**
* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
* @param cmdline = received command from socket
*/
virtual void ExecuteRemoteCommand( const char* cmdline );
/**
* Function ToPlotter
* Open a dialog frame to create plot and drill files

View File

@ -588,6 +588,17 @@ public:
*/
virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
/**
* Execute a remote command send via a socket to the application,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* It called by EDA_DRAW_FRAME::OnSockRequest().
* this is a virtual function becuse the actual commands depends on the
* application.
* the basic function do nothing
* @param cmdline = received command from socket
*/
virtual void ExecuteRemoteCommand( const char* cmdline ){}
void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event );

View File

@ -27,6 +27,7 @@ include_directories(
../common
../polygon
../common/dialogs
./exporters
../lib_dxf
./import_dxf
${INC_AFTER}
@ -125,6 +126,18 @@ set( PCBNEW_IMPORT_DXF
import_dxf/dxf2brd_items.cpp
)
set( PCBNEW_EXPORTERS
exporters/export_d356.cpp
exporters/export_gencad.cpp
exporters/export_idf.cpp
exporters/export_vrml.cpp
exporters/idf.cpp
exporters/gen_drill_report_files.cpp
exporters/gen_modules_placefile.cpp
exporters/gendrill_Excellon_writer.cpp
exporters/vrml_board.cpp
)
set( PCBNEW_AUTOROUTER_SRCS
autorouter/rect_placement/rect_placement.cpp
autorouter/move_and_route_event_functions.cpp
@ -159,6 +172,7 @@ set( PCBNEW_CLASS_SRCS
deltrack.cpp
${PCBNEW_DIALOGS}
${PCBNEW_IMPORT_DXF}
${PCBNEW_EXPORTERS}
dragsegm.cpp
drc.cpp
drc_clearance_test_functions.cpp
@ -173,21 +187,12 @@ set( PCBNEW_CLASS_SRCS
edit_track_width.cpp
edtxtmod.cpp
event_handlers_tracks_vias_sizes.cpp
export_d356.cpp
export_gencad.cpp
export_idf.cpp
export_vrml.cpp
vrml_board.cpp
files.cpp
gen_drill_report_files.cpp
gen_modules_placefile.cpp
gendrill_Excellon_writer.cpp
globaleditpad.cpp
highlight.cpp
hotkeys.cpp
hotkeys_board_editor.cpp
hotkeys_module_editor.cpp
idf.cpp
initpcb.cpp
layer_widget.cpp
librairi.cpp

View File

@ -43,7 +43,6 @@
#include <trigo.h>
#include <pcbnew.h>
#include <protos.h>
#include <class_board.h>
#include <class_track.h>

View File

@ -46,8 +46,6 @@
#include <class_board.h>
#include <class_pcb_text.h>
#include <protos.h>
TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
BOARD_ITEM( parent, PCB_TEXT_T ),

View File

@ -22,18 +22,16 @@
#include <collectors.h>
#include <pcbnew.h>
#include <protos.h>
/**
* Read a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* @param cmdline = received command from Eeschema
/* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER
* cmdline = received command from Eeschema
* Commands are
* $PART: "reference" put cursor on component
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
*/
void RemoteCommand( const char* cmdline )
void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
{
char line[1024];
wxString msg;
@ -41,8 +39,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd;
char* text;
MODULE* module = 0;
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*)wxGetApp().GetTopWindow();
BOARD* pcb = frame->GetBoard();
BOARD* pcb = GetBoard();
wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 );
@ -57,14 +54,14 @@ void RemoteCommand( const char* cmdline )
{
modName = FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName );
module = pcb->FindModuleByReference( modName );
if( module )
msg.Printf( _( "%s found" ), GetChars( modName ) );
else
msg.Printf( _( "%s not found" ), GetChars( modName ) );
frame->SetStatusText( msg );
SetStatusText( msg );
if( module )
pos = module->GetPosition();
@ -114,21 +111,21 @@ void RemoteCommand( const char* cmdline )
else if( pad == NULL )
{
msg.Printf( _( "%s pin %s not found" ), GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( module );
SetCurItem( module );
}
else
{
msg.Printf( _( "%s pin %s found" ), GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( pad );
SetCurItem( pad );
}
frame->SetStatusText( msg );
SetStatusText( msg );
}
if( module ) // if found, center the module on screen, and redraw the screen.
{
frame->SetCrossHairPosition( pos );
frame->RedrawScreen( pos, false );
SetCrossHairPosition( pos );
RedrawScreen( pos, false );
}
}

View File

@ -36,7 +36,6 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <protos.h>
#include <dialog_find_base.h>

View File

@ -42,7 +42,6 @@
#include <base_units.h>
#include <wx/dcbuffer.h>
#include <protos.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -40,7 +40,6 @@
#include <class_zone.h>
#include <pcbnew.h>
#include <protos.h>
#include <drc_stuff.h>
#include <dialog_drc.h>

View File

@ -36,7 +36,6 @@
#include <trigo.h>
#include <pcbnew.h>
#include <protos.h>
#include <drc_stuff.h>
#include <class_board.h>

View File

@ -42,7 +42,6 @@
#include <pcbnew_id.h>
#include <pcbnew.h>
#include <module_editor_frame.h>
#include <protos.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -43,7 +43,6 @@
#include <pcbnew.h>
#include <drc_stuff.h>
#include <protos.h>
bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
@ -312,17 +311,3 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
}
}
void PCB_EDIT_FRAME::HighlightUnconnectedPads( wxDC* DC )
{
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
{
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
if( (net->m_Status & CH_ACTIF) == 0 )
continue;
net->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
net->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
}
}

View File

@ -170,7 +170,6 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
HighLight( DC );
}
return netcode; // HitTest() failed.
}
@ -184,3 +183,17 @@ void PCB_EDIT_FRAME::HighLight( wxDC* DC )
GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() );
}
void PCB_EDIT_FRAME::HighlightUnconnectedPads( wxDC* DC )
{
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
{
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
if( (net->m_Status & CH_ACTIF) == 0 )
continue;
net->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
net->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
}
}

View File

@ -39,7 +39,6 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <protos.h>
/* How to add a new hotkey:
* see hotkeys.cpp

View File

@ -12,7 +12,6 @@
#include <class_board_design_settings.h>
#include <hotkeys.h>
#include <protos.h>
/* How to add a new hotkey:
* See hotkeys.cpp

View File

@ -32,7 +32,6 @@
#include <appl_wxstruct.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <protos.h>
#include <hotkeys.h>
#include <pcbnew_id.h>

View File

@ -44,7 +44,6 @@
#include <drc_stuff.h>
#include <drag.h>
#include <pcbnew_id.h>
#include <protos.h>
static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,

View File

@ -48,7 +48,6 @@
#include <class_module.h>
#include <class_edge_mod.h>
#include <protos.h>
#include <pcbnew.h>

View File

@ -11,8 +11,6 @@
#include <pcbnew_id.h>
#include <kicad_device_context.h>
#include <protos.h>
/* Handle microwave commands.
*/

View File

@ -43,7 +43,6 @@
#include <fp_lib_table.h>
#include <pcbnew.h>
#include <protos.h>
#include <pcbnew_id.h>
#include <drc_stuff.h>
#include <layer_widget.h>

View File

@ -227,10 +227,7 @@ bool EDA_APP::OnInit()
SetTopWindow( frame );
frame->Show( true );
if( CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
{
SetupServerFunction( RemoteCommand );
}
CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER );
frame->Zoom_Automatique( true );

View File

@ -39,7 +39,6 @@
#include <class_zone.h>
#include <pcbnew.h>
#include <protos.h>
#include <pcbplot.h>
#include <module_editor_frame.h>

View File

@ -54,6 +54,7 @@ class MODULE;
* @param nbsegment Number of segments in list
* @param mode_color Drawing mode (GRXOR, GROR ..)
*/
void DrawTraces( EDA_DRAW_PANEL* panel,
wxDC* DC,
TRACK* aStartTrace,
@ -71,8 +72,6 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
*/
void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy );
void RemoteCommand( const char* cmdline );
/**
* Finds the projection of a grid point on a track. This is the point
* from where we want to draw new orthogonal tracks when starting on a track.

View File

@ -43,7 +43,6 @@
#include <pcbnew.h>
#include <module_editor_frame.h>
#include <pcbplot.h>
#include <protos.h>
#include <wx/overlay.h>