Commit b5c0cada authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

merges tip, conflict resolved

parents 30e251bf e936d3c1
...@@ -258,7 +258,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -258,7 +258,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
if( curr_zone->m_FillMode == 0 ) if( curr_zone->m_FillMode == 0 )
{ {
// solid polygons only are used to fill areas // solid polygons only are used to fill areas
if( curr_zone->m_FilledPolysList.size() > 3 ) if( curr_zone->GetFilledPolysList().size() > 3 )
{ {
Draw3D_SolidPolygonsInZones( curr_zone ); Draw3D_SolidPolygonsInZones( curr_zone );
} }
...@@ -286,14 +286,16 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -286,14 +286,16 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{ {
ZONE_CONTAINER* zone = pcb->GetArea( ii ); ZONE_CONTAINER* zone = pcb->GetArea( ii );
if( zone->m_FilledPolysList.size() == 0 ) std::vector<CPolyPt> polysList = zone->GetFilledPolysList();
if( polysList.size() == 0 )
continue; continue;
if( zone->m_ZoneMinThickness <= 1 ) if( zone->m_ZoneMinThickness <= 1 )
continue; continue;
int imax = zone->m_FilledPolysList.size() - 1; int imax = polysList.size() - 1;
CPolyPt* firstcorner = &zone->m_FilledPolysList[0]; CPolyPt* firstcorner = &polysList[0];
CPolyPt* begincorner = firstcorner; CPolyPt* begincorner = firstcorner;
SEGZONE dummysegment( pcb ); SEGZONE dummysegment( pcb );
dummysegment.SetLayer( zone->GetLayer() ); dummysegment.SetLayer( zone->GetLayer() );
...@@ -301,7 +303,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -301,7 +303,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
for( int ic = 1; ic <= imax; ic++ ) for( int ic = 1; ic <= imax; ic++ )
{ {
CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; CPolyPt* endcorner = &polysList[ic];
if( begincorner->utility == 0 ) if( begincorner->utility == 0 )
{ {
...@@ -330,7 +332,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -330,7 +332,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
ic++; ic++;
if( ic < imax - 1 ) if( ic < imax - 1 )
begincorner = firstcorner = &zone->m_FilledPolysList[ic]; begincorner = firstcorner = &polysList[ic];
} }
else else
{ {
...@@ -440,7 +442,8 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -440,7 +442,8 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
// Draw solid areas contained in this zone // Draw solid areas contained in this zone
int StartContour = 1; int StartContour = 1;
for( unsigned ii = 0; ii < aZone->m_FilledPolysList.size(); ii++ ) std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
for( unsigned ii = 0; ii < polysList.size(); ii++ )
{ {
if( StartContour == 1 ) if( StartContour == 1 )
{ {
...@@ -449,11 +452,11 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -449,11 +452,11 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
StartContour = 0; StartContour = 0;
} }
v_data[0] = aZone->m_FilledPolysList[ii].x * g_Parm_3D_Visu.m_BoardScale; v_data[0] = polysList[ii].x * g_Parm_3D_Visu.m_BoardScale;
v_data[1] = -aZone->m_FilledPolysList[ii].y * g_Parm_3D_Visu.m_BoardScale; v_data[1] = -polysList[ii].y * g_Parm_3D_Visu.m_BoardScale;
gluTessVertex( tess, v_data, &aZone->m_FilledPolysList[ii] ); gluTessVertex( tess, v_data, &polysList[ii] );
if( aZone->m_FilledPolysList[ii].end_contour == 1 ) if( polysList[ii].end_contour == 1 )
{ {
gluTessEndContour( tess ); gluTessEndContour( tess );
gluTessEndPolygon( tess ); gluTessEndPolygon( tess );
......
...@@ -42,6 +42,14 @@ Dialogs: ...@@ -42,6 +42,14 @@ Dialogs:
leaving them all bundled tightly together. The dialog box should look leaving them all bundled tightly together. The dialog box should look
nice at any size large enough to show all the components. nice at any size large enough to show all the components.
When using wxFormBuilder, please add the following settings to the
"Dialog" node:
subclass.name <- DIALOG_SHIM
subclass.header <- dialog_shim.h
This will provide for an override of the Show( bool ) wxWindow() function
and provide retentitive size and position for the session.
Use tooltips to explain the functionality of each non-obvious control. Use tooltips to explain the functionality of each non-obvious control.
This is important because the help files and the wiki often lag behind This is important because the help files and the wiki often lag behind
the source code. the source code.
......
...@@ -55,6 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) ...@@ -55,6 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" )
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) );
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
......
...@@ -34,6 +34,14 @@ public: ...@@ -34,6 +34,14 @@ public:
void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent );
/**
* Function InitDisplay
* Refresh the full display for this frame:
* Set the title, the status line and redraw the canvas
* Must be called after the footprint to display is modifed
*/
void InitDisplay();
/** /**
* Function IsGridVisible() , virtual * Function IsGridVisible() , virtual
* @return true if the grid must be shown * @return true if the grid must be shown
......
...@@ -30,82 +30,78 @@ ...@@ -30,82 +30,78 @@
*/ */
void CVPCB_MAINFRAME::CreateScreenCmp() void CVPCB_MAINFRAME::CreateScreenCmp()
{ {
wxString msg, FootprintName;
bool IsNew = false;
FootprintName = m_FootprintList->GetSelectedFootprint();
if( m_DisplayFootprintFrame == NULL ) if( m_DisplayFootprintFrame == NULL )
{ {
m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ), m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
wxPoint( 0, 0 ), wxPoint( 0, 0 ),
wxSize( 600, 400 ), wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE ); KICAD_DEFAULT_DRAWFRAME_STYLE );
IsNew = true;
m_DisplayFootprintFrame->Show( true ); m_DisplayFootprintFrame->Show( true );
} }
else else
{ {
// Raising the window does not show the window on Windows if iconized.
// This should work on any platform.
if( m_DisplayFootprintFrame->IsIconized() ) if( m_DisplayFootprintFrame->IsIconized() )
m_DisplayFootprintFrame->Iconize( false ); m_DisplayFootprintFrame->Iconize( false );
m_DisplayFootprintFrame->Raise();
// Raising the window does not set the focus on Linux. This should work on any platform.
if( wxWindow::FindFocus() != m_DisplayFootprintFrame )
m_DisplayFootprintFrame->SetFocus();
} }
if( !FootprintName.IsEmpty() ) m_DisplayFootprintFrame->InitDisplay();
}
/* Refresh the full display for this frame:
* Set the title, the status line and redraw the canvas
* Must be called after the footprint to display is modifed
*/
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
{
wxString msg;
CVPCB_MAINFRAME * parentframe = (CVPCB_MAINFRAME *) GetParent();
wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint();
if( !footprintName.IsEmpty() )
{ {
msg = _( "Footprint: " ) + FootprintName; msg = _( "Footprint: " ) + footprintName;
m_DisplayFootprintFrame->SetTitle( msg ); SetTitle( msg );
FOOTPRINT_INFO* Module = m_footprints.GetModuleInfo( FootprintName ); FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
msg = _( "Lib: " ); msg = _( "Lib: " );
if( Module ) if( module_info )
msg += Module->m_LibName; msg += module_info->m_LibName;
else else
msg += wxT( "???" ); msg += wxT( "???" );
m_DisplayFootprintFrame->SetStatusText( msg, 0 ); SetStatusText( msg, 0 );
if( m_DisplayFootprintFrame->GetBoard()->m_Modules.GetCount() ) if( GetBoard()->m_Modules.GetCount() )
{ {
// there is only one module in the list // there is only one module in the list
m_DisplayFootprintFrame->GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
} }
MODULE* mod = m_DisplayFootprintFrame->Get_Module( FootprintName ); MODULE* module = Get_Module( footprintName );
if( mod )
m_DisplayFootprintFrame->GetBoard()->m_Modules.PushBack( mod );
m_DisplayFootprintFrame->Zoom_Automatique( false ); if( module )
m_DisplayFootprintFrame->GetCanvas()->Refresh(); GetBoard()->m_Modules.PushBack( module );
// Display new cursor coordinates and zoom value: Zoom_Automatique( false );
m_DisplayFootprintFrame->UpdateStatusBar();
if( m_DisplayFootprintFrame->m_Draw3DFrame )
m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay();
} }
else if( !IsNew ) // No footprint to display. Erase old footprint, if any else // No footprint to display. Erase old footprint, if any
{ {
if( m_DisplayFootprintFrame->GetBoard()->m_Modules.GetCount() ) if( GetBoard()->m_Modules.GetCount() )
{ {
m_DisplayFootprintFrame->GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
m_DisplayFootprintFrame->Zoom_Automatique( false ); Zoom_Automatique( false );
m_DisplayFootprintFrame->SetStatusText( wxEmptyString, 0 ); SetStatusText( wxEmptyString, 0 );
m_DisplayFootprintFrame->UpdateStatusBar(); }
} }
m_DisplayFootprintFrame->Refresh(); // Display new cursor coordinates and zoom value:
UpdateStatusBar();
if( m_DisplayFootprintFrame->m_Draw3DFrame ) GetCanvas()->Refresh();
m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay();
} if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
} }
/* /*
......
...@@ -321,7 +321,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven ...@@ -321,7 +321,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return; return;
if( fieldNdx <= VALUE ) if( fieldNdx < MANDATORY_FIELDS )
{ {
wxBell(); wxBell();
return; return;
...@@ -360,7 +360,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e ...@@ -360,7 +360,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return; return;
if( fieldNdx <= MANDATORY_FIELDS ) if( fieldNdx < MANDATORY_FIELDS )
{ {
wxBell(); wxBell();
return; return;
...@@ -651,10 +651,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -651,10 +651,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
// only user defined fields may be moved, and not the top most user defined // only user defined fields may be moved, and not the top most user defined
// field since it would be moving up into the fixed fields, > not >= // field since it would be moving up into the fixed fields, > not >=
moveUpButton->Enable( fieldNdx > MANDATORY_FIELDS ); moveUpButton->Enable( fieldNdx >= MANDATORY_FIELDS );
// if fieldNdx == REFERENCE, VALUE, then disable delete button // if fieldNdx == REFERENCE, VALUE, then disable delete button
deleteFieldButton->Enable( fieldNdx > VALUE ); deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
......
...@@ -35,14 +35,13 @@ ...@@ -35,14 +35,13 @@
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <general.h> #include <general.h>
#include <protos.h>
#include <class_library.h> #include <class_library.h>
#include <sch_component.h> #include <sch_component.h>
#include <dialog_edit_one_field.h> #include <dialog_edit_one_field.h>
void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC ) void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
{ {
wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T, wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T,
wxT( "Cannot edit invalid schematic field." ) ); wxT( "Cannot edit invalid schematic field." ) );
...@@ -81,7 +80,6 @@ create a new power component with the new value." ), GetChars( entry->GetName() ...@@ -81,7 +80,6 @@ create a new power component with the new value." ), GetChars( entry->GetName()
wxString title; wxString title;
title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) );
// wxTextEntryDialog dlg( this, wxEmptyString , title, newtext );
if( aField->GetText().IsEmpty() ) // Means the field was not already in use if( aField->GetText().IsEmpty() ) // Means the field was not already in use
{ {
aField->m_Pos = component->GetPosition(); aField->m_Pos = component->GetPosition();
...@@ -104,7 +102,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() ...@@ -104,7 +102,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
{ {
if( fieldNdx == REFERENCE ) if( fieldNdx == REFERENCE )
{ {
// Test is reference is acceptable: // Test if the reference string is valid:
if( SCH_COMPONENT::IsReferenceStringValid( newtext ) ) if( SCH_COMPONENT::IsReferenceStringValid( newtext ) )
{ {
component->SetRef( m_CurrentSheet, newtext ); component->SetRef( m_CurrentSheet, newtext );
...@@ -136,10 +134,9 @@ create a new power component with the new value." ), GetChars( entry->GetName() ...@@ -136,10 +134,9 @@ create a new power component with the new value." ), GetChars( entry->GetName()
if( can_update ) if( can_update )
{ {
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
dlg.TransfertDataToField(); dlg.TransfertDataToField();
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
OnModify(); OnModify();
m_canvas->Refresh();
} }
component->DisplayInfo( this ); component->DisplayInfo( this );
......
...@@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case SCH_FIELD_T: case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item, aDC ); EditComponentFieldText( (SCH_FIELD*) item );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
......
...@@ -811,15 +811,15 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) ...@@ -811,15 +811,15 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
switch( aEvent.GetId() ) switch( aEvent.GetId() )
{ {
case ID_SCH_EDIT_COMPONENT_REFERENCE: case ID_SCH_EDIT_COMPONENT_REFERENCE:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ), &dc ); EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ) );
break; break;
case ID_SCH_EDIT_COMPONENT_VALUE: case ID_SCH_EDIT_COMPONENT_VALUE:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ), &dc ); EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ) );
break; break;
case ID_SCH_EDIT_COMPONENT_FOOTPRINT: case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ), &dc ); EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) );
break; break;
case ID_SCH_EDIT_ITEM: case ID_SCH_EDIT_ITEM:
...@@ -850,7 +850,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) ...@@ -850,7 +850,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
break; break;
case SCH_FIELD_T: case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item, &dc ); EditComponentFieldText( (SCH_FIELD*) item );
break; break;
case SCH_BITMAP_T: case SCH_BITMAP_T:
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include "detail/transform_detail.hpp" #include "detail/transform_detail.hpp"
#include "detail/polygon_sort_adaptor.hpp" #include "detail/polygon_sort_adaptor.hpp"
#include "detail/polygon_sort_adaptor.hpp"
//interval //interval
#include "interval_data.hpp" #include "interval_data.hpp"
#include "interval_traits.hpp" #include "interval_traits.hpp"
......
...@@ -63,6 +63,7 @@ extern const wxString NetlistFileWildcard; ...@@ -63,6 +63,7 @@ extern const wxString NetlistFileWildcard;
extern const wxString GerberFileWildcard; extern const wxString GerberFileWildcard;
extern const wxString LegacyPcbFileWildcard; extern const wxString LegacyPcbFileWildcard;
extern const wxString PcbFileWildcard; extern const wxString PcbFileWildcard;
extern const wxString EaglePcbFileWildcard;
extern const wxString PdfFileWildcard; extern const wxString PdfFileWildcard;
extern const wxString MacrosFileWildcard; extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard; extern const wxString AllFilesWildcard;
......
...@@ -238,9 +238,10 @@ public: ...@@ -238,9 +238,10 @@ public:
* Function CursorGoto * Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if the * positions the cursor at a given coordinate and reframes the drawing if the
* requested point is out of view. * requested point is out of view.
* @param aPos The point to go to. * @param aPos is the point to go to.
* @param aWarp is true if the pointer should be warped to the new position.
*/ */
void CursorGoto( const wxPoint& aPos ); void CursorGoto( const wxPoint& aPos, bool aWarp = true );
/** /**
* Function Save_Module_In_Library * Function Save_Module_In_Library
...@@ -319,10 +320,14 @@ public: ...@@ -319,10 +320,14 @@ public:
* Function ResetModuleTextSizes * Function ResetModuleTextSizes
* resets text size and width of all module text fields of given field * resets text size and width of all module text fields of given field
* type to current settings in Preferences->Dimensions->Texts and Drawings. * type to current settings in Preferences->Dimensions->Texts and Drawings.
* @param aType is the field type (TEXT_is_REFERENCE, TEXT_is_VALUE, or TEXT_is_DIVERS). * @param aFilter is a filter: footprint names must match this filter.
* @param aDC is the drawing context. * an empty filter, or "*" do not filter anything.
*/ * @param aRef = true to modify the reference of footprints.
void ResetModuleTextSizes( int aType, wxDC* aDC ); * @param aValue = true to modify the value of footprints.
* @param aOthers = true to modify the other fields of footprints.
*/
void ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers );
void InstallPadOptionsFrame( D_PAD* pad ); void InstallPadOptionsFrame( D_PAD* pad );
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC ); void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );
......
...@@ -963,7 +963,14 @@ private: ...@@ -963,7 +963,14 @@ private:
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ); void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC ); void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC ); /**
* Function EditComponentFieldText
* displays the edit field dialog to edit the parameters of \a aField.
*
* @param aField is a pointer to the SCH_FIELD object to be edited.
*/
void EditComponentFieldText( SCH_FIELD* aField );
void RotateField( SCH_FIELD* aField, wxDC* aDC ); void RotateField( SCH_FIELD* aField, wxDC* aDC );
/** /**
......
...@@ -481,6 +481,13 @@ public: ...@@ -481,6 +481,13 @@ public:
void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent ); void OnSelectTool( wxCommandEvent& aEvent );
/**
* Function OnResetModuleTextSizes
* resets text size and width of all module text fields of given field
* type to current settings in Preferences
*/
void OnResetModuleTextSizes( wxCommandEvent& event );
void ProcessMuWaveFunctions( wxCommandEvent& event ); void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
...@@ -921,6 +928,7 @@ public: ...@@ -921,6 +928,7 @@ public:
// Handling texts on the board // Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
...@@ -1488,7 +1496,7 @@ public: ...@@ -1488,7 +1496,7 @@ public:
void Clean_Pcb( wxDC* DC ); void Clean_Pcb( wxDC* DC );
void InstallFindFrame( const wxPoint& pos, wxDC* DC ); void InstallFindFrame();
/** /**
* Function SendMessageToEESCHEMA * Function SendMessageToEESCHEMA
......
...@@ -55,6 +55,8 @@ set(PCBNEW_DIALOGS ...@@ -55,6 +55,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_edit_module_text_base.cpp dialogs/dialog_edit_module_text_base.cpp
dialogs/dialog_exchange_modules_base.cpp dialogs/dialog_exchange_modules_base.cpp
dialogs/dialog_export_3Dfiles_base.cpp dialogs/dialog_export_3Dfiles_base.cpp
dialogs/dialog_find_base.cpp
dialogs/dialog_find.cpp
dialogs/dialog_freeroute_exchange.cpp dialogs/dialog_freeroute_exchange.cpp
dialogs/dialog_freeroute_exchange_base.cpp dialogs/dialog_freeroute_exchange_base.cpp
dialogs/dialog_gendrill.cpp dialogs/dialog_gendrill.cpp
...@@ -64,6 +66,8 @@ set(PCBNEW_DIALOGS ...@@ -64,6 +66,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_general_options_BoardEditor_base.cpp dialogs/dialog_general_options_BoardEditor_base.cpp
dialogs/dialog_global_edit_tracks_and_vias.cpp dialogs/dialog_global_edit_tracks_and_vias.cpp
dialogs/dialog_global_edit_tracks_and_vias_base.cpp dialogs/dialog_global_edit_tracks_and_vias_base.cpp
dialogs/dialog_global_modules_fields_edition.cpp
dialogs/dialog_global_modules_fields_edition_base.cpp
dialogs/dialog_global_pads_edition_base.cpp dialogs/dialog_global_pads_edition_base.cpp
dialogs/dialog_graphic_items_options.cpp dialogs/dialog_graphic_items_options.cpp
dialogs/dialog_graphic_items_options_base.cpp dialogs/dialog_graphic_items_options_base.cpp
...@@ -144,7 +148,6 @@ set(PCBNEW_CLASS_SRCS ...@@ -144,7 +148,6 @@ set(PCBNEW_CLASS_SRCS
export_gencad.cpp export_gencad.cpp
export_vrml.cpp export_vrml.cpp
files.cpp files.cpp
find.cpp
gen_drill_report_files.cpp gen_drill_report_files.cpp
gen_holes_and_tools_lists_for_drill.cpp gen_holes_and_tools_lists_for_drill.cpp
gen_modules_placefile.cpp gen_modules_placefile.cpp
......
...@@ -266,28 +266,31 @@ double PCB_BASE_FRAME::BestZoom() ...@@ -266,28 +266,31 @@ double PCB_BASE_FRAME::BestZoom()
} }
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
{ {
// factored out of pcbnew/find.cpp // factored out of pcbnew/find.cpp
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
wxClientDC dc( m_canvas ); INSTALL_UNBUFFERED_DC( dc, m_canvas );
// There may be need to reframe the drawing. // There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) ) if( !m_canvas->IsPointOnDisplay( aPos ) )
{ {
screen->SetCrossHairPosition( aPos ); screen->SetCrossHairPosition( aPos );
RedrawScreen( aPos, true ); RedrawScreen( aPos, aWarp );
} }
else else
{ {
// Put cursor on item position // Put cursor on item position
m_canvas->CrossHairOff( &dc ); m_canvas->CrossHairOff( &dc );
screen->SetCrossHairPosition( aPos ); screen->SetCrossHairPosition( aPos );
if( aWarp )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( &dc );
} }
m_canvas->CrossHairOn( &dc );
m_canvas->CrossHairOn( &dc );
} }
......
...@@ -89,6 +89,12 @@ BOARD::~BOARD() ...@@ -89,6 +89,12 @@ BOARD::~BOARD()
} }
void BOARD::Move( const wxPoint& aMoveVector ) // overload
{
}
void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ) void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList )
{ {
TRACK* segment; // The current segment being analyzed. TRACK* segment; // The current segment being analyzed.
...@@ -1468,7 +1474,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) ...@@ -1468,7 +1474,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net
{ {
const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname ); const NETINFO_ITEM* net = FindNet( GetArea( ii )->GetNetName() );
if( net ) if( net )
{ {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @brief Class BOARD to handle a board. * @brief Class BOARD to handle a board.
*/ */
#ifndef CLASS_BOARD_H #ifndef CLASS_BOARD_H_
#define CLASS_BOARD_H #define CLASS_BOARD_H_
#include <dlist.h> #include <dlist.h>
...@@ -255,10 +255,11 @@ public: ...@@ -255,10 +255,11 @@ public:
BOARD(); BOARD();
~BOARD(); ~BOARD();
void Move( const wxPoint& aMoveVector ); // overload
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; } void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; } int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
/** /**
* Function GetDefaultLayerName * Function GetDefaultLayerName
* returns a default name of a PCB layer when given \a aLayerNumber. This * returns a default name of a PCB layer when given \a aLayerNumber. This
...@@ -1327,4 +1328,4 @@ public: ...@@ -1327,4 +1328,4 @@ public:
TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList ); TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList );
}; };
#endif // #ifndef CLASS_BOARD_H #endif // CLASS_BOARD_H_
...@@ -206,7 +206,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx ...@@ -206,7 +206,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay ) if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{ {
if( !IsOnLayer( curr_layer ) ) if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) )
{ {
color &= ~MASKCOLOR; color &= ~MASKCOLOR;
color |= DARKDARKGRAY; color |= DARKDARKGRAY;
......
...@@ -42,14 +42,11 @@ class EDA_DRAW_FRAME; ...@@ -42,14 +42,11 @@ class EDA_DRAW_FRAME;
class EDGE_MODULE : public DRAWSEGMENT class EDGE_MODULE : public DRAWSEGMENT
{ {
public:
wxPoint m_Start0; // Start point or center, relative to module origin, orient 0.
wxPoint m_End0; // End point, relative to module origin, orient 0.
public: public:
EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT ); EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
// EDGE_MODULE( const EDGE_MODULE& );
~EDGE_MODULE(); ~EDGE_MODULE();
...@@ -90,6 +87,11 @@ public: ...@@ -90,6 +87,11 @@ public:
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload void Show( int nestLevel, std::ostream& os ) const; // overload
#endif #endif
//protected: @todo: is it just me?
wxPoint m_Start0; // Start point or center, relative to module origin, orient 0.
wxPoint m_End0; // End point, relative to module origin, orient 0.
}; };
#endif // CLASS_EDGE_MOD_H_ #endif // CLASS_EDGE_MOD_H_
...@@ -161,7 +161,10 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre ) ...@@ -161,7 +161,10 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre )
{ {
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y ); m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
// NEGATE( m_Orient ); not needed: m_Mirror handles this // NEGATE( m_Orient ); not needed: m_Mirror handles this
if( ( GetLayer() == LAYER_N_BACK ) || ( GetLayer() == LAYER_N_FRONT ) ) if( GetLayer() == LAYER_N_BACK
|| GetLayer() == LAYER_N_FRONT
|| GetLayer() == SILKSCREEN_N_BACK
|| GetLayer() == SILKSCREEN_N_FRONT )
{ {
m_Mirror = not m_Mirror; /* inverse mirror */ m_Mirror = not m_Mirror; /* inverse mirror */
} }
......
...@@ -50,7 +50,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : ...@@ -50,7 +50,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
BOARD_ITEM( parent, PCB_MODULE_TEXT_T ), BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
EDA_TEXT() EDA_TEXT()
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
m_Type = text_type; /* Reference */ m_Type = text_type; /* Reference */
...@@ -63,11 +63,11 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : ...@@ -63,11 +63,11 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
SetLayer( SILKSCREEN_N_FRONT ); SetLayer( SILKSCREEN_N_FRONT );
if( Module && ( Module->Type() == PCB_MODULE_T ) ) if( module && ( module->Type() == PCB_MODULE_T ) )
{ {
m_Pos = Module->m_Pos; m_Pos = module->m_Pos;
int moduleLayer = Module->GetLayer(); int moduleLayer = module->GetLayer();
if( moduleLayer == LAYER_N_BACK ) if( moduleLayer == LAYER_N_BACK )
SetLayer( SILKSCREEN_N_BACK ); SetLayer( SILKSCREEN_N_BACK );
...@@ -120,18 +120,18 @@ int TEXTE_MODULE::GetLength() const ...@@ -120,18 +120,18 @@ int TEXTE_MODULE::GetLength() const
// Update draw coordinates // Update draw coordinates
void TEXTE_MODULE::SetDrawCoord() void TEXTE_MODULE::SetDrawCoord()
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
m_Pos = m_Pos0; m_Pos = m_Pos0;
if( Module == NULL ) if( module == NULL )
return; return;
int angle = Module->m_Orient; double angle = module->GetOrientation();
NORMALIZE_ANGLE_POS( angle ); NORMALIZE_ANGLE_POS( angle );
RotatePoint( &m_Pos.x, &m_Pos.y, angle ); RotatePoint( &m_Pos.x, &m_Pos.y, angle );
m_Pos += Module->m_Pos; m_Pos += module->GetPosition();
} }
...@@ -139,17 +139,17 @@ void TEXTE_MODULE::SetDrawCoord() ...@@ -139,17 +139,17 @@ void TEXTE_MODULE::SetDrawCoord()
// anchor point) // anchor point)
void TEXTE_MODULE::SetLocalCoord() void TEXTE_MODULE::SetLocalCoord()
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
if( Module == NULL ) if( module == NULL )
{ {
m_Pos0 = m_Pos; m_Pos0 = m_Pos;
return; return;
} }
m_Pos0 = m_Pos - Module->m_Pos; m_Pos0 = m_Pos - module->m_Pos;
int angle = Module->m_Orient; int angle = module->m_Orient;
NORMALIZE_ANGLE_POS( angle ); NORMALIZE_ANGLE_POS( angle );
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle ); RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
...@@ -242,7 +242,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w ...@@ -242,7 +242,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
wxSize size; wxSize size;
wxPoint pos; // Center of text wxPoint pos; // Center of text
PCB_BASE_FRAME* frame; PCB_BASE_FRAME* frame;
MODULE* Module = (MODULE*) m_Parent; /* parent must *not* be null MODULE* module = (MODULE*) m_Parent; /* parent must *not* be null
* (a module text without a footprint * (a module text without a footprint
* parent has no sense) */ * parent has no sense) */
...@@ -282,16 +282,16 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w ...@@ -282,16 +282,16 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
pos.x, pos.y + anchor_size, 0, color ); pos.x, pos.y + anchor_size, 0, color );
} }
color = brd->GetLayerColor(Module->GetLayer()); color = brd->GetLayerColor(module->GetLayer());
if( Module->GetLayer() == LAYER_N_BACK ) if( module->GetLayer() == LAYER_N_BACK )
{ {
if( brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) if( brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false )
return; return;
color = brd->GetVisibleElementColor(MOD_TEXT_BK_VISIBLE); color = brd->GetVisibleElementColor(MOD_TEXT_BK_VISIBLE);
} }
else if( Module->GetLayer() == LAYER_N_FRONT ) else if( module->GetLayer() == LAYER_N_FRONT )
{ {
if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false )
return; return;
...@@ -336,12 +336,12 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel, ...@@ -336,12 +336,12 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
int TEXTE_MODULE::GetDrawRotation() const int TEXTE_MODULE::GetDrawRotation() const
{ {
int rotation; int rotation;
MODULE* Module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
rotation = m_Orient; rotation = m_Orient;
if( Module ) if( module )
rotation += Module->m_Orient; rotation += module->m_Orient;
NORMALIZE_ANGLE_POS( rotation ); NORMALIZE_ANGLE_POS( rotation );
......
...@@ -74,6 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : ...@@ -74,6 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
// For corner moving, corner index to drag, or -1 if no selection // For corner moving, corner index to drag, or -1 if no selection
m_CornerSelection = -1; m_CornerSelection = -1;
m_IsFilled = aZone.m_IsFilled;
m_ZoneClearance = aZone.m_ZoneClearance; // clearance value m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
m_ZoneMinThickness = aZone.m_ZoneMinThickness; m_ZoneMinThickness = aZone.m_ZoneMinThickness;
m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons) m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
...@@ -84,6 +85,11 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : ...@@ -84,6 +85,11 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge; m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
m_FilledPolysList = aZone.m_FilledPolysList; m_FilledPolysList = aZone.m_FilledPolysList;
m_FillSegmList = aZone.m_FillSegmList; m_FillSegmList = aZone.m_FillSegmList;
cornerSmoothingType = aZone.cornerSmoothingType;
cornerRadius = aZone.cornerRadius;
utility = aZone.utility;
utility2 = aZone.utility;
} }
...@@ -717,7 +723,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -717,7 +723,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Corners" ), msg, BLUE ); frame->AppendMsgPanel( _( "Corners" ), msg, BLUE );
if( m_FillMode ) if( m_FillMode )
msg.Printf( _( "Segments" ), m_FillMode ); msg = _( "Segments" );
else else
msg = _( "Polygons" ); msg = _( "Polygons" );
......
...@@ -77,58 +77,7 @@ struct SEGMENT ...@@ -77,58 +77,7 @@ struct SEGMENT
class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM
{ {
public: public:
wxString m_Netname; // Net Name
CPolyLine* m_Poly; // outlines
// For corner moving, corner index to drag, or -1 if no selection.
int m_CornerSelection;
int m_ZoneClearance; // clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas
// How to fill areas: 0 = use filled polygons, != 0 fill with segments.
int m_FillMode;
// number of segments to convert a circle to a polygon (uses
//ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF)
int m_ArcToSegmentsCount;
// thickness of the gap in thermal reliefs.
int m_ThermalReliefGap;
// thickness of the copper bridge in thermal reliefs
int m_ThermalReliefCopperBridge;
int utility, utility2; // flags used in polygon calculations
// true when a zone was filled, false after deleting the filled areas
bool m_IsFilled;
/* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
* (they are* all in one piece) In very simple cases m_FilledPolysList is same
* as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
* a polygon equivalent to m_Poly, without holes but with extra outline segment
* connecting "holes" with external main outline. In complex cases an outline
* described by m_Poly can have many filled areas
*/
std::vector <CPolyPt> m_FilledPolysList;
/* set of segments used to fill area, when fill zone by segment is used.
* ( m_FillMode == 1 )
* in this case segments have m_ZoneMinThickness width
*/
std::vector <SEGMENT> m_FillSegmList;
private:
CPolyLine* smoothedPoly; // Corner-smoothed version of m_Poly
int cornerSmoothingType;
unsigned int cornerRadius;
// Priority: when a zone outline is inside and other zone, if its priority is higher
// the other zone priority, it will be created inside.
// if priorities are equal, a DRC error is set
unsigned m_priority;
ZoneConnection m_PadConnection;
public:
ZONE_CONTAINER( BOARD* parent ); ZONE_CONTAINER( BOARD* parent );
ZONE_CONTAINER( const ZONE_CONTAINER& aZone ); ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
...@@ -508,6 +457,34 @@ public: ...@@ -508,6 +457,34 @@ public:
*/ */
bool IsSame( const ZONE_CONTAINER &aZoneToCompare ); bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
/**
* Function ClearFilledPolysList
* clears the list of filled polygons.
*/
void ClearFilledPolysList()
{
m_FilledPolysList.clear();
}
/**
* Function GetFilledPolysList
* returns a reference to the list of filled polygons.
* @return Reference to the list of filled polygons.
*/
const std::vector<CPolyPt>& GetFilledPolysList() const
{
return m_FilledPolysList;
}
/**
* Function AddFilledPolysList
* sets the list of filled polygons.
*/
void AddFilledPolysList( std::vector<CPolyPt>& aPolysList )
{
m_FilledPolysList = aPolysList;
}
/** /**
* Function GetSmoothedPoly * Function GetSmoothedPoly
* returns a pointer to the corner-smoothed version of * returns a pointer to the corner-smoothed version of
...@@ -547,6 +524,59 @@ public: ...@@ -547,6 +524,59 @@ public:
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
CPolyLine* m_Poly; // outlines
// For corner moving, corner index to drag, or -1 if no selection.
int m_CornerSelection;
int m_ZoneClearance; // clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas
// How to fill areas: 0 = use filled polygons, != 0 fill with segments.
int m_FillMode;
// number of segments to convert a circle to a polygon (uses
//ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF)
int m_ArcToSegmentsCount;
// thickness of the gap in thermal reliefs.
int m_ThermalReliefGap;
// thickness of the copper bridge in thermal reliefs
int m_ThermalReliefCopperBridge;
int utility, utility2; // flags used in polygon calculations
// true when a zone was filled, false after deleting the filled areas
bool m_IsFilled;
/* set of segments used to fill area, when fill zone by segment is used.
* ( m_FillMode == 1 )
* in this case segments have m_ZoneMinThickness width
*/
std::vector <SEGMENT> m_FillSegmList;
private:
wxString m_Netname; // Net Name
CPolyLine* smoothedPoly; // Corner-smoothed version of m_Poly
int cornerSmoothingType;
unsigned int cornerRadius;
// Priority: when a zone outline is inside and other zone, if its priority is higher
// the other zone priority, it will be created inside.
// if priorities are equal, a DRC error is set
unsigned m_priority;
ZoneConnection m_PadConnection;
/* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
* (they are* all in one piece) In very simple cases m_FilledPolysList is same
* as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
* a polygon equivalent to m_Poly, without holes but with extra outline segment
* connecting "holes" with external main outline. In complex cases an outline
* described by m_Poly can have many filled areas
*/
std::vector <CPolyPt> m_FilledPolysList;
}; };
......
...@@ -56,9 +56,6 @@ private: ...@@ -56,9 +56,6 @@ private:
wxListView* m_LayerSelectionCtrl; wxListView* m_LayerSelectionCtrl;
static wxPoint prevPosition; ///< Dialog position & size
static wxSize prevSize;
/** /**
* Function initDialog * Function initDialog
* fills in the dialog controls using the current settings. * fills in the dialog controls using the current settings.
...@@ -108,8 +105,6 @@ private: ...@@ -108,8 +105,6 @@ private:
// Initialize static member variables // Initialize static member variables
wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) ); wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) );
wxPoint DIALOG_COPPER_ZONE::prevPosition( -1, -1 );
wxSize DIALOG_COPPER_ZONE::prevSize;
ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
...@@ -157,10 +152,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* ...@@ -157,10 +152,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
if( prevPosition.x != -1 )
SetSize( prevPosition.x, prevPosition.y,
prevSize.x, prevSize.y );
else
Center(); Center();
} }
...@@ -169,8 +160,6 @@ void DIALOG_COPPER_ZONE::initDialog() ...@@ -169,8 +160,6 @@ void DIALOG_COPPER_ZONE::initDialog()
{ {
BOARD* board = m_Parent->GetBoard(); BOARD* board = m_Parent->GetBoard();
SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key
wxString msg; wxString msg;
if( m_settings.m_Zone_45_Only ) if( m_settings.m_Zone_45_Only )
...@@ -297,8 +286,6 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event ) ...@@ -297,8 +286,6 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event ) void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
{ {
m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
prevPosition = GetPosition();
prevSize = GetSize();
if( AcceptOptions( true ) ) if( AcceptOptions( true ) )
{ {
...@@ -311,9 +298,6 @@ void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event ) ...@@ -311,9 +298,6 @@ void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
// called on system close button // called on system close button
void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event ) void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
{ {
prevPosition = GetPosition();
prevSize = GetSize();
if( m_OnExitCode != ZONE_ABORT ) if( m_OnExitCode != ZONE_ABORT )
*m_ptr = m_settings; *m_ptr = m_settings;
...@@ -384,7 +368,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -384,7 +368,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
m_settings.m_ZoneClearance = ReturnValueFromString( g_UserUnit, txtvalue ); m_settings.m_ZoneClearance = ReturnValueFromString( g_UserUnit, txtvalue );
// Test if this is a reasonnable value for this parameter // Test if this is a reasonable value for this parameter
// A too large value can hang Pcbnew // A too large value can hang Pcbnew
#define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch #define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch
if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE ) if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE )
...@@ -519,9 +503,6 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event ) ...@@ -519,9 +503,6 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event ) void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
{ {
prevPosition = GetPosition();
prevSize = GetSize();
if( !AcceptOptions( true, true ) ) if( !AcceptOptions( true, true ) )
return; return;
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, wxDialog ) BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, DIALOG_SHIM )
EVT_CLOSE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnClose ) EVT_CLOSE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnClose )
EVT_SIZE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnSize ) EVT_SIZE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnSize )
EVT_CHOICE( ID_M_NETDISPLAYOPTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected ) EVT_CHOICE( ID_M_NETDISPLAYOPTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected )
...@@ -23,7 +23,7 @@ BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, wxDialog ) ...@@ -23,7 +23,7 @@ BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, wxDialog )
EVT_BUTTON( wxID_CANCEL, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonCancelClick ) EVT_BUTTON( wxID_CANCEL, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -38,6 +38,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -38,6 +38,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_staticText17->Wrap( -1 ); m_staticText17->Wrap( -1 );
m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 ); m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer7; wxBoxSizer* bSizer7;
...@@ -50,6 +51,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -50,6 +51,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_ListNetNameSelection = new wxListBox( this, ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_ListNetNameSelection = new wxListBox( this, ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizer7->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer7->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptionsBoxSizer->Add( bSizer7, 1, wxEXPAND, 5 ); m_OptionsBoxSizer->Add( bSizer7, 1, wxEXPAND, 5 );
wxStaticBoxSizer* m_NetSortOptSizer; wxStaticBoxSizer* m_NetSortOptSizer;
...@@ -86,8 +88,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -86,8 +88,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_buttonRunFilter = new wxButton( this, wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRunFilter = new wxButton( this, wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 );
m_NetSortOptSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 ); m_NetSortOptSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 );
m_OptionsBoxSizer->Add( m_NetSortOptSizer, 0, wxALL, 5 ); m_OptionsBoxSizer->Add( m_NetSortOptSizer, 0, wxALL, 5 );
m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxALL|wxEXPAND, 5 ); m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* m_ExportableSetupSizer; wxStaticBoxSizer* m_ExportableSetupSizer;
...@@ -129,6 +133,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -129,6 +133,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ExportableSetupSizer->Add( bSizer9, 0, wxEXPAND, 5 ); m_ExportableSetupSizer->Add( bSizer9, 0, wxEXPAND, 5 );
wxBoxSizer* m_LeftBox; wxBoxSizer* m_LeftBox;
...@@ -165,8 +170,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -165,8 +170,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_LeftBox->Add( m_ThermalShapesParamsSizer, 0, wxALL|wxEXPAND, 5 ); m_LeftBox->Add( m_ThermalShapesParamsSizer, 0, wxALL|wxEXPAND, 5 );
m_ExportableSetupSizer->Add( m_LeftBox, 0, wxEXPAND, 5 ); m_ExportableSetupSizer->Add( m_LeftBox, 0, wxEXPAND, 5 );
wxBoxSizer* m_MiddleBox; wxBoxSizer* m_MiddleBox;
...@@ -201,6 +208,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -201,6 +208,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_ArcApproximationOpt->SetSelection( 0 ); m_ArcApproximationOpt->SetSelection( 0 );
m_MiddleBox->Add( m_ArcApproximationOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); m_MiddleBox->Add( m_ArcApproximationOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ExportableSetupSizer->Add( m_MiddleBox, 0, wxEXPAND, 5 ); m_ExportableSetupSizer->Add( m_MiddleBox, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer81; wxBoxSizer* bSizer81;
...@@ -226,8 +234,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -226,8 +234,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_OutlineAppearanceCtrl->SetSelection( 0 ); m_OutlineAppearanceCtrl->SetSelection( 0 );
bSizer81->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizer81->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 ); m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 );
m_MainBoxSizer->Add( m_ExportableSetupSizer, 1, wxALL|wxEXPAND, 5 ); m_MainBoxSizer->Add( m_ExportableSetupSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer10; wxBoxSizer* bSizer10;
...@@ -245,8 +255,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -245,8 +255,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer10->Add( m_ButtonCancel, 0, wxALL|wxEXPAND, 5 ); bSizer10->Add( m_ButtonCancel, 0, wxALL|wxEXPAND, 5 );
m_MainBoxSizer->Add( bSizer10, 0, wxALIGN_RIGHT|wxALL, 5 ); m_MainBoxSizer->Add( bSizer10, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( m_MainBoxSizer ); this->SetSizer( m_MainBoxSizer );
this->Layout(); this->Layout();
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_COPPER_ZONE_BASE /// Class DIALOG_COPPER_ZONE_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_COPPER_ZONE_BASE : public wxDialog class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
{ {
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
...@@ -66,7 +67,7 @@ class DIALOG_COPPER_ZONE_BASE : public wxDialog ...@@ -66,7 +67,7 @@ class DIALOG_COPPER_ZONE_BASE : public wxDialog
ID_M_ARCAPPROXIMATIONOPT, ID_M_ARCAPPROXIMATIONOPT,
ID_M_ORIENTEDGESOPT, ID_M_ORIENTEDGESOPT,
ID_M_OUTLINEAPPEARANCECTRL, ID_M_OUTLINEAPPEARANCECTRL,
wxID_BUTTON_EXPORT, wxID_BUTTON_EXPORT
}; };
wxBoxSizer* m_MainBoxSizer; wxBoxSizer* m_MainBoxSizer;
......
This diff is collapsed.
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012 Marco Mattila <marcom99@gmail.com>
* Copyright (C) 2006 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
* Copyright (C) 1992-2012 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <kicad_string.h>
#include <wxPcbStruct.h>
#include <class_board.h>
#include <class_module.h>
#include <class_marker_pcb.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <protos.h>
#include <dialog_find_base.h>
class DIALOG_FIND : public DIALOG_FIND_BASE
{
public:
DIALOG_FIND( PCB_BASE_FRAME* aParent );
private:
PCB_BASE_FRAME* parent;
int itemCount, markerCount;
static wxString prevSearchString;
static bool warpMouse;
void onButtonFindItemClick( wxCommandEvent& event );
void onButtonFindMarkerClick( wxCommandEvent& event );
void onButtonCloseClick( wxCommandEvent& event );
void onClose( wxCloseEvent& event );
};
// Initialize static member variables
wxString DIALOG_FIND::prevSearchString;
bool DIALOG_FIND::warpMouse = true;
DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent )
{
parent = aParent;
SetFocus();
GetSizer()->SetSizeHints( this );
m_SearchTextCtrl->AppendText( prevSearchString );
m_NoMouseWarpCheckBox->SetValue( !warpMouse );
itemCount = markerCount = 0;
Center();
}
void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
{
Close( true );
}
void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
{
PCB_SCREEN* screen = (PCB_SCREEN*) ( parent->GetScreen() );
wxPoint pos;
BOARD_ITEM* foundItem = 0;
wxString searchString = m_SearchTextCtrl->GetValue();
if( !searchString.IsSameAs( prevSearchString, false ) )
{
itemCount = 0;
}
prevSearchString = searchString;
parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
int count = 0;
for( MODULE* module = parent->GetBoard()->m_Modules; module; module = module->Next() )
{
if( WildCompareString( searchString, module->GetReference().GetData(), false ) )
{
count++;
if( count > itemCount )
{
foundItem = module;
pos = module->GetPosition();
itemCount++;
break;
}
}
if( WildCompareString( searchString, module->m_Value->m_Text.GetData(), false ) )
{
count++;
if( count > itemCount )
{
foundItem = module;
pos = module->m_Pos;
itemCount++;
break;
}
}
}
wxString msg;
if( foundItem )
{
parent->SetCurItem( foundItem );
msg.Printf( _( "<%s> found" ), GetChars( searchString ) );
parent->SetStatusText( msg );
parent->CursorGoto( pos, !m_NoMouseWarpCheckBox->IsChecked() );
}
else
{
parent->SetStatusText( wxEmptyString );
msg.Printf( _( "<%s> not found" ), GetChars( searchString ) );
DisplayError( this, msg, 10 );
itemCount = 0;
}
}
void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
{
PCB_SCREEN* screen = (PCB_SCREEN*) ( parent->GetScreen() );
wxPoint pos;
BOARD_ITEM* foundItem = 0;
parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
MARKER_PCB* marker = parent->GetBoard()->GetMARKER( markerCount++ );
if( marker )
{
foundItem = marker;
pos = marker->GetPosition();
}
wxString msg;
if( foundItem )
{
parent->SetCurItem( foundItem );
msg = _( "Marker found" );
parent->SetStatusText( msg );
parent->CursorGoto( pos, !m_NoMouseWarpCheckBox->IsChecked() );
}
else
{
parent->SetStatusText( wxEmptyString );
msg = _( "No marker found" );
DisplayError( this, msg, 10 );
markerCount = 0;
}
}
void DIALOG_FIND::onClose( wxCloseEvent& aEvent )
{
warpMouse = !m_NoMouseWarpCheckBox->IsChecked();
EndModal( 1 );
}
void PCB_EDIT_FRAME::InstallFindFrame()
{
DIALOG_FIND dlg( this );
dlg.ShowModal();
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 24 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_find_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bSizer3->Add( m_staticText1, 0, wxALL, 5 );
m_SearchTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );
bSizer3->Add( m_SearchTextCtrl, 0, wxALL|wxEXPAND, 5 );
m_NoMouseWarpCheckBox = new wxCheckBox( this, wxID_ANY, _("Do not warp mouse pointer"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_NoMouseWarpCheckBox, 0, wxALL, 5 );
bSizerMain->Add( bSizer3, 1, 0, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_button1 = new wxButton( this, wxID_ANY, _("Find Item"), wxDefaultPosition, wxDefaultSize, 0 );
m_button1->SetDefault();
bSizer4->Add( m_button1, 0, wxALL, 5 );
m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_button2, 0, wxALL, 5 );
m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_button3, 0, wxALL, 5 );
bSizerMain->Add( bSizer4, 0, 0, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
}
DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 24 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_FIND_BASE_H__
#define __DIALOG_FIND_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_FIND_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_FIND_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_SearchTextCtrl;
wxCheckBox* m_NoMouseWarpCheckBox;
wxButton* m_button1;
wxButton* m_button2;
wxButton* m_button3;
// Virtual event handlers, overide them in your derived class
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onButtonFindItemClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onButtonFindMarkerClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FIND_BASE();
};
#endif //__DIALOG_FIND_BASE_H__
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_global_modules_fields_edition.cpp
* @brief global module fields edition.
*/
#include <fctsys.h>
#include <common.h>
#include <class_drawpanel.h>
#include <wxBasePcbFrame.h>
#include <base_units.h>
#include <kicad_string.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board.h>
#include <class_module.h>
#include <class_text_mod.h>
#include <dialog_global_modules_fields_edition_base.h>
// The dialog to set options for global fields edition:
// optionas are:
// - edited fields (ref, value, others
// - the footprint filter, for selective edition
class DIALOG_GLOBAL_MODULES_FIELDS_EDITION : public DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE
{
PCB_EDIT_FRAME* m_parent;
BOARD_DESIGN_SETTINGS* m_brdSettings;
// Static variable to remember options, withing a session:
static bool m_refSelection;
static bool m_valueSelection;
static bool m_othersSelection;
static wxString m_filterString;
public:
DIALOG_GLOBAL_MODULES_FIELDS_EDITION( PCB_EDIT_FRAME* parent )
: DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( parent )
{
m_parent = parent;
initDialog();
}
private:
void initDialog();
// event handlers
void OnOKClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
};
bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_refSelection = false;
bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_valueSelection = false;
bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_othersSelection = false;
wxString DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_filterString;
void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::initDialog()
{
m_sdbSizerButtonsOK->SetDefault();
m_brdSettings = &m_parent->GetDesignSettings();
m_ReferenceOpt->SetValue(m_refSelection),
m_ValueOpt->SetValue(m_valueSelection),
m_OtherFields->SetValue(m_othersSelection);
m_ModuleFilter->SetValue(m_filterString);
m_SizeXunit->SetLabel( GetAbbreviatedUnitsLabel() );
m_SizeYunit->SetLabel( GetAbbreviatedUnitsLabel() );
m_Ticknessunit->SetLabel( GetAbbreviatedUnitsLabel() );
m_SizeX_Value->SetValue(
ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextSize.x ) );
m_SizeY_Value->SetValue(
ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextSize.y ) );
m_TicknessValue->SetValue(
ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextWidth) );
Layout();
GetSizer()->SetSizeHints( this );
Centre();
}
void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::OnOKClick( wxCommandEvent& event )
{
m_refSelection = m_ReferenceOpt->GetValue();
m_valueSelection = m_ValueOpt->GetValue();
m_othersSelection = m_OtherFields->GetValue();
m_filterString = m_ModuleFilter->GetValue();
m_brdSettings->m_ModuleTextSize.x = ReturnValueFromTextCtrl( *m_SizeX_Value );
m_brdSettings->m_ModuleTextSize.y = ReturnValueFromTextCtrl( *m_SizeY_Value );
m_brdSettings->m_ModuleTextWidth = ReturnValueFromTextCtrl( *m_TicknessValue );
// clip m_ModuleTextWidth to the 1/4 of min size, to keep it always readable
int minsize = min( m_brdSettings->m_ModuleTextSize.x,
m_brdSettings->m_ModuleTextSize.y ) / 4;
if( m_brdSettings->m_ModuleTextWidth > minsize )
m_brdSettings->m_ModuleTextWidth = minsize;
m_parent->ResetModuleTextSizes( m_filterString, m_refSelection,
m_valueSelection, m_othersSelection );
EndModal( wxID_OK );
}
void PCB_EDIT_FRAME::OnResetModuleTextSizes( wxCommandEvent& event )
{
DIALOG_GLOBAL_MODULES_FIELDS_EDITION dlg(this);
dlg.ShowModal();
m_canvas->Refresh();
}
void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers )
{
MODULE* module;
BOARD_ITEM* boardItem;
TEXTE_MODULE* item;
ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
PICKED_ITEMS_LIST undoItemList;
unsigned int ii;
// Prepare undo list
for( module = GetBoard()->m_Modules; module; module = module->Next() )
{
itemWrapper.SetItem( module );
if( ! aFilter.IsEmpty() )
{
if( ! WildCompareString( aFilter, module->GetLibRef(), false ) )
continue;
}
if( aRef )
{
item = module->m_Reference;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
}
}
if( aValue )
{
item = module->m_Value;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
}
}
if( aOthers )
{
// Go through all other module text fields
for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
item = (TEXTE_MODULE*) boardItem;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
}
}
}
}
}
// Exit if there's nothing to do
if( !undoItemList.GetCount() )
return;
SaveCopyInUndoList( undoItemList, UR_CHANGED );
// Apply changes to modules in the undo list
for( ii = 0; ii < undoItemList.GetCount(); ii++ )
{
module = (MODULE*) undoItemList.GetPickedItem( ii );
if( aRef )
{
module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize );
}
if( aValue )
{
module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize );
}
if( aOthers )
{
for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
item = (TEXTE_MODULE*) boardItem;
item->SetThickness( GetDesignSettings().m_ModuleTextWidth );
item->SetSize( GetDesignSettings().m_ModuleTextSize );
}
}
}
}
OnModify();
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_global_modules_fields_edition_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields:") ), wxVERTICAL );
m_ReferenceOpt = new wxCheckBox( this, wxID_ANY, _("Modify reference"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_ReferenceOpt, 0, wxALL|wxEXPAND, 5 );
m_ValueOpt = new wxCheckBox( this, wxID_ANY, _("Modify value"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_ValueOpt, 0, wxALL|wxEXPAND, 5 );
m_OtherFields = new wxCheckBox( this, wxID_ANY, _("Modify other fields"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_OtherFields, 0, wxALL|wxEXPAND, 5 );
bLeftSizer->Add( sbSizer1, 1, wxEXPAND|wxRIGHT, 5 );
m_staticTextFilter = new wxStaticText( this, wxID_ANY, _("Modules Filter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFilter->Wrap( -1 );
m_staticTextFilter->SetToolTip( _("A string to filter modules to edit.\nIf not void, footprint names should match this filter.\nA filter can be something like SM* (case insensitive)") );
bLeftSizer->Add( m_staticTextFilter, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ModuleFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ModuleFilter->SetMinSize( wxSize( 180,-1 ) );
bLeftSizer->Add( m_ModuleFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerUpper->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerSettings;
sbSizerSettings = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current Design Settings:") ), wxVERTICAL );
wxFlexGridSizer* fgSizerCurrSettings;
fgSizerCurrSettings = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerCurrSettings->AddGrowableCol( 1 );
fgSizerCurrSettings->SetFlexibleDirection( wxBOTH );
fgSizerCurrSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizerCurrSettings->Add( m_staticText3, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_SizeX_Value = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCurrSettings->Add( m_SizeX_Value, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeXunit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXunit->Wrap( -1 );
fgSizerCurrSettings->Add( m_SizeXunit, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
fgSizerCurrSettings->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT|wxALIGN_RIGHT, 5 );
m_SizeY_Value = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCurrSettings->Add( m_SizeY_Value, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeYunit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYunit->Wrap( -1 );
fgSizerCurrSettings->Add( m_SizeYunit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizerCurrSettings->Add( m_staticText9, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_TicknessValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCurrSettings->Add( m_TicknessValue, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_Ticknessunit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_Ticknessunit->Wrap( -1 );
fgSizerCurrSettings->Add( m_Ticknessunit, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
sbSizerSettings->Add( fgSizerCurrSettings, 1, wxEXPAND, 5 );
bRightSizer->Add( sbSizerSettings, 0, wxEXPAND|wxLEFT, 5 );
bSizerUpper->Add( bRightSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bMainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnCancelClick ), NULL, this );
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnOKClick ), NULL, this );
}
DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::~DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE()
{
// Disconnect Events
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnCancelClick ), NULL, this );
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnOKClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE_H__
#define __DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE : public DIALOG_SHIM
{
private:
protected:
wxCheckBox* m_ReferenceOpt;
wxCheckBox* m_ValueOpt;
wxCheckBox* m_OtherFields;
wxStaticText* m_staticTextFilter;
wxTextCtrl* m_ModuleFilter;
wxStaticText* m_staticText3;
wxTextCtrl* m_SizeX_Value;
wxStaticText* m_SizeXunit;
wxStaticText* m_staticText6;
wxTextCtrl* m_SizeY_Value;
wxStaticText* m_SizeYunit;
wxStaticText* m_staticText9;
wxTextCtrl* m_TicknessValue;
wxStaticText* m_Ticknessunit;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Module Fields Edition"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 409,199 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE();
};
#endif //__DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE_H__
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, wxDialog ) BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM )
EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick ) EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick )
EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick ) EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -40,6 +40,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow ...@@ -40,6 +40,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbLeftSizer_->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbLeftSizer_->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_UpperSizer->Add( sbLeftSizer_, 0, 0, 5 ); m_UpperSizer->Add( sbLeftSizer_, 0, 0, 5 );
wxStaticBoxSizer* m_OutilinesBoxOpt; wxStaticBoxSizer* m_OutilinesBoxOpt;
...@@ -57,6 +58,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow ...@@ -57,6 +58,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_OutlineAppearanceCtrl->SetSelection( 1 ); m_OutlineAppearanceCtrl->SetSelection( 1 );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_UpperSizer->Add( m_OutilinesBoxOpt, 0, 0, 5 ); m_UpperSizer->Add( m_OutilinesBoxOpt, 0, 0, 5 );
wxBoxSizer* m_ButtonsSizer; wxBoxSizer* m_ButtonsSizer;
...@@ -69,8 +71,10 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow ...@@ -69,8 +71,10 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_ButtonsSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_ButtonsSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_UpperSizer->Add( m_ButtonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); m_UpperSizer->Add( m_ButtonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 );
...@@ -80,6 +84,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow ...@@ -80,6 +84,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_MainSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_MainSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( m_MainSizer ); this->SetSizer( m_MainSizer );
this->Layout(); this->Layout();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_non_copper_zones_properties_base__ #ifndef __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__
#define __dialog_non_copper_zones_properties_base__ #define __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -29,7 +31,7 @@ ...@@ -29,7 +31,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DialogNonCopperZonesPropertiesBase /// Class DialogNonCopperZonesPropertiesBase
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DialogNonCopperZonesPropertiesBase : public wxDialog class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM
{ {
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
...@@ -51,14 +53,15 @@ class DialogNonCopperZonesPropertiesBase : public wxDialog ...@@ -51,14 +53,15 @@ class DialogNonCopperZonesPropertiesBase : public wxDialog
wxListBox* m_LayerSelectionCtrl; wxListBox* m_LayerSelectionCtrl;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,287 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,287 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DialogNonCopperZonesPropertiesBase(); ~DialogNonCopperZonesPropertiesBase();
}; };
#endif //__dialog_non_copper_zones_properties_base__ #endif //__DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__
This diff is collapsed.
...@@ -57,35 +57,17 @@ struct ENET ...@@ -57,35 +57,17 @@ struct ENET
}; };
typedef std::map< std::string, ENET > NET_MAP; typedef std::map< std::string, ENET > NET_MAP;
typedef NET_MAP::const_iterator NET_MAP_CITER;
/*
#include
namespace boost {
namespace property_tree
{
template < class Key, class Data, class KeyCompare = std::less<Key> >
class basic_ptree;
typedef basic_ptree< std::string, std::string > ptree;
}
}
*/
typedef boost::property_tree::ptree PTREE; typedef boost::property_tree::ptree PTREE;
typedef const PTREE CPTREE; typedef const PTREE CPTREE;
struct EWIRE; class XPATH;
struct EVIA;
struct EROT;
struct EATTR;
struct ECIRCLE;
struct ETEXT;
struct ERECT;
/** /**
* Class EAGLE_PLUGIN * Class EAGLE_PLUGIN
* works with Eagle 6.x XML board files and footprints. * works with Eagle 6.x XML board files and footprints to implement the
* Pcbnew PLUGIN API, or a portion of it.
*/ */
class EAGLE_PLUGIN : public PLUGIN class EAGLE_PLUGIN : public PLUGIN
{ {
...@@ -125,29 +107,39 @@ public: ...@@ -125,29 +107,39 @@ public:
private: private:
NET_MAP m_pads_to_nets; XPATH* m_xpath; ///< keeps track of what we are working on within
///< XML document during a Load().
std::string m_err_path; ///< snapshot m_xpath contentx into here on exception
int m_hole_count; ///< generates unique module names from eagle "hole"s.
NET_MAP m_pads_to_nets; ///< net list
MODULE_MAP m_templates; ///< is part of a MODULE factory that operates MODULE_MAP m_templates; ///< is part of a MODULE factory that operates
///< using copy construction. ///< using copy construction.
///< lookup key is libname.packagename ///< lookup key is libname.packagename
PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL.
BOARD* m_board; ///< which BOARD is being worked on, no ownership here
BOARD* m_board; ///< which BOARD, no ownership here
double mm_per_biu; ///< how many mm in each BIU double mm_per_biu; ///< how many mm in each BIU
double biu_per_mm; ///< how many bius in a mm double biu_per_mm; ///< how many bius in a mm
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void init( PROPERTIES* aProperties ); void init( PROPERTIES* aProperties );
/// Convert an Eagle distance to a KiCad distance.
int kicad( double d ) const; int kicad( double d ) const;
int kicad_y( double y ) const { return -kicad( y ); } int kicad_y( double y ) const { return -kicad( y ); }
int kicad_x( double x ) const { return kicad( x ); } int kicad_x( double x ) const { return kicad( x ); }
wxSize kicad_fontz( double d ) const;
/// create a font size (fontz) from an eagle font size scalar
wxSize kicad_fontz( double d ) const;
/// Convert an Eagle layer to a KiCad layer.
static int kicad_layer( int aLayer ); static int kicad_layer( int aLayer );
/// Convert a KiCad distance to an Eagle distance.
double eagle( BIU d ) const { return mm_per_biu * d; } double eagle( BIU d ) const { return mm_per_biu * d; }
double eagle_x( BIU x ) const { return eagle( x ); } double eagle_x( BIU x ) const { return eagle( x ); }
double eagle_y( BIU y ) const { return eagle( y ); } double eagle_y( BIU y ) const { return eagle( y ); }
...@@ -180,38 +172,15 @@ private: ...@@ -180,38 +172,15 @@ private:
// all these loadXXX() throw IO_ERROR or ptree_error exceptions: // all these loadXXX() throw IO_ERROR or ptree_error exceptions:
void loadAllSections( CPTREE& aEagleBoard, const std::string& aXpath, bool aAppendToMe ); void loadAllSections( CPTREE& aDocument );
void loadLayerDefs( CPTREE& aLayers );
void loadPlain( CPTREE& aPlain );
void loadSignals( CPTREE& aSignals );
void loadLibraries( CPTREE& aLibs );
void loadElements( CPTREE& aElements );
void loadPlain( CPTREE& aPlain, const std::string& aXpath ); /// move the BOARD into the center of the page
void centerBoard();
void loadSignals( CPTREE& aSignals, const std::string& aXpath );
void loadLibraries( CPTREE& aLibs, const std::string& aXpath );
void loadElements( CPTREE& aElements, const std::string& aXpath );
/**
* Function ewire
* converts a <wire>'s xml attributes to binary without additional conversion.
* @param aResult is an EWIRE to fill in with the <wire> data converted to binary.
*/
EWIRE ewire( CPTREE& aWire ) const;
EVIA evia( CPTREE& aVia ) const;
ECIRCLE ecircle( CPTREE& aCircle ) const;
ETEXT etext( CPTREE& aText ) const;
ERECT erect( CPTREE& aRect ) const;
EROT erot( const std::string& aRot ) const;
/**
* Function eattr
* parses an Eagle "attribute" element. Note that an attribute element
* is different than an XML element attribute. The attribute element is a
* full XML node in and of itself, and has attributes of its own. Blame Eagle.
*/
EATTR eattr( CPTREE& aAttribute ) const;
/** /**
* Function fmtDEG * Function fmtDEG
...@@ -235,7 +204,6 @@ private: ...@@ -235,7 +204,6 @@ private:
void packageCircle( MODULE* aModule, CPTREE& aTree ) const; void packageCircle( MODULE* aModule, CPTREE& aTree ) const;
void packageHole( MODULE* aModule, CPTREE& aTree ) const; void packageHole( MODULE* aModule, CPTREE& aTree ) const;
void packageSMD( MODULE* aModule, CPTREE& aTree ) const; void packageSMD( MODULE* aModule, CPTREE& aTree ) const;
}; };
#endif // EAGLE_PLUGIN_H_ #endif // EAGLE_PLUGIN_H_
...@@ -81,6 +81,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -81,6 +81,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_ROTATE_TEXTEPCB: case ID_POPUP_PCB_ROTATE_TEXTEPCB:
case ID_POPUP_PCB_FLIP_TEXTEPCB:
case ID_POPUP_PCB_EDIT_TEXTEPCB: case ID_POPUP_PCB_EDIT_TEXTEPCB:
case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_EDIT_MIRE:
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
...@@ -286,7 +287,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -286,7 +287,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_FIND_ITEMS: case ID_FIND_ITEMS:
InstallFindFrame( pos, &dc ); InstallFindFrame();
break; break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
...@@ -578,7 +579,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -578,7 +579,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
// Remove filled areas in zone // Remove filled areas in zone
ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii ); ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
zone_container->m_FilledPolysList.clear(); zone_container->ClearFilledPolysList();
} }
SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
...@@ -930,6 +931,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -930,6 +931,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_FLIP_TEXTEPCB:
FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_TEXTEPCB: case ID_POPUP_PCB_DELETE_TEXTEPCB:
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc ); Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -1078,14 +1084,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1078,14 +1084,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Swap_Layers( event ); Swap_Layers( event );
break; break;
case ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES:
ResetModuleTextSizes( TEXT_is_REFERENCE, &dc );
break;
case ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES:
ResetModuleTextSizes( TEXT_is_VALUE, &dc );
break;
case ID_PCB_USER_GRID_SETUP: case ID_PCB_USER_GRID_SETUP:
InstallGridFrame( pos ); InstallGridFrame( pos );
break; break;
......
...@@ -216,7 +216,6 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC ) ...@@ -216,7 +216,6 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC )
void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{ {
int angle = 900; int angle = 900;
int drawmode = GR_XOR;
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
...@@ -228,13 +227,34 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -228,13 +227,34 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
NORMALIZE_ANGLE_POS( TextePcb->m_Orient ); NORMALIZE_ANGLE_POS( TextePcb->m_Orient );
/* Redraw text in new position. */ /* Redraw text in new position. */
TextePcb->Draw( m_canvas, DC, drawmode ); TextePcb->Draw( m_canvas, DC, GR_XOR );
TextePcb->DisplayInfo( this ); TextePcb->DisplayInfo( this );
if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos ); SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetPosition() );
else // set flag edit, to show it was a complex command else // set flag edit, to show it was a complex command
TextePcb->SetFlags( IN_EDIT ); TextePcb->SetFlags( IN_EDIT );
OnModify(); OnModify();
} }
void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC )
{
if( aTextePcb == NULL )
return;
aTextePcb->Draw( m_canvas, aDC, GR_XOR );
aTextePcb->Flip( aTextePcb->GetPosition() );
aTextePcb->Draw( m_canvas, aDC, GR_XOR );
aTextePcb->DisplayInfo( this );
if( aTextePcb->GetFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetPosition() );
else // set flag edit, to show it was a complex command
aTextePcb->SetFlags( IN_EDIT );
OnModify();
}
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <macros.h> #include <macros.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <protos.h> #include <wxPcbStruct.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
...@@ -356,107 +356,3 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) ...@@ -356,107 +356,3 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
OnModify(); OnModify();
} }
void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
{
MODULE* module;
BOARD_ITEM* boardItem;
TEXTE_MODULE* item;
ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
PICKED_ITEMS_LIST undoItemList;
unsigned int ii;
module = GetBoard()->m_Modules;
// Prepare undo list
while( module )
{
itemWrapper.SetItem( module );
switch( aType )
{
case TEXT_is_REFERENCE:
item = module->m_Reference;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
undoItemList.PushItem( itemWrapper );
break;
case TEXT_is_VALUE:
item = module->m_Value;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
undoItemList.PushItem( itemWrapper );
break;
case TEXT_is_DIVERS:
// Go through all other module text fields
for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
item = (TEXTE_MODULE*) boardItem;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
break;
}
}
}
break;
default:
break;
}
module = module->Next();
}
// Exit if there's nothing to do
if( !undoItemList.GetCount() )
return;
SaveCopyInUndoList( undoItemList, UR_CHANGED );
// Apply changes to modules in the undo list
for( ii = 0; ii < undoItemList.GetCount(); ii++ )
{
module = (MODULE*) undoItemList.GetPickedItem( ii );
switch( aType )
{
case TEXT_is_REFERENCE:
module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize );
break;
case TEXT_is_VALUE:
module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize );
break;
case TEXT_is_DIVERS:
for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
item = (TEXTE_MODULE*) boardItem;
item->SetThickness( GetDesignSettings().m_ModuleTextWidth );
item->SetSize( GetDesignSettings().m_ModuleTextSize );
}
}
break;
}
}
if( aDC )
m_canvas->Refresh();
OnModify();
}
...@@ -121,8 +121,8 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -121,8 +121,8 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() ); GetScreen()->SetFileName( fn.GetFullPath() );
UpdateTitle(); UpdateTitle();
break;
} }
break;
case ID_APPEND_FILE: case ID_APPEND_FILE:
LoadOnePcbFile( wxEmptyString, true ); LoadOnePcbFile( wxEmptyString, true );
...@@ -154,8 +154,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -154,8 +154,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend,
bool aForceFileDialog ) bool aForceFileDialog )
{ {
wxString msg;
if( GetScreen()->IsModify() && !aAppend ) if( GetScreen()->IsModify() && !aAppend )
{ {
if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \
...@@ -172,10 +170,34 @@ the changes?" ) ) ) ...@@ -172,10 +170,34 @@ the changes?" ) ) )
wxFileName fileName = aFileName; wxFileName fileName = aFileName;
IO_MGR::PCB_FILE_T pluginType = IO_MGR::LEGACY;
// This is a subset of all PLUGINs which are trusted to be able to
// load a BOARD. Order is subject to change as KICAD plugin matures.
// User may occasionally use the wrong plugin to load a *.brd file,
// but eventually *.kicad_pcb will be more common than legacy *.brd files.
static const struct {
const wxString& filter;
IO_MGR::PCB_FILE_T pluginType;
} loaders[] = {
{ LegacyPcbFileWildcard, IO_MGR::LEGACY },
{ PcbFileWildcard, IO_MGR::KICAD },
{ EaglePcbFileWildcard, IO_MGR::EAGLE },
};
if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog )
{ {
wxString name; wxString name;
wxString path = wxGetCwd(); wxString path = wxGetCwd();
wxString fileFilters;
for( unsigned i=0; i<DIM( loaders ); ++i )
{
if( i > 0 )
fileFilters += wxChar( '|' );
fileFilters += wxGetTranslation( loaders[i].filter );
}
if( aForceFileDialog && fileName.FileExists() ) if( aForceFileDialog && fileName.FileExists() )
{ {
...@@ -183,7 +205,7 @@ the changes?" ) ) ) ...@@ -183,7 +205,7 @@ the changes?" ) ) )
name = fileName.GetFullName(); name = fileName.GetFullName();
} }
wxFileDialog dlg( this, _( "Open Board File" ), path, name, LegacyPcbFileWildcard, wxFileDialog dlg( this, _( "Open Board File" ), path, name, fileFilters,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -191,10 +213,15 @@ the changes?" ) ) ) ...@@ -191,10 +213,15 @@ the changes?" ) ) )
fileName = dlg.GetPath(); fileName = dlg.GetPath();
if( !fileName.HasExt() ) int chosenFilter = dlg.GetFilterIndex();
fileName.SetExt( PcbFileExtension ); pluginType = loaders[chosenFilter].pluginType;
} }
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
if( !fileName.HasExt() )
fileName.SetExt( pi->GetFileExtension() );
if( !aAppend ) if( !aAppend )
Clear_Pcb( false ); // pass false since we prompted above for a modified board Clear_Pcb( false ); // pass false since we prompted above for a modified board
...@@ -223,14 +250,18 @@ the changes?" ) ) ) ...@@ -223,14 +250,18 @@ the changes?" ) ) )
try try
{ {
PROPERTIES props;
props["page_width"] = wxString::Format( wxT( "%d" ), GetPageSizeIU().x );
props["page_height"] = wxString::Format( wxT( "%d" ), GetPageSizeIU().y );
// load or append either: // load or append either:
loadedBoard = IO_MGR::Load( IO_MGR::LEGACY, GetScreen()->GetFileName(), loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, &props );
aAppend ? GetBoard() : NULL,
NULL );
if( !aAppend ) if( !aAppend )
{ {
if( loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) if( pluginType == IO_MGR::LEGACY &&
loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION )
{ {
DisplayInfoMessage( this, _( "This file was created by an older \ DisplayInfoMessage( this, _( "This file was created by an older \
version of Pcbnew. It will be stored in the new file format when you save \ version of Pcbnew. It will be stored in the new file format when you save \
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: find.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 04/03/2006 13:58:04
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 04/03/2006 13:58:04
#ifndef _FIND_H_
#define _FIND_H_
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL 10001
#define ID_FIND_ITEM 10002
#define ID_FIND_NEXT_ITEM 10003
#define ID_FIND_MARKER 10004
#define ID_FIND_NEXT_MARKER 10005
#define SYMBOL_WINEDA_PCBFINDFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_PCBFINDFRAME_TITLE _("Find")
#define SYMBOL_WINEDA_PCBFINDFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_PCBFINDFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_PCBFINDFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_PcbFindFrame class declaration
*/
class WinEDA_PcbFindFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_PcbFindFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_PcbFindFrame( );
WinEDA_PcbFindFrame( PCB_BASE_FRAME* parent,
wxDC * DC, const wxPoint& pos = SYMBOL_WINEDA_PCBFINDFRAME_POSITION,
wxWindowID id = SYMBOL_WINEDA_PCBFINDFRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_PCBFINDFRAME_TITLE,
const wxSize& size = SYMBOL_WINEDA_PCBFINDFRAME_SIZE,
long style = SYMBOL_WINEDA_PCBFINDFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PCBFINDFRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_PCBFINDFRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_PCBFINDFRAME_POSITION,
const wxSize& size = SYMBOL_WINEDA_PCBFINDFRAME_SIZE,
long style = SYMBOL_WINEDA_PCBFINDFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_PcbFindFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_ITEM
void OnFindItemClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_ITEM
void OnFindNextItemClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_MARKER
void OnFindMarkerClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_MARKER
void OnFindNextMarkerClick( wxCommandEvent& event );
////@end WinEDA_PcbFindFrame event handler declarations
////@begin WinEDA_PcbFindFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_PcbFindFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void FindItem(wxCommandEvent& event);
void FindMarker(wxCommandEvent& event);
////@begin WinEDA_PcbFindFrame member variables
wxTextCtrl* m_NewText;
////@end WinEDA_PcbFindFrame member variables
PCB_BASE_FRAME * m_Parent;
wxDC * m_DC;
};
#endif
// _FIND_H_
...@@ -67,7 +67,7 @@ static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' ); ...@@ -67,7 +67,7 @@ static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL ); static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
static EDA_HOTKEY HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' ); static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' );
static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' ); static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' ); static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
...@@ -210,8 +210,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = ...@@ -210,8 +210,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkSwitchTrackPosture, &HkSwitchTrackPosture,
&HkDragTrackKeepSlope, &HkDragTrackKeepSlope,
&HkPlaceItem, &HkPlaceItem,
&HkEndTrack, &HkMoveItem, &HkEndTrack, &HkMoveItem, &HkFlipItem,
&HkFlipFootprint, &HkRotateItem, &HkDragFootprint, &HkRotateItem, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkLoadfile, &HkFindItem, &HkEditBoardItem, &HkLoadfile, &HkFindItem, &HkEditBoardItem,
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1, &HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
......
...@@ -14,9 +14,9 @@ enum hotkey_id_commnand { ...@@ -14,9 +14,9 @@ enum hotkey_id_commnand {
HK_DELETE = HK_COMMON_END, HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE, HK_BACK_SPACE,
HK_ROTATE_ITEM, HK_ROTATE_ITEM,
HK_FLIP_ITEM,
HK_MOVE_ITEM, HK_MOVE_ITEM,
HK_DRAG_ITEM, HK_DRAG_ITEM,
HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT, HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT,
HK_ADD_NEW_TRACK, HK_ADD_NEW_TRACK,
......
...@@ -624,9 +624,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -624,9 +624,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
OnHotkeyRotateItem( HK_ROTATE_ITEM ); OnHotkeyRotateItem( HK_ROTATE_ITEM );
break; break;
case HK_FLIP_FOOTPRINT: // move to other side case HK_FLIP_ITEM:
OnHotkeyRotateItem( HK_FLIP_FOOTPRINT ); OnHotkeyRotateItem( HK_FLIP_ITEM );
break; break;
case HK_SWITCH_HIGHCONTRAST_MODE: // switch to high contrast mode and refresh the canvas case HK_SWITCH_HIGHCONTRAST_MODE: // switch to high contrast mode and refresh the canvas
DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay; DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay;
m_canvas->Refresh(); m_canvas->Refresh();
...@@ -1002,7 +1003,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) ...@@ -1002,7 +1003,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
if( aIdCommand == HK_ROTATE_ITEM ) // Rotation if( aIdCommand == HK_ROTATE_ITEM ) // Rotation
evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE; evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE;
if( aIdCommand == HK_FLIP_FOOTPRINT ) // move to other side if( aIdCommand == HK_FLIP_ITEM ) // move to other side
evt_type = ID_POPUP_PCB_CHANGE_SIDE_MODULE; evt_type = ID_POPUP_PCB_CHANGE_SIDE_MODULE;
} }
break; break;
...@@ -1010,6 +1011,8 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) ...@@ -1010,6 +1011,8 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
case PCB_TEXT_T: case PCB_TEXT_T:
if( aIdCommand == HK_ROTATE_ITEM ) // Rotation if( aIdCommand == HK_ROTATE_ITEM ) // Rotation
evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB; evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB;
else if( aIdCommand == HK_FLIP_ITEM )
evt_type = ID_POPUP_PCB_FLIP_TEXTEPCB;
break; break;
......
...@@ -970,7 +970,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, OUTPUTFORMATTER* aFormatter, int aNe ...@@ -970,7 +970,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, OUTPUTFORMATTER* aFormatter, int aNe
} }
// Save the PolysList // Save the PolysList
const std::vector< CPolyPt >& fv = aZone->m_FilledPolysList; const std::vector< CPolyPt >& fv = aZone->GetFilledPolysList();
if( fv.size() ) if( fv.size() )
{ {
......
...@@ -2258,6 +2258,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2258,6 +2258,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
else if( TESTLINE( "$POLYSCORNERS" ) ) else if( TESTLINE( "$POLYSCORNERS" ) )
{ {
// Read the PolysList (polygons used for fill areas in the zone) // Read the PolysList (polygons used for fill areas in the zone)
std::vector<CPolyPt> polysList;
while( READLINE( m_reader ) ) while( READLINE( m_reader ) )
{ {
...@@ -2273,8 +2274,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2273,8 +2274,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here
int utility = intParse( data ); int utility = intParse( data );
zc->m_FilledPolysList.push_back( CPolyPt( x, y, end_contour, utility ) ); polysList.push_back( CPolyPt( x, y, end_contour, utility ) );
} }
zc->AddFilledPolysList( polysList );
} }
else if( TESTLINE( "$FILLSEGMENTS" ) ) else if( TESTLINE( "$FILLSEGMENTS" ) )
...@@ -3569,7 +3571,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const ...@@ -3569,7 +3571,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
} }
// Save the PolysList // Save the PolysList
const CPOLY_PTS& fv = me->m_FilledPolysList; const CPOLY_PTS& fv = me->GetFilledPolysList();
if( fv.size() ) if( fv.size() )
{ {
fprintf( m_fp, "$POLYSCORNERS\n" ); fprintf( m_fp, "$POLYSCORNERS\n" );
......
...@@ -295,15 +295,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -295,15 +295,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( swap_layer_xpm ) ); KiBitmap( swap_layer_xpm ) );
// Reset module reference sizes // Reset module reference sizes
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
_( "Reset Module &Reference Sizes" ), _( "&Reset Module Field Sizes" ),
_( "Reset text size and width of all module references to current defaults" ), _( "Reset text size and width of all module fields to current defaults" ),
KiBitmap( reset_text_xpm ) );
// Reset module value sizes
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES,
_( "Reset Module &Value Sizes" ),
_( "Reset text size and width of all module values to current defaults" ),
KiBitmap( reset_text_xpm ) ); KiBitmap( reset_text_xpm ) );
/** Create View menu **/ /** Create View menu **/
......
...@@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* ...@@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ),
KiBitmap( fill_zone_xpm ) ); KiBitmap( fill_zone_xpm ) );
if( edge_zone->m_FilledPolysList.size() > 0 ) if( edge_zone->GetFilledPolysList().size() > 0 )
{ {
AddMenuItem( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE, AddMenuItem( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
_( "Remove Filled Areas in Zone" ), KiBitmap( zone_unfill_xpm ) ); _( "Remove Filled Areas in Zone" ), KiBitmap( zone_unfill_xpm ) );
...@@ -685,7 +685,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu ...@@ -685,7 +685,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
msg, KiBitmap( rotate_module_pos_xpm ) ); msg, KiBitmap( rotate_module_pos_xpm ) );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
_( "Rotate -" ), KiBitmap( rotate_module_neg_xpm ) ); _( "Rotate -" ), KiBitmap( rotate_module_neg_xpm ) );
msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_FOOTPRINT ); msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_ITEM );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE, AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE,
msg, KiBitmap( invert_module_xpm ) ); msg, KiBitmap( invert_module_xpm ) );
...@@ -839,6 +839,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) ...@@ -839,6 +839,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, KiBitmap( rotate_ccw_xpm ) );
msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_ITEM );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_FLIP_TEXTEPCB, msg, KiBitmap( invert_module_xpm ) );
msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, KiBitmap( edit_text_xpm ) ); AddMenuItem( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, KiBitmap( edit_text_xpm ) );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE, AddMenuItem( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE,
......
...@@ -135,10 +135,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -135,10 +135,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
PCB_EDIT_FRAME::Process_Special_Functions ) PCB_EDIT_FRAME::OnResetModuleTextSizes )
EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES,
PCB_EDIT_FRAME::Process_Special_Functions )
// Menu Help // Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
......
...@@ -66,6 +66,7 @@ enum pcbnew_ids ...@@ -66,6 +66,7 @@ enum pcbnew_ids
ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
ID_POPUP_PCB_ROTATE_TEXTEPCB, ID_POPUP_PCB_ROTATE_TEXTEPCB,
ID_POPUP_PCB_FLIP_TEXTEPCB,
ID_POPUP_PCB_EDIT_TEXTEPCB, ID_POPUP_PCB_EDIT_TEXTEPCB,
ID_POPUP_PCB_DELETE_TEXTEPCB, ID_POPUP_PCB_DELETE_TEXTEPCB,
...@@ -219,8 +220,7 @@ enum pcbnew_ids ...@@ -219,8 +220,7 @@ enum pcbnew_ids
ID_MENU_LIST_NETS, ID_MENU_LIST_NETS,
ID_MENU_PCB_CLEAN, ID_MENU_PCB_CLEAN,
ID_MENU_PCB_SWAP_LAYERS, ID_MENU_PCB_SWAP_LAYERS,
ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES,
ID_GEN_EXPORT_FILE_VRML, ID_GEN_EXPORT_FILE_VRML,
ID_GEN_EXPORT_SPECCTRA, ID_GEN_EXPORT_SPECCTRA,
......
...@@ -523,7 +523,8 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC ...@@ -523,7 +523,8 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC
*/ */
void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone, EDA_DRAW_MODE_T trace_mode ) void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone, EDA_DRAW_MODE_T trace_mode )
{ {
unsigned imax = aZone->m_FilledPolysList.size(); std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
unsigned imax = polysList.size();
if( imax == 0 ) // Nothing to draw if( imax == 0 ) // Nothing to draw
return; return;
...@@ -540,7 +541,7 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_ ...@@ -540,7 +541,7 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
*/ */
for( unsigned ic = 0; ic < imax; ic++ ) for( unsigned ic = 0; ic < imax; ic++ )
{ {
CPolyPt* corner = &aZone->m_FilledPolysList[ic]; CPolyPt* corner = &polysList[ic];
cornerList.push_back( wxPoint( corner->x, corner->y) ); cornerList.push_back( wxPoint( corner->x, corner->y) );
if( corner->end_contour ) // Plot the current filled area outline if( corner->end_contour ) // Plot the current filled area outline
......
...@@ -1152,7 +1152,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) ...@@ -1152,7 +1152,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
PATH* mainPolygon = new PATH( plane, T_polygon ); PATH* mainPolygon = new PATH( plane, T_polygon );
plane->SetShape( mainPolygon ); plane->SetShape( mainPolygon );
plane->name = TO_UTF8( item->m_Netname ); plane->name = TO_UTF8( item->GetNetName() );
if( plane->name.size() == 0 ) if( plane->name.size() == 0 )
{ {
......
...@@ -800,7 +800,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) ...@@ -800,7 +800,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection ); NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
if( net ) // net == NULL should not occur if( net ) // net == NULL should not occur
aZone->m_Netname = net->GetNetname(); aZone->SetNetName( net->GetNetname() );
// Combine zones if possible // Combine zones if possible
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose ); GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
......
...@@ -105,7 +105,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) ...@@ -105,7 +105,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor) wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
aZone->m_FilledPolysList.clear(); aZone->ClearFilledPolysList();
aZone->UnFill(); aZone->UnFill();
aZone->BuildFilledPolysListData( GetBoard() ); aZone->BuildFilledPolysListData( GetBoard() );
......
...@@ -471,6 +471,7 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone, ...@@ -471,6 +471,7 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
KPolygonSet& aKPolyList ) KPolygonSet& aKPolyList )
{ {
int count = 0; int count = 0;
std::vector<CPolyPt> polysList;
for( unsigned ii = 0; ii < aKPolyList.size(); ii++ ) for( unsigned ii = 0; ii < aKPolyList.size(); ii++ )
{ {
...@@ -487,14 +488,15 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone, ...@@ -487,14 +488,15 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
// Flag this corner if starting a hole connection segment: // Flag this corner if starting a hole connection segment:
// This is used by draw functions to draw only useful segments (and not extra segments) // This is used by draw functions to draw only useful segments (and not extra segments)
// corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0; // corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0;
aZone->m_FilledPolysList.push_back( corner ); polysList.push_back( corner );
count++; count++;
} }
corner.end_contour = true; corner.end_contour = true;
aZone->m_FilledPolysList.pop_back(); polysList.pop_back();
aZone->m_FilledPolysList.push_back( corner ); polysList.push_back( corner );
} }
aZone->AddFilledPolysList( polysList );
return count; return count;
} }
...@@ -503,7 +505,8 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone, ...@@ -503,7 +505,8 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone, int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
KPolygonSet& aKPolyList ) KPolygonSet& aKPolyList )
{ {
unsigned corners_count = aZone->m_FilledPolysList.size(); std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
unsigned corners_count = polysList.size();
int count = 0; int count = 0;
unsigned ic = 0; unsigned ic = 0;
...@@ -511,7 +514,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone, ...@@ -511,7 +514,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
for( unsigned ii = 0; ii < corners_count; ii++ ) for( unsigned ii = 0; ii < corners_count; ii++ )
{ {
CPolyPt* corner = &aZone->m_FilledPolysList[ic]; CPolyPt* corner = &polysList[ic];
if( corner->end_contour ) if( corner->end_contour )
polycount++; polycount++;
...@@ -527,7 +530,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone, ...@@ -527,7 +530,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
{ {
for( ; ic < corners_count; ic++ ) for( ; ic < corners_count; ic++ )
{ {
CPolyPt* corner = &aZone->m_FilledPolysList[ic]; CPolyPt* corner = &polysList[ic];
cornerslist.push_back( KPolyPoint( corner->x, corner->y ) ); cornerslist.push_back( KPolyPoint( corner->x, corner->y ) );
count++; count++;
......
...@@ -74,7 +74,6 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* ...@@ -74,7 +74,6 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*
void DIALOG_NON_COPPER_ZONES_EDITOR::Init() void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{ {
SetFocus();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click SetReturnCode( ZONE_ABORT ); // Will be changed on button click
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 ); m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );
......
...@@ -28,7 +28,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); ...@@ -28,7 +28,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
bool sort_areas( const ZONE_CONTAINER* ref, const ZONE_CONTAINER* tst ) bool sort_areas( const ZONE_CONTAINER* ref, const ZONE_CONTAINER* tst )
{ {
if( ref->GetNet() == tst->GetNet() ) if( ref->GetNet() == tst->GetNet() )
return ref->m_FilledPolysList.size() < tst->m_FilledPolysList.size(); return ref->GetFilledPolysList().size() < tst->GetFilledPolysList().size();
else else
return ref->GetNet() < tst->GetNet(); return ref->GetNet() < tst->GetNet();
} }
...@@ -71,7 +71,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) ...@@ -71,7 +71,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
continue; continue;
if( (aNetcode >= 0) && ( aNetcode != curr_zone->GetNet() ) ) if( (aNetcode >= 0) && ( aNetcode != curr_zone->GetNet() ) )
continue; continue;
if( curr_zone->m_FilledPolysList.size() == 0 ) if( curr_zone->GetFilledPolysList().size() == 0 )
continue; continue;
zones_candidates.push_back(curr_zone); zones_candidates.push_back(curr_zone);
} }
...@@ -120,10 +120,11 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) ...@@ -120,10 +120,11 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
// test if a candidate is inside a filled area of this zone // test if a candidate is inside a filled area of this zone
unsigned indexstart = 0, indexend; unsigned indexstart = 0, indexend;
for( indexend = 0; indexend < curr_zone->m_FilledPolysList.size(); indexend++ ) std::vector<CPolyPt> polysList = curr_zone->GetFilledPolysList();
for( indexend = 0; indexend < polysList.size(); indexend++ )
{ {
// end of a filled sub-area found // end of a filled sub-area found
if( curr_zone->m_FilledPolysList[indexend].end_contour ) if( polysList[indexend].end_contour )
{ {
subnet++; subnet++;
EDA_RECT bbox = curr_zone->CalculateSubAreaBoundaryBox( indexstart, indexend ); EDA_RECT bbox = curr_zone->CalculateSubAreaBoundaryBox( indexstart, indexend );
...@@ -162,7 +163,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) ...@@ -162,7 +163,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
if( bbox.Contains( pos1 ) ) if( bbox.Contains( pos1 ) )
{ {
if( TestPointInsidePolygon( curr_zone->m_FilledPolysList, indexstart, if( TestPointInsidePolygon( polysList, indexstart,
indexend, pos1.x, pos1.y ) ) indexend, pos1.x, pos1.y ) )
connected = true; connected = true;
} }
...@@ -170,7 +171,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) ...@@ -170,7 +171,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
{ {
if( bbox.Contains( pos2 ) ) if( bbox.Contains( pos2 ) )
{ {
if( TestPointInsidePolygon( curr_zone->m_FilledPolysList, if( TestPointInsidePolygon( polysList,
indexstart, indexend, indexstart, indexend,
pos2.x, pos2.y ) ) pos2.x, pos2.y ) )
connected = true; connected = true;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment