diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d9db1376d2..d14f8eab7e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,18 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2010-apr-16, UPDATE Jean-Pierre Charras +================================================================================ +++Cvpcb: + Fixed a bug in footprint display frame (coordinates not displayed). Windows only. + Added right toolbar to select display options + Can now read netlists using UTF8 encoding. + Convert dialog_display_option from DialogBlocks to wxFormBuilder +++Pcbnew: + Fixed a very minor bug. +Cvpcb+Pcbnew: + Code cleanup in read netlist functions: use now FILE_LINE_READER. + 2010-Apr-12 UPDATE Dick Hollenbeck ================================================================================ ++all: diff --git a/common/build_version.cpp b/common/build_version.cpp index 0b6e20f0b4..1da0f1f8fb 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -6,7 +6,7 @@ #endif #ifndef KICAD_BUILD_VERSION -#define KICAD_BUILD_VERSION "(2010-04-08 SVN 25xx)" +#define KICAD_BUILD_VERSION "(2010-04-13 BZR 23xx)" #endif #define VERSION_STABILITY "unstable" diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 6f3a7a2676..e7b5ced47e 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -28,6 +28,7 @@ set(CVPCB_SRCS dialog_cvpcb_config.cpp dialog_cvpcb_config_fbp.cpp dialog_display_options.cpp + dialog_display_options_base.cpp dummy_functions.cpp genequiv.cpp init.cpp diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 772d15a131..283068d81f 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -30,6 +30,14 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, WinEDA_BasePcbFrame ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, DISPLAY_FOOTPRINTS_FRAME::OnZoom ) EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SELECT_UNIT_INCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SELECT_UNIT_MM, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) END_EVENT_TABLE() @@ -45,6 +53,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father, size, style ) { m_FrameName = wxT( "CmpFrame" ); + m_Draw_Axis = true; // TRUE to draw axis. // Give an icon #ifdef __WINDOWS__ @@ -58,7 +67,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father, SetBaseScreen( new PCB_SCREEN() ); LoadSettings(); - // Internalize grid id to a default value if not found in config or bad: + // Initialize grid id to a default value if not found in config or bad: if( (m_LastGridSizeId <= 0) || (m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000; @@ -73,6 +82,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father, SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); ReCreateHToolbar(); ReCreateVToolbar(); + ReCreateOptToolbar(); m_auimgr.SetManagedWindow( this ); @@ -103,6 +113,9 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father, m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); + m_auimgr.AddPane( m_OptionsToolBar, + wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() ); + m_auimgr.Update(); Show( TRUE ); @@ -142,6 +155,57 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar() } +void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() +{ + if( m_OptionsToolBar ) + return; + + // Create options tool bar. + m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, + ID_OPT_TOOLBAR, FALSE ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, + wxBitmap( grid_xpm ), + _( "Hide grid" ), wxITEM_CHECK ); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,IsGridVisible() ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, + wxBitmap( polar_coord_xpm ), + _( "Display Polar Coord ON" ), wxITEM_CHECK ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, + wxBitmap( unit_inch_xpm ), + _( "Units in inches" ), wxITEM_CHECK ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, + wxBitmap( unit_mm_xpm ), + _( "Units in millimeters" ), wxITEM_CHECK ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, + wxBitmap( cursor_shape_xpm ), + _( "Change Cursor Shape" ), wxITEM_CHECK ); + + m_OptionsToolBar->AddSeparator(); + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, + wxBitmap( pad_sketch_xpm ), + _( "Show Pads Sketch" ), wxITEM_CHECK ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + wxEmptyString, + wxBitmap( text_sketch_xpm ), + _( "Show Texts Sketch" ), wxITEM_CHECK ); + + m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + wxEmptyString, + wxBitmap( show_mod_edge_xpm ), + _( "Show Edges Sketch" ), wxITEM_CHECK ); + + m_OptionsToolBar->Realize(); + + SetToolbars(); +} + + void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() { if( m_HToolBar != NULL ) @@ -149,8 +213,6 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - SetToolBar( (wxToolBar*) m_HToolBar ); - m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, wxBitmap( display_options_xpm ), _( "Display Options" ) ); @@ -186,6 +248,69 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() void DISPLAY_FOOTPRINTS_FRAME::SetToolbars() { + if( m_OptionsToolBar ) + { + m_OptionsToolBar->ToggleTool( + ID_TB_OPTIONS_SELECT_UNIT_MM, + g_UnitMetric == + MILLIMETRE ? TRUE : false ); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, + g_UnitMetric == INCHES ? TRUE : false ); + + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, + DisplayOpt.DisplayPolarCood ); + m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD, + DisplayOpt.DisplayPolarCood ? + _( "Display rectangular coordinates" ) : + _( "Display polar coordinates" ) ); + + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, + IsGridVisible( ) ); + m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, + IsGridVisible( ) ? + _( "Hide grid" ) : + _( "Show grid" ) ); + + + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, + m_CursorShape ); + + + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, + !m_DisplayPadFill ); + m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH, + m_DisplayPadFill ? + _( "Show pads in sketch mode" ) : + _( "Show pads in filled mode" ) ); + + wxString msgTextsFill[3] = + {_( "Show texts in line mode" ), + _( "Show texts in filled mode" ), + _( "Show texts in sketch mode" ) + }; + unsigned idx = m_DisplayModText+1; + if ( idx > 2 ) + idx = 0; + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + m_DisplayModText == 0 ); + m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + msgTextsFill[idx] ); + + wxString msgEdgesFill[3] = + {_( "Show outlines in line mode" ), + _( "Show outlines in filled mode" ), + _( "Show outlines in sketch mode" ) + }; + idx = m_DisplayModEdge+1; + if ( idx > 2 ) + idx = 0; + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + m_DisplayModEdge == 0 ); + m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + msgEdgesFill[idx] ); + + m_OptionsToolBar->Refresh(); + } } @@ -205,6 +330,65 @@ bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, return true; } +void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) +{ + int id = event.GetId(); + + switch( id ) + { + case ID_TB_OPTIONS_SHOW_GRID: + SetGridVisibility( m_OptionsToolBar->GetToolState( id ) ); + DrawPanel->Refresh( ); + break; + + case ID_TB_OPTIONS_SELECT_UNIT_MM: + g_UnitMetric = MILLIMETRE; + UpdateStatusBar(); + break; + + case ID_TB_OPTIONS_SELECT_UNIT_INCH: + g_UnitMetric = INCHES; + UpdateStatusBar(); + break; + + case ID_TB_OPTIONS_SHOW_POLAR_COORD: + Affiche_Message( wxEmptyString ); + DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id ); + UpdateStatusBar(); + break; + + case ID_TB_OPTIONS_SELECT_CURSOR: + m_CursorShape = m_OptionsToolBar->GetToolState( id ); + DrawPanel->Refresh( ); + break; + + case ID_TB_OPTIONS_SHOW_PADS_SKETCH: + m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id ); + DrawPanel->Refresh( ); + break; + + case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: + m_DisplayModText++; + if( m_DisplayModText > 2 ) + m_DisplayModText = 0; + DrawPanel->Refresh( ); + break; + + case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: + m_DisplayModEdge++; + if( m_DisplayModEdge > 2 ) + m_DisplayModEdge = 0; + DrawPanel->Refresh( ); + break; + + default: + DisplayError( this, + wxT( "DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar error" ) ); + break; + } + + SetToolbars(); +} void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse ) { @@ -356,7 +540,7 @@ void PCB_SCREEN::ClearUndoORRedoList(UNDO_REDO_CONTAINER&, int ) */ bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible() { - return true; + return m_DrawGrid; } /** Function SetGridVisibility() , virtual @@ -366,7 +550,7 @@ bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible() */ void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible) { - // Currently do nothing because there is no option to hide/show grid + m_DrawGrid = aVisible; } /** Function GetGridColor() , virtual diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h index f98fb82e37..5e55298632 100644 --- a/cvpcb/class_DisplayFootprintsFrame.h +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -21,8 +21,11 @@ public: void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void ReCreateHToolbar(); void ReCreateVToolbar(); + void ReCreateOptToolbar(); void RecreateMenuBar(); + void OnSelectOptionToolbar( wxCommandEvent& event ); + /** Function IsGridVisible() , virtual * @return true if the grid must be shown */ diff --git a/cvpcb/dialog_display_options.cpp b/cvpcb/dialog_display_options.cpp index 0dc04f17a5..197af46b93 100644 --- a/cvpcb/dialog_display_options.cpp +++ b/cvpcb/dialog_display_options.cpp @@ -1,306 +1,76 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: dialog_display_options.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 17/02/2006 17:47:55 -// RCS-ID: -// Copyright: License GNU -// Licence: +// Licence: GPL ///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 17/02/2006 17:47:55 - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "dialog_display_options.h" -#endif - -////@begin includes -////@end includes #include "fctsys.h" #include "wxstruct.h" #include "common.h" #include "cvpcb.h" -#include "protos.h" +//#include "protos.h" #include "class_drawpanel.h" #include "cvstruct.h" #include "class_DisplayFootprintsFrame.h" #include "dialog_display_options.h" -////@begin XPM images -////@end XPM images - void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event ) { - WinEDA_FootprintDisplayOptionsFrame* OptionWindow = - new WinEDA_FootprintDisplayOptionsFrame( this ); + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS* OptionWindow = + new DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( this ); OptionWindow->ShowModal(); OptionWindow->Destroy(); } -/*! - * WinEDA_FootprintDisplayOptionsFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_FootprintDisplayOptionsFrame, wxDialog ) - -/*! - * WinEDA_FootprintDisplayOptionsFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_FootprintDisplayOptionsFrame, wxDialog ) - -////@begin WinEDA_FootprintDisplayOptionsFrame event table entries - EVT_BUTTON( wxID_OK, WinEDA_FootprintDisplayOptionsFrame::OnOkClick ) - - EVT_BUTTON( wxID_CANCEL, WinEDA_FootprintDisplayOptionsFrame::OnCancelClick ) - - EVT_BUTTON( wxID_APPLY, WinEDA_FootprintDisplayOptionsFrame::OnApplyClick ) - -////@end WinEDA_FootprintDisplayOptionsFrame event table entries - -END_EVENT_TABLE() - -/*! - * WinEDA_FootprintDisplayOptionsFrame constructors - */ - -WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame() -{ -} - - -WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame( - WinEDA_BasePcbFrame* parent, - wxWindowID id, - const wxString& caption, - const wxPoint& pos, - const wxSize& size, - long style ) +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( + WinEDA_BasePcbFrame* parent ) + : DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent) { m_Parent = parent; - Create( parent, id, caption, pos, size, style ); -} + initDialog( ); + GetSizer()->SetSizeHints( this ); - -/*! - * WinEDA_FootprintDisplayOptionsFrame creator - */ - -bool WinEDA_FootprintDisplayOptionsFrame::Create( wxWindow* parent, - wxWindowID id, - const wxString& caption, - const wxPoint& pos, - const wxSize& size, - long style ) -{ -////@begin WinEDA_FootprintDisplayOptionsFrame member initialisation - OuterBoxSizer = NULL; - MainBoxSizer = NULL; - m_EdgesDisplayOption = NULL; - m_TextDisplayOption = NULL; - ColumnBoxSizer = NULL; - m_IsShowPadFill = NULL; - m_IsShowViaFill = NULL; - m_IsShowPadNum = NULL; - m_CancelButton = NULL; - -////@end WinEDA_FootprintDisplayOptionsFrame member initialisation - -////@begin WinEDA_FootprintDisplayOptionsFrame creation - SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - if( GetSizer() ) - { - GetSizer()->SetSizeHints( this ); - } Centre(); +} -////@end WinEDA_FootprintDisplayOptionsFrame creation - return true; +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( ) +{ } /*! - * Control creation for WinEDA_FootprintDisplayOptionsFrame + * Control creation for DIALOG_FOOTPRINTS_DISPLAY_OPTIONS */ -void WinEDA_FootprintDisplayOptionsFrame::CreateControls() +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() { -////@begin WinEDA_FootprintDisplayOptionsFrame content construction - // Generated by DialogBlocks, 16/04/2009 14:23:49 (unregistered) + /* mandatory to use escape key as cancel under wxGTK. */ + SetFocus(); - WinEDA_FootprintDisplayOptionsFrame* itemDialog1 = this; - - OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); - itemDialog1->SetSizer( OuterBoxSizer ); - - MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxALL, 5 ); - - wxArrayString m_EdgesDisplayOptionStrings; - m_EdgesDisplayOptionStrings.Add( _( "&Line" ) ); - m_EdgesDisplayOptionStrings.Add( _( "&Filled" ) ); - m_EdgesDisplayOptionStrings.Add( _( "&Sketch" ) ); - m_EdgesDisplayOption = - new wxRadioBox( itemDialog1, EDGE_SELECT, _( "Edges:" ), - wxDefaultPosition, wxDefaultSize, - m_EdgesDisplayOptionStrings, - 1, wxRA_SPECIFY_COLS ); - m_EdgesDisplayOption->SetSelection( 0 ); - MainBoxSizer->Add( m_EdgesDisplayOption, 0, wxALIGN_TOP | wxALL, 5 ); - - wxArrayString m_TextDisplayOptionStrings; - m_TextDisplayOptionStrings.Add( _( "&Line" ) ); - m_TextDisplayOptionStrings.Add( _( "&Filled" ) ); - m_TextDisplayOptionStrings.Add( _( "&Sketch" ) ); - m_TextDisplayOption = - new wxRadioBox( itemDialog1, TEXT_SELECT, _( "Texts:" ), - wxDefaultPosition, wxDefaultSize, - m_TextDisplayOptionStrings, 1, - wxRA_SPECIFY_COLS ); - m_TextDisplayOption->SetSelection( 0 ); - MainBoxSizer->Add( m_TextDisplayOption, 0, wxALIGN_TOP | wxALL, 5 ); - - ColumnBoxSizer = new wxBoxSizer( wxVERTICAL ); - MainBoxSizer->Add( ColumnBoxSizer, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); - - m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, - _( "Fill &pad" ), wxDefaultPosition, - wxDefaultSize, wxCHK_2STATE ); - m_IsShowPadFill->SetValue( false ); - ColumnBoxSizer->Add( m_IsShowPadFill, 1, wxGROW | wxALL, 5 ); - - m_IsShowViaFill = new wxCheckBox( itemDialog1, VIAFILL_OPT, - _( "Fill &via" ), wxDefaultPosition, - wxDefaultSize, wxCHK_2STATE ); - m_IsShowViaFill->SetValue( false ); - ColumnBoxSizer->Add( m_IsShowViaFill, 1, wxGROW | wxALL, 5 ); - - m_IsShowPadNum = - new wxCheckBox( itemDialog1, PADNUM_OPT, _( "Show pad &number" ), - wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_IsShowPadNum->SetValue( false ); - if( WinEDA_FootprintDisplayOptionsFrame::ShowToolTips() ) - m_IsShowPadNum->SetToolTip( _( "Display pad number" ) ); - ColumnBoxSizer->Add( m_IsShowPadNum, 1, wxGROW | wxALL, 5 ); - - wxStaticLine* itemStaticLine9 = new wxStaticLine( itemDialog1, - ID_STATICLINE1, - wxDefaultPosition, - wxDefaultSize, - wxLI_HORIZONTAL ); - OuterBoxSizer->Add( itemStaticLine9, 0, wxGROW | wxALL, 5 ); - - wxStdDialogButtonSizer* itemStdDialogButtonSizer10 = - new wxStdDialogButtonSizer; - - OuterBoxSizer->Add( itemStdDialogButtonSizer10, - 0, - wxALIGN_CENTER_HORIZONTAL | wxALL, - 5 ); - wxButton* itemButton11 = new wxButton( itemDialog1, wxID_OK, _( "&OK" ), - wxDefaultPosition, - wxDefaultSize, 0 ); - itemStdDialogButtonSizer10->AddButton( itemButton11 ); - - m_CancelButton = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ), - wxDefaultPosition, wxDefaultSize, 0 ); - itemStdDialogButtonSizer10->AddButton( m_CancelButton ); - - wxButton* itemButton13 = - new wxButton( itemDialog1, wxID_APPLY, _( "&Apply" ), - wxDefaultPosition, wxDefaultSize, 0 ); - itemStdDialogButtonSizer10->AddButton( itemButton13 ); - - itemStdDialogButtonSizer10->Realize(); - - // Set validators - m_EdgesDisplayOption->SetValidator( wxGenericValidator( &DisplayOpt. - DisplayModEdge ) ); - m_TextDisplayOption->SetValidator( wxGenericValidator( &DisplayOpt. - DisplayModText ) ); - m_IsShowPadFill->SetValidator( wxGenericValidator( &DisplayOpt. - DisplayPadFill ) ); - m_IsShowViaFill->SetValidator( wxGenericValidator( &DisplayOpt. - DisplayViaFill ) ); - m_IsShowPadNum->SetValidator( wxGenericValidator( &DisplayOpt. - DisplayPadNum ) ); - -////@end WinEDA_FootprintDisplayOptionsFrame content construction - - /* Necessary to use escape key as cancel under wxGTK. */ - m_CancelButton->SetFocus(); + m_EdgesDisplayOption->SetSelection( m_Parent->m_DisplayModEdge ); + m_TextDisplayOption->SetSelection( m_Parent->m_DisplayModText ); + m_IsShowPadFill->SetValue( m_Parent->m_DisplayPadFill ); + m_IsShowPadNum->SetValue( m_Parent->m_DisplayPadNum ); } -/*! - * Should we show tooltips? - */ - -bool WinEDA_FootprintDisplayOptionsFrame::ShowToolTips() -{ - return true; -} - - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_FootprintDisplayOptionsFrame::GetBitmapResource( - const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_FootprintDisplayOptionsFrame bitmap retrieval - wxUnusedVar( name ); - return wxNullBitmap; - -////@end WinEDA_FootprintDisplayOptionsFrame bitmap retrieval -} - - -/*! - * Get icon resources - */ - -wxIcon WinEDA_FootprintDisplayOptionsFrame::GetIconResource( - const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_FootprintDisplayOptionsFrame icon retrieval - wxUnusedVar( name ); - return wxNullIcon; - -////@end WinEDA_FootprintDisplayOptionsFrame icon retrieval -} - /*! * Update settings related to edges, text strings, and pads */ -void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings( void ) +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) { - // Update settings -////@begin WinEDA_FootprintDisplayOptionsFrame update settings m_Parent->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection(); m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); - m_Parent->m_DisplayViaFill = m_IsShowViaFill->GetValue(); + m_Parent->SetToolbars(); m_Parent->DrawPanel->Refresh(); - -////@end WinEDA_FootprintDisplayOptionsFrame update settings } @@ -308,7 +78,7 @@ void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings( void ) * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ -void WinEDA_FootprintDisplayOptionsFrame::OnOkClick( wxCommandEvent& event ) +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnOkClick( wxCommandEvent& event ) { UpdateObjectSettings(); EndModal( 1 ); @@ -319,7 +89,7 @@ void WinEDA_FootprintDisplayOptionsFrame::OnOkClick( wxCommandEvent& event ) * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ -void WinEDA_FootprintDisplayOptionsFrame::OnCancelClick( wxCommandEvent& event ) +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event ) { EndModal( -1 ); } @@ -329,7 +99,7 @@ void WinEDA_FootprintDisplayOptionsFrame::OnCancelClick( wxCommandEvent& event ) * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY */ -void WinEDA_FootprintDisplayOptionsFrame::OnApplyClick( wxCommandEvent& event ) +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event ) { UpdateObjectSettings(); } diff --git a/cvpcb/dialog_display_options.h b/cvpcb/dialog_display_options.h index 29937cfcb1..b2d4c90806 100644 --- a/cvpcb/dialog_display_options.h +++ b/cvpcb/dialog_display_options.h @@ -1,129 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////// // Name: dialog_display_options.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 17/02/2006 17:47:55 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 17/02/2006 17:47:55 +// Licence: GPL +//////////////////////////////////////////// #ifndef _DIALOG_DISPLAY_OPTIONS_H_ #define _DIALOG_DISPLAY_OPTIONS_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "dialog_display_options.h" -#endif +#include "dialog_display_options_base.h" -/*! - * Includes - */ +//////////////////////////////////////////// +/// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS +// derived from DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE, +// created by wxformBuilder +//////////////////////////////////////////// -////@begin includes -#include "wx/valgen.h" -#include "wx/statline.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxBoxSizer; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define EDGE_SELECT 10001 -#define TEXT_SELECT 10002 -#define PADFILL_OPT 10003 -#define PADNUM_OPT 10004 -#define VIAFILL_OPT 10005 -#define ID_STATICLINE1 10006 -#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER -#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_TITLE _("Display Options") -#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_FootprintDisplayOptionsFrame class declaration - */ - -class WinEDA_FootprintDisplayOptionsFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_FootprintDisplayOptionsFrame ) - DECLARE_EVENT_TABLE() +class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS : + public DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE +{ +private: +WinEDA_BasePcbFrame * m_Parent; public: - /// Constructors - WinEDA_FootprintDisplayOptionsFrame( ); - WinEDA_FootprintDisplayOptionsFrame( WinEDA_BasePcbFrame* parent, wxWindowID id = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_SIZE, long style = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_STYLE ); + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( WinEDA_BasePcbFrame* parent ); + ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(); - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_SIZE, long style = SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_FootprintDisplayOptionsFrame event handler declarations - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - void OnOkClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - void OnCancelClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY - void OnApplyClick( wxCommandEvent& event ); - -////@end WinEDA_FootprintDisplayOptionsFrame event handler declarations - -////@begin WinEDA_FootprintDisplayOptionsFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_FootprintDisplayOptionsFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - - void UpdateObjectSettings(void); - -////@begin WinEDA_FootprintDisplayOptionsFrame member variables - wxBoxSizer* OuterBoxSizer; - wxBoxSizer* MainBoxSizer; - wxRadioBox* m_EdgesDisplayOption; - wxRadioBox* m_TextDisplayOption; - wxBoxSizer* ColumnBoxSizer; - wxCheckBox* m_IsShowPadFill; - wxCheckBox* m_IsShowViaFill; - wxCheckBox* m_IsShowPadNum; - wxButton* m_CancelButton; -////@end WinEDA_FootprintDisplayOptionsFrame member variables - - WinEDA_BasePcbFrame * m_Parent; +private: + void initDialog( ); + void UpdateObjectSettings( void ); + virtual void OnApplyClick( wxCommandEvent& event ); + virtual void OnCancelClick( wxCommandEvent& event ); + virtual void OnOkClick( wxCommandEvent& event ); }; -#endif - // _DIALOG_DISPLAY_OPTIONS_H_ +#endif // _DIALOG_DISPLAY_OPTIONS_H_ diff --git a/cvpcb/dialog_display_options.pjd b/cvpcb/dialog_display_options.pjd deleted file mode 100644 index c5a0e4e23e..0000000000 --- a/cvpcb/dialog_display_options.pjd +++ /dev/null @@ -1,937 +0,0 @@ - - -
- 0 - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - "jean-pierre Charras" - "License GNU" - "" - 0 - 0 - 0 - "<All platforms>" - "<Any>" - "///////////////////////////////////////////////////////////////////////////// -// Name: %HEADER-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SOURCE-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SYMBOLS-FILENAME% -// Purpose: Symbols file -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "%HEADER-FILENAME%" -#endif - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "%HEADER-FILENAME%" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -" - " /// %BODY% -" - " -/*! - * %BODY% - */ - -" - "app_resources.h" - "app_resources.cpp" - "AppResources" - "app.h" - "app.cpp" - "Application" - 0 - "" - "<None>" - "<System>" - "utf-8" - "<System>" - "" - 0 - 0 - 4 - " " - "" - 0 - 0 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 -
- - - "" - "data-document" - "" - "" - 0 - 1 - 0 - 0 - - "Configurations" - "config-data-document" - "" - "" - 0 - 1 - 0 - 0 - "" - 1 - -8519680 - "" - "Debug" - "ANSI" - "Static" - "Modular" - "GUI" - "wxMSW" - "Dynamic" - "Yes" - "No" - "No" - "%WXVERSION%" - "%EXECUTABLE%" - "" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - 0 - 1 - "" - - - - - - - "Projects" - "root-document" - "" - "project" - 1 - 1 - 0 - 1 - - "Windows" - "html-document" - "" - "dialogsfolder" - 1 - 1 - 0 - 1 - - "Display Options" - "dialog-document" - "" - "dialog" - 0 - 1 - 0 - 0 - "17/6/2006" - "wbDialogProxy" - 10000 - 0 - "" - 0 - "" - 0 - 0 - "ID_DIALOG" - 10000 - "WinEDA_FootprintDisplayOptionsFrame" - "wxDialog" - "wxDialog" - "dialog_display_options.cpp" - "dialog_display_options.h" - "" - "Display Options" - 1 - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "Tiled" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - "MAYBE_RESIZE_BORDER" - 0 - 1 - -1 - -1 - 400 - 300 - 0 - "" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbBoxSizerProxy" - "Vertical" - "OuterBoxSizer" - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbBoxSizerProxy" - "Horizontal" - "MainBoxSizer" - "Expand" - "Centre" - 1 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxRadioBox: EDGE_SELECT" - "dialog-control-document" - "" - "radiobox" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbRadioBoxProxy" - "EDGE_SELECT" - 10001 - "" - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_EdgesDisplayOption" - "Edges:" - 1 - "&Line|&Filled|&Sketch" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "DisplayOpt.DisplayModEdge" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Top" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioBox: TEXT_SELECT" - "dialog-control-document" - "" - "radiobox" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbRadioBoxProxy" - "TEXT_SELECT" - 10002 - "" - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_TextDisplayOption" - "Texts:" - 1 - "&Line|&Filled|&Sketch" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "DisplayOpt.DisplayModText" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Top" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbBoxSizerProxy" - "Vertical" - "ColumnBoxSizer" - "Centre" - "Centre" - 1 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxCheckBox: PADFILL_OPT" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbCheckBoxProxy" - "PADFILL_OPT" - 10003 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_IsShowPadFill" - "Fill &pad" - 0 - "" - "" - "DisplayOpt.DisplayPadFill" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 1 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: PADNUM_OPT" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbCheckBoxProxy" - "PADNUM_OPT" - 10004 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_IsShowPadNum" - "Show pad &number" - 0 - "" - "Display pad number" - "DisplayOpt.DisplayPadNum" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 1 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - "wxStaticLine: ID_STATICLINE1" - "dialog-control-document" - "" - "staticline" - 0 - 1 - 0 - 0 - "24/10/2007" - "wbStaticLineProxy" - "ID_STATICLINE1" - 10006 - "" - "wxStaticLine" - "wxStaticLine" - 1 - 0 - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - - "wxStdDialogButtonSizer" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "wbStdDialogButtonSizerProxy" - 1 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - "" - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxButton: wxID_OK" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 1 - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick|NONE||WinEDA_FootprintDisplayOptionsFrame" - "wxID_OK" - 5100 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "&OK" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: wxID_CANCEL" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 1 - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|NONE||WinEDA_FootprintDisplayOptionsFrame" - "wxID_CANCEL" - 5101 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_CancelButton" - "&Cancel" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: wxID_APPLY" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 1 - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnApplyClick|NONE||WinEDA_FootprintDisplayOptionsFrame" - "wxID_APPLY" - 5102 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "&Apply" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - - - "Sources" - "html-document" - "" - "sourcesfolder" - 1 - 1 - 0 - 1 - - "dialog_display_options.rc" - "source-editor-document" - "dialog_display_options.rc" - "source-editor" - 0 - 0 - 1 - 0 - "17/6/2006" - "" - - - - "Images" - "html-document" - "" - "bitmapsfolder" - 1 - 1 - 0 - 1 - - - - -
diff --git a/cvpcb/dialog_display_options.rc b/cvpcb/dialog_display_options.rc deleted file mode 100644 index b86c4e2265..0000000000 --- a/cvpcb/dialog_display_options.rc +++ /dev/null @@ -1 +0,0 @@ -#include "wx/msw/wx.rc" diff --git a/cvpcb/dialog_display_options_base.cpp b/cvpcb/dialog_display_options_base.cpp new file mode 100644 index 0000000000..1cff3e15d6 --- /dev/null +++ b/cvpcb/dialog_display_options_base.cpp @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_display_options_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxString m_EdgesDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; + int m_EdgesDisplayOptionNChoices = sizeof( m_EdgesDisplayOptionChoices ) / sizeof( wxString ); + m_EdgesDisplayOption = new wxRadioBox( this, ID_EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionNChoices, m_EdgesDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); + m_EdgesDisplayOption->SetSelection( 0 ); + bUpperSizer->Add( m_EdgesDisplayOption, 1, wxALL|wxEXPAND, 5 ); + + wxString m_TextDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; + int m_TextDisplayOptionNChoices = sizeof( m_TextDisplayOptionChoices ) / sizeof( wxString ); + m_TextDisplayOption = new wxRadioBox( this, ID_TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionNChoices, m_TextDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); + m_TextDisplayOption->SetSelection( 0 ); + bUpperSizer->Add( m_TextDisplayOption, 1, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pads:") ), wxVERTICAL ); + + m_IsShowPadFill = new wxCheckBox( this, ID_PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer1->Add( m_IsShowPadFill, 0, wxALL|wxEXPAND, 5 ); + + m_IsShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer1->Add( m_IsShowPadNum, 0, wxALL|wxEXPAND, 5 ); + + bUpperSizer->Add( sbSizer1, 1, wxEXPAND|wxALL, 5 ); + + bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Apply = new wxButton( this, wxID_APPLY ); + m_sdbSizer1->AddButton( m_sdbSizer1Apply ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizerMain ); + this->Layout(); + + // Connect Events + m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE() +{ + // Disconnect Events + m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); +} diff --git a/cvpcb/dialog_display_options_base.fbp b/cvpcb/dialog_display_options_base.fbp new file mode 100644 index 0000000000..f386ea182e --- /dev/null +++ b/cvpcb/dialog_display_options_base.fbp @@ -0,0 +1,393 @@ + + + + + + C++ + 1 + UTF-8 + connect + dialog_display_options_base + 1000 + none + 1 + dialog_display_options_base + + . + + 1 + 0 + 0 + + + + + 1 + + + + 0 + wxID_ANY + + + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE + + 331,164 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Display Options + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bUpperSizer + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 1 + + + "Line" "Filled" "Sketch" + + 1 + + + 0 + ID_EDGE_SELECT + Edges: + 1 + + + m_EdgesDisplayOption + protected + + 0 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + "Line" "Filled" "Sketch" + + 1 + + + 0 + ID_TEXT_SELECT + Texts: + 1 + + + m_TextDisplayOption + protected + + 0 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Pads: + + sbSizer1 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + + 0 + + 1 + + + 0 + ID_PADFILL_OPT + Fill &pad + + + m_IsShowPadFill + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Show pad &number + + + m_IsShowPadNum + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline1 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + OnApplyClick + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/cvpcb/dialog_display_options_base.h b/cvpcb/dialog_display_options_base.h new file mode 100644 index 0000000000..b1d5b33f55 --- /dev/null +++ b/cvpcb/dialog_display_options_base.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_display_options_base__ +#define __dialog_display_options_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define ID_EDGE_SELECT 1000 +#define ID_TEXT_SELECT 1001 +#define ID_PADFILL_OPT 1002 + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public wxDialog +{ + private: + + protected: + wxRadioBox* m_EdgesDisplayOption; + wxRadioBox* m_TextDisplayOption; + wxCheckBox* m_IsShowPadFill; + wxCheckBox* m_IsShowPadNum; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Apply; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnApplyClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 331,164 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); + +}; + +#endif //__dialog_display_options_base__ diff --git a/include/richio.h b/include/richio.h index d295de36c8..56d73fa34b 100644 --- a/include/richio.h +++ b/include/richio.h @@ -144,6 +144,18 @@ public: * @throw IOError only when a line is too long. */ int ReadLine() throw (IOError); + + /** + * Function Rewind + * a wrapper to the standard function rewind. + * also clear the current line number + */ + void Rewind() + { + rewind( fp ); + lineNum = 0; + } + }; diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 8ae3984d97..fd2badc482 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -845,6 +845,50 @@ public: // netlist handling: void InstallNetlistFrame( wxDC* DC, const wxPoint& pos ); + /** Function ReadPcbNetlist + * Update footprints (load missing footprints and delete on request extra + * footprints) + * Update connectivity info ( Net Name list ) + * Update Reference, value and "TIME STAMP" + * @param aNetlistFullFilename = netlist file name (*.net) + * @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, + * only the netlist will be used + * @return true if Ok + * + * the format of the netlist is something like: + # EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22 + * ( + * ( 40C08647 $noname R20 4,7K {Lib=R} + * ( 1 VCC ) + * ( 2 MODB_1 ) + * ) + * ( 40C0863F $noname R18 4,7_k {Lib=R} + * ( 1 VCC ) + * ( 2 MODA_1 ) + * ) + * } + * #End + */ + bool ReadPcbNetlist( + const wxString& aNetlistFullFilename, + const wxString& aCmpFullFileName, + wxTextCtrl* aMessageWindow, + bool aChangeFootprint, + bool aDeleteBadTracks, + bool aDeleteExtraFootprints, + bool aSelect_By_Timestamp ); + + /** Function RemoveMisConnectedTracks + * finds all track segments which are mis-connected (to more than one net). + * When such a bad segment is found, mark it as needing to be removed. + * and remove all tracks having at least one flagged segment. + * @param aDC = the current device context (can be NULL) + * @param aDisplayActivity = true to display activity on the frame status bar and message panel + * @return true if any change is made + */ + bool RemoveMisConnectedTracks( wxDC* aDC, bool aDisplayActivity ); + + // Autoplacement: void AutoPlace( wxCommandEvent& event ); @@ -926,7 +970,7 @@ public: * called on a language menu selection */ virtual void SetLanguage( wxCommandEvent& event ); - + DECLARE_EVENT_TABLE() }; diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 889e9fee39..b7d2b0f5e9 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -731,54 +731,57 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre } -/***************************************************************************/ -int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) -/***************************************************************************/ - -/** - * Function Netliste_Controle_piste +/** Function RemoveMisConnectedTracks * finds all track segments which are mis-connected (to more than one net). - * When such a bad segment is found, mark it as needing to be removed (supression). + * When such a bad segment is found, mark it as needing to be removed. + * and remove all tracks having at least one flagged segment. + * @param aDC = the current device context (can be NULL) + * @param aDisplayActivity = true to display activity on the frame status bar and message panel + * @return true if any change is made */ +bool WinEDA_PcbFrame::RemoveMisConnectedTracks( wxDC* aDC, bool aDisplayActivity ) { TRACK* segment; TRACK* other; TRACK* next; int net_code_s, net_code_e; int nbpoints_modifies = 0; - int flag = 0; + bool flag = false; wxString msg; int percent = 0; int oldpercent = -1; a_color = RED; - frame->Affiche_Message( _( "DRC Control:" ) ); + if( aDisplayActivity ) + Affiche_Message( _( "DRC Control:" ) ); - frame->DrawPanel->m_AbortRequest = FALSE; + DrawPanel->m_AbortRequest = FALSE; - if( affiche ) - Affiche_1_Parametre( frame, POS_AFF_VAR, _( "NetCtr" ), wxT( "0 " ), a_color ); + if( aDisplayActivity ) + Affiche_1_Parametre( this, POS_AFF_VAR, _( "NetCtr" ), wxT( "0 " ), a_color ); int ii = 0; - for( segment = frame->GetBoard()->m_Track; segment; segment = (TRACK*) segment->Next() ) + for( segment = GetBoard()->m_Track; segment; segment = (TRACK*) segment->Next() ) { - // display activity ii++; - percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); - if( percent != oldpercent ) + if( aDisplayActivity ) // display activity { - frame->DisplayActivity( percent, wxT( "Drc: " ) ); - oldpercent = percent; + percent = (100 * ii) / GetBoard()->m_Track.GetCount(); + if( percent != oldpercent ) + { + DisplayActivity( percent, wxT( "Drc: " ) ); + oldpercent = percent; - msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); - Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); + msg.Printf( wxT( "%d" ), GetBoard()->m_Track.GetCount() ); + Affiche_1_Parametre( this, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); - msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); - Affiche_1_Parametre( frame, POS_AFF_NUMSEGM, wxT( "Segm" ), msg, CYAN ); + msg.Printf( wxT( "%d" ), GetBoard()->m_Track.GetCount() ); + Affiche_1_Parametre( this, POS_AFF_NUMSEGM, wxT( "Segm" ), msg, CYAN ); - if( frame->DrawPanel->m_AbortRequest ) - return flag; + if( DrawPanel->m_AbortRequest ) + return flag; + } } segment->SetState( FLAG0, OFF ); @@ -792,7 +795,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) } else { - other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, + other = Locate_Piste_Connectee( segment, GetBoard()->m_Track, NULL, START ); if( other ) net_code_s = other->GetNet(); @@ -809,7 +812,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) } else { - other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, + other = Locate_Piste_Connectee( segment, GetBoard()->m_Track, NULL, END ); if( other ) net_code_e = other->GetNet(); @@ -826,7 +829,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) } // Removal of flagged segments - for( segment = frame->GetBoard()->m_Track; segment; segment = next ) + for( segment = GetBoard()->m_Track; segment; segment = next ) { next = (TRACK*) segment->Next(); @@ -834,18 +837,18 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) { segment->SetState( FLAG0, OFF ); - flag = 1; + flag = true; oldpercent = -1; - frame->GetBoard()->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; - frame->Remove_One_Track( DC, segment ); + Remove_One_Track( aDC, segment ); - next = frame->GetBoard()->m_Track; /* NextS a peut etre ete efface */ - if( affiche ) + next = GetBoard()->m_Track; /* the current segment can be deleted, so restart to the beginning */ + if( aDisplayActivity ) { nbpoints_modifies++; msg.Printf( wxT( "%d " ), nbpoints_modifies ); - Affiche_1_Parametre( frame, POS_AFF_VAR, wxEmptyString, msg, a_color ); + Affiche_1_Parametre( this, POS_AFF_VAR, wxEmptyString, msg, a_color ); } } } diff --git a/pcbnew/dialog_netlist.cpp b/pcbnew/dialog_netlist.cpp index 00ce199bda..b8d5f13001 100644 --- a/pcbnew/dialog_netlist.cpp +++ b/pcbnew/dialog_netlist.cpp @@ -12,15 +12,6 @@ #include "dialog_netlist.h" -extern void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, - const wxString& aNetlistFullFilename, - const wxString& aCmpFullFileName, - wxTextCtrl* aMessageWindow, - bool aChangeFootprint, - bool aDeleteBadTracks, - bool aDeleteExtraFootprints, - bool aSelect_By_Timestamp ); - extern void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* frame, const wxString& NetlistFullFilename, BOARD* Pcb ); @@ -83,7 +74,7 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) wxFileName fn = m_NetlistFilenameCtrl->GetValue(); fn.SetExt( NetCmpExtBuffer ); - ReadPcbNetlist( m_Parent, m_NetlistFilenameCtrl->GetValue(), + m_Parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(), fn.GetFullPath(), m_MessageWindow, m_ChangeExistingFootprintCtrl->GetSelection() == 1 ? TRUE : FALSE, m_DeleteBadTracks->GetSelection() == 1 ? TRUE : FALSE, diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 1d8d414f36..814d4af193 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -35,6 +35,7 @@ #include "gestfich.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "richio.h" #include "dialog_netlist.h" @@ -75,7 +76,7 @@ static void SortListModulesToLoadByLibname( int NbModules ); static int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename, wxArrayString& aBufName ); -static bool OpenNetlistFile( const wxString& aFullFileName ); +static FILE * OpenNetlistFile( const wxString& aFullFileName ); static void AddToList( const wxString& NameLibCmp, const wxString& NameCmp, const wxString& TimeStampPath ); @@ -100,28 +101,27 @@ static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame ); static int s_NbNewModules; static MODULEtoLOAD* s_ModuleToLoad_List; -FILE* source; +#define BUFFER_CHAR_SIZE 2048 /** function OpenNetlistFile * used to open a netlist file */ -bool OpenNetlistFile( const wxString& aFullFileName ) +FILE * OpenNetlistFile( const wxString& aFullFileName ) { if( aFullFileName.IsEmpty() ) return FALSE; /* No filename: exit */ - source = wxFopen( aFullFileName, wxT( "rt" ) ); - if( source == 0 ) + FILE * netfile = wxFopen( aFullFileName, wxT( "rt" ) ); + if( netfile == NULL ) { wxString msg; msg.Printf( _( "Netlist file %s not found" ), GetChars( aFullFileName ) ); DisplayError( NULL, msg ); - return FALSE; } - return true; + return netfile; } @@ -132,6 +132,7 @@ bool OpenNetlistFile( const wxString& aFullFileName ) * Update Reference, value and "TIME STAMP" * @param aNetlistFullFilename = netlist file name (*.net) * @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, + * @return true if Ok * only the netlist will be used * * the format of the netlist is something like: @@ -148,7 +149,7 @@ bool OpenNetlistFile( const wxString& aFullFileName ) * } * #End */ -void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, +bool WinEDA_PcbFrame::ReadPcbNetlist( const wxString& aNetlistFullFilename, const wxString& aCmpFullFileName, wxTextCtrl* aMessageWindow, @@ -157,15 +158,15 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, bool aDeleteExtraFootprints, bool aSelect_By_Timestamp ) { - int LineNum, State, Comment; + int State, Comment; MODULE* Module = NULL; D_PAD* PtPad; - char Line[256]; char* Text; int UseFichCmp = 1; - if( !OpenNetlistFile( aNetlistFullFilename ) ) - return; + FILE * netfile = OpenNetlistFile( aNetlistFullFilename ); + if( !netfile ) + return false; if( aMessageWindow ) { @@ -176,19 +177,21 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, } // Clear undo and redo lists to avoid inconsistencies between lists - aFrame->GetScreen()->ClearUndoRedoList(); + GetScreen()->ClearUndoRedoList(); - aFrame->OnModify(); - aFrame->GetBoard()->m_Status_Pcb = 0; - State = 0; LineNum = 0; Comment = 0; + OnModify(); + GetBoard()->m_Status_Pcb = 0; + State = 0; Comment = 0; s_NbNewModules = 0; wxBusyCursor dummy; // Shows an hourglass while calculating + FILE_LINE_READER netlistReader( netfile, BUFFER_CHAR_SIZE ); + char* Line = netlistReader; /* First, read the netlist: Build the list of footprints to load (new * footprints) */ - while( GetLine( source, Line, &LineNum ) ) + while( netlistReader.ReadLine( ) ) { Text = StrPurge( Line ); @@ -213,7 +216,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, if( State == 2 ) { - Module = ReadNetModule( aFrame, + Module = ReadNetModule( this, aMessageWindow, aCmpFullFileName, Text, @@ -233,7 +236,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, /* Load new footprints */ if( s_NbNewModules ) { - LoadListeModules( aFrame ); + LoadListeModules( this ); // Free module list: MODULEtoLOAD* item, * next_item; @@ -248,8 +251,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, /* Second read , All footprints are on board, one must update the schematic * info (pad netnames) */ - fseek( source, 0, SEEK_SET ); LineNum = 0; - while( GetLine( source, Line, &LineNum ) ) + netlistReader.Rewind( ); + while( netlistReader.ReadLine( ) ) { Text = StrPurge( Line ); @@ -275,7 +278,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, if( State == 2 ) { - Module = ReadNetModule( aFrame, + Module = ReadNetModule( this, aMessageWindow, aCmpFullFileName, Text, @@ -309,7 +312,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, } } - fclose( source ); + fclose( netfile ); // Delete footprints not found in netlist: if( aDeleteExtraFootprints ) @@ -322,7 +325,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, if( NbModulesNetListe ) { MODULE* NextModule; - Module = aFrame->GetBoard()->m_Modules; + Module = GetBoard()->m_Modules; bool ask_for_confirmation = true; for( ; Module != NULL; Module = NextModule ) { @@ -356,19 +359,21 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, } /* Rebuild the connectivity */ - aFrame->Compile_Ratsnest( NULL, true ); + Compile_Ratsnest( NULL, true ); - if( aFrame->GetBoard()->m_Track ) + if( GetBoard()->m_Track ) { if( aDeleteBadTracks ) // Remove erroneous tracks { - Netliste_Controle_piste( aFrame, NULL, true ); - aFrame->Compile_Ratsnest( NULL, true ); + RemoveMisConnectedTracks( NULL, true ); + Compile_Ratsnest( NULL, true ); } } - aFrame->DrawPanel->Refresh(); - aFrame->GetBoard()->DisplayInfo( aFrame ); + GetBoard()->DisplayInfo( this ); + DrawPanel->Refresh(); + + return true; } @@ -781,19 +786,21 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame, int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename, wxArrayString& aBufName ) { - int textlen; int nb_modules_lus; - int State, LineNum, Comment; - char Line[1024], * Text, * LibModName; + int State, Comment; + char * Text, * LibModName; - if( !OpenNetlistFile( aNetlistFullFilename ) ) + FILE * netfile = OpenNetlistFile( aNetlistFullFilename ); + if( !netfile ) return -1; - State = 0; LineNum = 0; Comment = 0; - nb_modules_lus = 0; - textlen = MAX_LEN_TXT; + FILE_LINE_READER netlistReader( netfile, BUFFER_CHAR_SIZE ); + char* Line = netlistReader; - while( GetLine( source, Line, &LineNum ) ) + State = 0; Comment = 0; + nb_modules_lus = 0; + + while( netlistReader.ReadLine( ) ) { Text = StrPurge( Line ); if( Comment ) @@ -835,7 +842,7 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename, } } - fclose( source ); + fclose( netfile ); return nb_modules_lus; } @@ -876,7 +883,6 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp, const wxString* TimeStamp, wxString& NameModule ) { wxString refcurrcmp, timestamp, idmod; - char ia[1024]; char* ptcar; FILE* FichCmp; @@ -893,40 +899,43 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp, return 0; } - while( fgets( ia, sizeof(ia), FichCmp ) != NULL ) + FILE_LINE_READER netlistReader( FichCmp, BUFFER_CHAR_SIZE ); + char* Line = netlistReader; + + while( netlistReader.ReadLine() ) { - if( strnicmp( ia, "BeginCmp", 8 ) != 0 ) + if( strnicmp( Line, "BeginCmp", 8 ) != 0 ) continue; /* Begin component description. */ refcurrcmp.Empty(); idmod.Empty(); timestamp.Empty(); - while( fgets( ia, sizeof(ia), FichCmp ) != NULL ) + while( netlistReader.ReadLine() ) { - if( strnicmp( ia, "EndCmp", 6 ) == 0 ) + if( strnicmp( Line, "EndCmp", 6 ) == 0 ) break; - if( strnicmp( ia, "Reference =", 11 ) == 0 ) + if( strnicmp( Line, "Reference =", 11 ) == 0 ) { - ptcar = ia + 11; + ptcar = Line + 11; ptcar = strtok( ptcar, " =;\t\n" ); if( ptcar ) refcurrcmp = CONV_FROM_UTF8( ptcar ); continue; } - if( strnicmp( ia, "IdModule =", 11 ) == 0 ) + if( strnicmp( Line, "IdModule =", 11 ) == 0 ) { - ptcar = ia + 11; + ptcar = Line + 11; ptcar = strtok( ptcar, " =;\t\n" ); if( ptcar ) idmod = CONV_FROM_UTF8( ptcar ); continue; } - if( strnicmp( ia, "TimeStamp =", 11 ) == 0 ) + if( strnicmp( Line, "TimeStamp =", 11 ) == 0 ) { - ptcar = ia + 11; + ptcar = Line + 11; ptcar = strtok( ptcar, " =;\t\n" ); if( ptcar ) timestamp = CONV_FROM_UTF8( ptcar );