merges tip, conflict resolved

This commit is contained in:
Miguel Angel Ajo 2012-06-03 22:21:53 +02:00
commit b5c0cada0d
66 changed files with 12107 additions and 8612 deletions

View File

@ -258,7 +258,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
if( curr_zone->m_FillMode == 0 )
{
// 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 );
}
@ -286,14 +286,16 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{
ZONE_CONTAINER* zone = pcb->GetArea( ii );
if( zone->m_FilledPolysList.size() == 0 )
std::vector<CPolyPt> polysList = zone->GetFilledPolysList();
if( polysList.size() == 0 )
continue;
if( zone->m_ZoneMinThickness <= 1 )
continue;
int imax = zone->m_FilledPolysList.size() - 1;
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
int imax = polysList.size() - 1;
CPolyPt* firstcorner = &polysList[0];
CPolyPt* begincorner = firstcorner;
SEGZONE dummysegment( pcb );
dummysegment.SetLayer( zone->GetLayer() );
@ -301,7 +303,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
for( int ic = 1; ic <= imax; ic++ )
{
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
CPolyPt* endcorner = &polysList[ic];
if( begincorner->utility == 0 )
{
@ -330,7 +332,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
ic++;
if( ic < imax - 1 )
begincorner = firstcorner = &zone->m_FilledPolysList[ic];
begincorner = firstcorner = &polysList[ic];
}
else
{
@ -440,7 +442,8 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
// Draw solid areas contained in this zone
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 )
{
@ -449,11 +452,11 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
StartContour = 0;
}
v_data[0] = aZone->m_FilledPolysList[ii].x * g_Parm_3D_Visu.m_BoardScale;
v_data[1] = -aZone->m_FilledPolysList[ii].y * g_Parm_3D_Visu.m_BoardScale;
gluTessVertex( tess, v_data, &aZone->m_FilledPolysList[ii] );
v_data[0] = polysList[ii].x * g_Parm_3D_Visu.m_BoardScale;
v_data[1] = -polysList[ii].y * g_Parm_3D_Visu.m_BoardScale;
gluTessVertex( tess, v_data, &polysList[ii] );
if( aZone->m_FilledPolysList[ii].end_contour == 1 )
if( polysList[ii].end_contour == 1 )
{
gluTessEndContour( tess );
gluTessEndPolygon( tess );

View File

@ -42,6 +42,14 @@ Dialogs:
leaving them all bundled tightly together. The dialog box should look
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.
This is important because the help files and the wiki often lag behind
the source code.

View File

@ -55,6 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" )
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
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 FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );

View File

@ -34,6 +34,14 @@ public:
void OnUpdateTextDrawMode( 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
* @return true if the grid must be shown

View File

@ -30,82 +30,78 @@
*/
void CVPCB_MAINFRAME::CreateScreenCmp()
{
wxString msg, FootprintName;
bool IsNew = false;
FootprintName = m_FootprintList->GetSelectedFootprint();
if( m_DisplayFootprintFrame == NULL )
{
m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
wxPoint( 0, 0 ),
wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE );
IsNew = true;
m_DisplayFootprintFrame->Show( true );
}
else
{
// Raising the window does not show the window on Windows if iconized.
// This should work on any platform.
if( m_DisplayFootprintFrame->IsIconized() )
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;
m_DisplayFootprintFrame->SetTitle( msg );
FOOTPRINT_INFO* Module = m_footprints.GetModuleInfo( FootprintName );
msg = _( "Footprint: " ) + footprintName;
SetTitle( msg );
FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
msg = _( "Lib: " );
if( Module )
msg += Module->m_LibName;
if( module_info )
msg += module_info->m_LibName;
else
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
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 );
if( module )
GetBoard()->m_Modules.PushBack( module );
m_DisplayFootprintFrame->Zoom_Automatique( false );
m_DisplayFootprintFrame->GetCanvas()->Refresh();
Zoom_Automatique( false );
// Display new cursor coordinates and zoom value:
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();
m_DisplayFootprintFrame->Zoom_Automatique( false );
m_DisplayFootprintFrame->SetStatusText( wxEmptyString, 0 );
m_DisplayFootprintFrame->UpdateStatusBar();
GetBoard()->m_Modules.DeleteAll();
Zoom_Automatique( false );
SetStatusText( wxEmptyString, 0 );
}
m_DisplayFootprintFrame->Refresh();
if( m_DisplayFootprintFrame->m_Draw3DFrame )
m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay();
}
// Display new cursor coordinates and zoom value:
UpdateStatusBar();
GetCanvas()->Refresh();
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
}
/*

View File

@ -321,7 +321,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return;
if( fieldNdx <= VALUE )
if( fieldNdx < MANDATORY_FIELDS )
{
wxBell();
return;
@ -360,7 +360,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return;
if( fieldNdx <= MANDATORY_FIELDS )
if( fieldNdx < MANDATORY_FIELDS )
{
wxBell();
return;
@ -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
// 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
deleteFieldButton->Enable( fieldNdx > VALUE );
deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
fieldValueTextCtrl->SetValue( field.m_Text );

View File

@ -35,14 +35,13 @@
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
#include <class_library.h>
#include <sch_component.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,
wxT( "Cannot edit invalid schematic field." ) );
@ -81,7 +80,6 @@ create a new power component with the new value." ), GetChars( entry->GetName()
wxString title;
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
{
aField->m_Pos = component->GetPosition();
@ -104,7 +102,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
{
if( fieldNdx == REFERENCE )
{
// Test is reference is acceptable:
// Test if the reference string is valid:
if( SCH_COMPONENT::IsReferenceStringValid( newtext ) )
{
component->SetRef( m_CurrentSheet, newtext );
@ -136,10 +134,9 @@ create a new power component with the new value." ), GetChars( entry->GetName()
if( can_update )
{
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
dlg.TransfertDataToField();
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
OnModify();
m_canvas->Refresh();
}
component->DisplayInfo( this );

View File

@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break;
case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item, aDC );
EditComponentFieldText( (SCH_FIELD*) item );
m_canvas->MoveCursorToCrossHair();
break;

View File

@ -811,15 +811,15 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
switch( aEvent.GetId() )
{
case ID_SCH_EDIT_COMPONENT_REFERENCE:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ), &dc );
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ) );
break;
case ID_SCH_EDIT_COMPONENT_VALUE:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ), &dc );
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ) );
break;
case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ), &dc );
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) );
break;
case ID_SCH_EDIT_ITEM:
@ -850,7 +850,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
break;
case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item, &dc );
EditComponentFieldText( (SCH_FIELD*) item );
break;
case SCH_BITMAP_T:

View File

@ -25,8 +25,6 @@
#include "detail/transform_detail.hpp"
#include "detail/polygon_sort_adaptor.hpp"
#include "detail/polygon_sort_adaptor.hpp"
//interval
#include "interval_data.hpp"
#include "interval_traits.hpp"

View File

@ -63,6 +63,7 @@ extern const wxString NetlistFileWildcard;
extern const wxString GerberFileWildcard;
extern const wxString LegacyPcbFileWildcard;
extern const wxString PcbFileWildcard;
extern const wxString EaglePcbFileWildcard;
extern const wxString PdfFileWildcard;
extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard;

View File

@ -238,9 +238,10 @@ public:
* Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if the
* 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
@ -319,10 +320,14 @@ public:
* Function ResetModuleTextSizes
* resets text size and width of all module text fields of given field
* 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 aDC is the drawing context.
* @param aFilter is a filter: footprint names must match this filter.
* an empty filter, or "*" do not filter anything.
* @param aRef = true to modify the reference of footprints.
* @param aValue = true to modify the value of footprints.
* @param aOthers = true to modify the other fields of footprints.
*/
void ResetModuleTextSizes( int aType, wxDC* aDC );
void ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers );
void InstallPadOptionsFrame( D_PAD* pad );
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );

View File

@ -963,7 +963,14 @@ private:
void ConvertPart( 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 );
/**

View File

@ -481,6 +481,13 @@ public:
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
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 MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
@ -921,6 +928,7 @@ public:
// Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
@ -1488,7 +1496,7 @@ public:
void Clean_Pcb( wxDC* DC );
void InstallFindFrame( const wxPoint& pos, wxDC* DC );
void InstallFindFrame();
/**
* Function SendMessageToEESCHEMA

View File

@ -55,6 +55,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_edit_module_text_base.cpp
dialogs/dialog_exchange_modules_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_base.cpp
dialogs/dialog_gendrill.cpp
@ -64,6 +66,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_general_options_BoardEditor_base.cpp
dialogs/dialog_global_edit_tracks_and_vias.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_graphic_items_options.cpp
dialogs/dialog_graphic_items_options_base.cpp
@ -144,7 +148,6 @@ set(PCBNEW_CLASS_SRCS
export_gencad.cpp
export_vrml.cpp
files.cpp
find.cpp
gen_drill_report_files.cpp
gen_holes_and_tools_lists_for_drill.cpp
gen_modules_placefile.cpp

View File

@ -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
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
wxClientDC dc( m_canvas );
INSTALL_UNBUFFERED_DC( dc, m_canvas );
// There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) )
{
screen->SetCrossHairPosition( aPos );
RedrawScreen( aPos, true );
RedrawScreen( aPos, aWarp );
}
else
{
// Put cursor on item position
m_canvas->CrossHairOff( &dc );
screen->SetCrossHairPosition( aPos );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( &dc );
if( aWarp )
m_canvas->MoveCursorToCrossHair();
}
m_canvas->CrossHairOn( &dc );
m_canvas->CrossHairOn( &dc );
}

View File

@ -89,6 +89,12 @@ BOARD::~BOARD()
}
void BOARD::Move( const wxPoint& aMoveVector ) // overload
{
}
void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList )
{
TRACK* segment; // The current segment being analyzed.
@ -1468,7 +1474,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
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 )
{

View File

@ -3,8 +3,8 @@
* @brief Class BOARD to handle a board.
*/
#ifndef CLASS_BOARD_H
#define CLASS_BOARD_H
#ifndef CLASS_BOARD_H_
#define CLASS_BOARD_H_
#include <dlist.h>
@ -255,10 +255,11 @@ public:
BOARD();
~BOARD();
void Move( const wxPoint& aMoveVector ); // overload
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
/**
* Function GetDefaultLayerName
* returns a default name of a PCB layer when given \a aLayerNumber. This
@ -1327,4 +1328,4 @@ public:
TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList );
};
#endif // #ifndef CLASS_BOARD_H
#endif // CLASS_BOARD_H_

View File

@ -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( !IsOnLayer( curr_layer ) )
if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;

View File

@ -42,14 +42,11 @@ class EDA_DRAW_FRAME;
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:
EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT );
// Do not create a copy constructor. The one generated by the compiler is adequate.
// EDGE_MODULE( const EDGE_MODULE& );
~EDGE_MODULE();
@ -90,6 +87,11 @@ public:
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#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_

View File

@ -161,7 +161,10 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre )
{
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
// 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 */
}

View File

@ -50,7 +50,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
EDA_TEXT()
{
MODULE* Module = (MODULE*) m_Parent;
MODULE* module = (MODULE*) m_Parent;
m_Type = text_type; /* Reference */
@ -63,11 +63,11 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
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 )
SetLayer( SILKSCREEN_N_BACK );
@ -120,18 +120,18 @@ int TEXTE_MODULE::GetLength() const
// Update draw coordinates
void TEXTE_MODULE::SetDrawCoord()
{
MODULE* Module = (MODULE*) m_Parent;
MODULE* module = (MODULE*) m_Parent;
m_Pos = m_Pos0;
if( Module == NULL )
if( module == NULL )
return;
int angle = Module->m_Orient;
double angle = module->GetOrientation();
NORMALIZE_ANGLE_POS( 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()
// anchor point)
void TEXTE_MODULE::SetLocalCoord()
{
MODULE* Module = (MODULE*) m_Parent;
MODULE* module = (MODULE*) m_Parent;
if( Module == NULL )
if( module == NULL )
{
m_Pos0 = m_Pos;
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 );
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
wxSize size;
wxPoint pos; // Center of text
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
* parent has no sense) */
@ -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 );
}
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 )
return;
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 )
return;
@ -336,12 +336,12 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
int TEXTE_MODULE::GetDrawRotation() const
{
int rotation;
MODULE* Module = (MODULE*) m_Parent;
MODULE* module = (MODULE*) m_Parent;
rotation = m_Orient;
if( Module )
rotation += Module->m_Orient;
if( module )
rotation += module->m_Orient;
NORMALIZE_ANGLE_POS( rotation );

View File

@ -74,6 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
// For corner moving, corner index to drag, or -1 if no selection
m_CornerSelection = -1;
m_IsFilled = aZone.m_IsFilled;
m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
m_ZoneMinThickness = aZone.m_ZoneMinThickness;
m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
@ -84,6 +85,11 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
m_FilledPolysList = aZone.m_FilledPolysList;
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 )
frame->AppendMsgPanel( _( "Corners" ), msg, BLUE );
if( m_FillMode )
msg.Printf( _( "Segments" ), m_FillMode );
msg = _( "Segments" );
else
msg = _( "Polygons" );

View File

@ -77,58 +77,7 @@ struct SEGMENT
class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM
{
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( const ZONE_CONTAINER& aZone );
@ -257,13 +206,13 @@ public:
* returns the net name.
* @return const wxString& - The net name.
*/
const wxString& GetNetName() const { return m_Netname; };
void SetNetName( const wxString& aName ) { m_Netname = aName; }
const wxString& GetNetName() const { return m_Netname; };
void SetNetName( const wxString& aName ) { m_Netname = aName; }
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
int GetFillMode() const { return m_FillMode; }
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
int GetFillMode() const { return m_FillMode; }
void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
@ -508,6 +457,34 @@ public:
*/
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
* returns a pointer to the corner-smoothed version of
@ -547,6 +524,59 @@ public:
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#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;
};

View File

@ -56,9 +56,6 @@ private:
wxListView* m_LayerSelectionCtrl;
static wxPoint prevPosition; ///< Dialog position & size
static wxSize prevSize;
/**
* Function initDialog
* fills in the dialog controls using the current settings.
@ -108,8 +105,6 @@ private:
// Initialize static member variables
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 )
@ -157,11 +152,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
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()
{
BOARD* board = m_Parent->GetBoard();
SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key
wxString msg;
if( m_settings.m_Zone_45_Only )
@ -297,8 +286,6 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
{
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
prevPosition = GetPosition();
prevSize = GetSize();
if( AcceptOptions( true ) )
{
@ -311,9 +298,6 @@ void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
// called on system close button
void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
{
prevPosition = GetPosition();
prevSize = GetSize();
if( m_OnExitCode != ZONE_ABORT )
*m_ptr = m_settings;
@ -384,7 +368,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
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
#define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch
if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE )
@ -519,9 +503,6 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
{
prevPosition = GetPosition();
prevSize = GetSize();
if( !AcceptOptions( true, true ) )
return;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -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_SIZE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnSize )
EVT_CHOICE( ID_M_NETDISPLAYOPTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected )
@ -23,7 +23,7 @@ BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, wxDialog )
EVT_BUTTON( wxID_CANCEL, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonCancelClick )
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 );
@ -38,6 +38,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_staticText17->Wrap( -1 );
m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer7;
@ -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 );
bSizer7->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptionsBoxSizer->Add( bSizer7, 1, wxEXPAND, 5 );
wxStaticBoxSizer* m_NetSortOptSizer;
@ -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_NetSortOptSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 );
m_OptionsBoxSizer->Add( m_NetSortOptSizer, 0, wxALL, 5 );
m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* m_ExportableSetupSizer;
@ -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 );
bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ExportableSetupSizer->Add( bSizer9, 0, wxEXPAND, 5 );
wxBoxSizer* m_LeftBox;
@ -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_LeftBox->Add( m_ThermalShapesParamsSizer, 0, wxALL|wxEXPAND, 5 );
m_ExportableSetupSizer->Add( m_LeftBox, 0, wxEXPAND, 5 );
wxBoxSizer* m_MiddleBox;
@ -201,6 +208,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_ArcApproximationOpt->SetSelection( 0 );
m_MiddleBox->Add( m_ArcApproximationOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ExportableSetupSizer->Add( m_MiddleBox, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer81;
@ -226,8 +234,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_OutlineAppearanceCtrl->SetSelection( 0 );
bSizer81->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 );
m_MainBoxSizer->Add( m_ExportableSetupSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer10;
@ -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 );
bSizer10->Add( m_ButtonCancel, 0, wxALL|wxEXPAND, 5 );
m_MainBoxSizer->Add( bSizer10, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( m_MainBoxSizer );
this->Layout();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
@ -31,7 +32,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_COPPER_ZONE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_COPPER_ZONE_BASE : public wxDialog
class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
@ -66,7 +67,7 @@ class DIALOG_COPPER_ZONE_BASE : public wxDialog
ID_M_ARCAPPROXIMATIONOPT,
ID_M_ORIENTEDGESOPT,
ID_M_OUTLINEAPPEARANCECTRL,
wxID_BUTTON_EXPORT,
wxID_BUTTON_EXPORT
};
wxBoxSizer* m_MainBoxSizer;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,202 @@
/*
* 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();
}

View File

@ -0,0 +1,70 @@
///////////////////////////////////////////////////////////////////////////
// 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 );
}

View File

@ -0,0 +1,681 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_find_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_find</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_managed">0</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center">wxBOTH</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_FIND_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Find</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">onClose</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Search for:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_SearchTextCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">200,-1</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Do not warp mouse pointer</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_NoMouseWarpCheckBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Find Item</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onButtonFindItemClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Find Marker</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onButtonFindMarkerClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Close</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onButtonCloseClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,61 @@
///////////////////////////////////////////////////////////////////////////
// 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__

View File

@ -0,0 +1,243 @@
/*
* 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();
}

View File

@ -0,0 +1,138 @@
///////////////////////////////////////////////////////////////////////////
// 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 );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
///////////////////////////////////////////////////////////////////////////
// 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__

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -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_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick )
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 );
@ -40,6 +40,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbLeftSizer_->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_UpperSizer->Add( sbLeftSizer_, 0, 0, 5 );
wxStaticBoxSizer* m_OutilinesBoxOpt;
@ -57,6 +58,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_OutlineAppearanceCtrl->SetSelection( 1 );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_UpperSizer->Add( m_OutilinesBoxOpt, 0, 0, 5 );
wxBoxSizer* m_ButtonsSizer;
@ -69,8 +71,10 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_ButtonsSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_UpperSizer->Add( m_ButtonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -80,6 +84,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_MainSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( m_MainSizer );
this->Layout();

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,17 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_non_copper_zones_properties_base__
#define __dialog_non_copper_zones_properties_base__
#ifndef __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__
#define __DIALOG_NON_COPPER_ZONES_PROPERTIES_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/radiobox.h>
#include <wx/gdicmn.h>
@ -29,7 +31,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DialogNonCopperZonesPropertiesBase
///////////////////////////////////////////////////////////////////////////////
class DialogNonCopperZonesPropertiesBase : public wxDialog
class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
@ -51,14 +53,15 @@ class DialogNonCopperZonesPropertiesBase : public wxDialog
wxListBox* m_LayerSelectionCtrl;
// Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
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();
};
#endif //__dialog_non_copper_zones_properties_base__
#endif //__DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__

File diff suppressed because it is too large Load Diff

View File

@ -56,36 +56,18 @@ struct ENET
{}
};
typedef std::map< std::string, ENET > NET_MAP;
/*
#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 std::map< std::string, ENET > NET_MAP;
typedef NET_MAP::const_iterator NET_MAP_CITER;
typedef boost::property_tree::ptree PTREE;
typedef const PTREE CPTREE;
struct EWIRE;
struct EVIA;
struct EROT;
struct EATTR;
struct ECIRCLE;
struct ETEXT;
struct ERECT;
class XPATH;
/**
* 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
{
@ -118,36 +100,46 @@ public:
//-----</PUBLIC PLUGIN API>-------------------------------------------------
typedef int BIU;
typedef int BIU;
EAGLE_PLUGIN();
~EAGLE_PLUGIN();
private:
NET_MAP m_pads_to_nets;
XPATH* m_xpath; ///< keeps track of what we are working on within
///< XML document during a Load().
MODULE_MAP m_templates; ///< is part of a MODULE factory that operates
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
///< using copy construction.
///< lookup key is libname.packagename
PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL.
BOARD* m_board; ///< which BOARD, no ownership here
double mm_per_biu; ///< how many mm in each BIU
double biu_per_mm; ///< how many bius in a mm
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
double mm_per_biu; ///< how many mm in each BIU
double biu_per_mm; ///< how many bius in a mm
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void init( PROPERTIES* aProperties );
/// Convert an Eagle distance to a KiCad distance.
int kicad( double d ) const;
int kicad_y( double y ) const { return -kicad( y ); }
int kicad_x( double x ) const { return kicad( x ); }
/// 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 );
/// Convert a KiCad distance to an Eagle distance.
double eagle( BIU d ) const { return mm_per_biu * d; }
double eagle_x( BIU x ) const { return eagle( x ); }
double eagle_y( BIU y ) const { return eagle( y ); }
@ -180,38 +172,15 @@ private:
// 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 );
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;
/// move the BOARD into the center of the page
void centerBoard();
/**
* Function fmtDEG
@ -235,7 +204,6 @@ private:
void packageCircle( MODULE* aModule, CPTREE& aTree ) const;
void packageHole( MODULE* aModule, CPTREE& aTree ) const;
void packageSMD( MODULE* aModule, CPTREE& aTree ) const;
};
#endif // EAGLE_PLUGIN_H_

View File

@ -81,6 +81,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
case ID_POPUP_PCB_FLIP_TEXTEPCB:
case ID_POPUP_PCB_EDIT_TEXTEPCB:
case ID_POPUP_PCB_EDIT_MIRE:
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
@ -286,7 +287,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_FIND_ITEMS:
InstallFindFrame( pos, &dc );
InstallFindFrame();
break;
case ID_POPUP_CLOSE_CURRENT_TOOL:
@ -578,7 +579,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
// Remove filled areas in zone
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
@ -930,6 +931,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_FLIP_TEXTEPCB:
FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_TEXTEPCB:
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
@ -1078,14 +1084,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Swap_Layers( event );
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:
InstallGridFrame( pos );
break;

View File

@ -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 )
{
int angle = 900;
int drawmode = GR_XOR;
if( TextePcb == NULL )
return;
@ -228,13 +227,34 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
NORMALIZE_ANGLE_POS( TextePcb->m_Orient );
/* Redraw text in new position. */
TextePcb->Draw( m_canvas, DC, drawmode );
TextePcb->Draw( m_canvas, DC, GR_XOR );
TextePcb->DisplayInfo( this );
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
TextePcb->SetFlags( IN_EDIT );
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();
}

View File

@ -1,8 +1,8 @@
/*
* 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) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@ -37,7 +37,7 @@
#include <macros.h>
#include <pcbnew.h>
#include <protos.h>
#include <wxPcbStruct.h>
#include <class_board.h>
#include <class_module.h>
@ -356,107 +356,3 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
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();
}

View File

@ -90,39 +90,39 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
case ID_MENU_RECOVER_BOARD:
{
wxFileName fn;
{
wxFileName fn;
if( id == ID_MENU_RECOVER_BOARD )
{
fn = wxFileName( wxEmptyString, saveFileName, PcbFileExtension );
}
else
{
fn = GetScreen()->GetFileName();
fn.SetExt( pcbBackupFileExtension );
}
if( id == ID_MENU_RECOVER_BOARD )
{
fn = wxFileName( wxEmptyString, saveFileName, PcbFileExtension );
}
else
{
fn = GetScreen()->GetFileName();
fn.SetExt( pcbBackupFileExtension );
}
if( !fn.FileExists() )
{
msg = _( "Recovery file " ) + fn.GetFullPath() + _( " not found." );
DisplayInfoMessage( this, msg );
break;
}
else
{
msg = _( "OK to load recovery file " ) + fn.GetFullPath();
if( !IsOK( this, msg ) )
if( !fn.FileExists() )
{
msg = _( "Recovery file " ) + fn.GetFullPath() + _( " not found." );
DisplayInfoMessage( this, msg );
break;
}
}
else
{
msg = _( "OK to load recovery file " ) + fn.GetFullPath();
LoadOnePcbFile( fn.GetFullPath(), false );
fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() );
UpdateTitle();
if( !IsOK( this, msg ) )
break;
}
LoadOnePcbFile( fn.GetFullPath(), false );
fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() );
UpdateTitle();
}
break;
}
case ID_APPEND_FILE:
LoadOnePcbFile( wxEmptyString, true );
@ -154,8 +154,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend,
bool aForceFileDialog )
{
wxString msg;
if( GetScreen()->IsModify() && !aAppend )
{
if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \
@ -170,12 +168,36 @@ the changes?" ) ) )
GetBoard()->m_Status_Pcb = 0;
}
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 )
{
wxString name;
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() )
{
@ -183,7 +205,7 @@ the changes?" ) ) )
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 );
if( dlg.ShowModal() == wxID_CANCEL )
@ -191,10 +213,15 @@ the changes?" ) ) )
fileName = dlg.GetPath();
if( !fileName.HasExt() )
fileName.SetExt( PcbFileExtension );
int chosenFilter = dlg.GetFilterIndex();
pluginType = loaders[chosenFilter].pluginType;
}
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
if( !fileName.HasExt() )
fileName.SetExt( pi->GetFileExtension() );
if( !aAppend )
Clear_Pcb( false ); // pass false since we prompted above for a modified board
@ -223,14 +250,18 @@ the changes?" ) ) )
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:
loadedBoard = IO_MGR::Load( IO_MGR::LEGACY, GetScreen()->GetFileName(),
aAppend ? GetBoard() : NULL,
NULL );
loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, &props );
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 \
version of Pcbnew. It will be stored in the new file format when you save \

View File

@ -1,380 +0,0 @@
/**
* @file pcbnew/find.cpp
* @brief Pcbnew find dialog box implementation.
*/
#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 <find.h>
static wxString s_OldStringFound;
static int s_ItemCount, s_MarkerCount;
void PCB_EDIT_FRAME::InstallFindFrame( const wxPoint& pos, wxDC* DC )
{
WinEDA_PcbFindFrame* frame = new WinEDA_PcbFindFrame( this, DC, pos );
frame->ShowModal();
frame->Destroy();
}
void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
{
PCB_SCREEN* screen = (PCB_SCREEN*) ( m_Parent->GetScreen() );
wxPoint locate_pos;
wxString msg;
bool FindMarker = false;
BOARD_ITEM* foundItem = 0;
switch( event.GetId() )
{
case ID_FIND_ITEM:
s_ItemCount = 0;
break;
case ID_FIND_MARKER:
s_MarkerCount = 0;
// fall thru
case ID_FIND_NEXT_MARKER:
FindMarker = true;
break;
}
s_OldStringFound = m_NewText->GetValue();
m_Parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
if( FindMarker )
{
MARKER_PCB* marker = m_Parent->GetBoard()->GetMARKER( s_MarkerCount++ );
if( marker )
{
foundItem = marker;
locate_pos = marker->GetPosition();
}
}
else
{
int StartCount = 0;
for( MODULE* module = m_Parent->GetBoard()->m_Modules; module; module = module->Next() )
{
if( WildCompareString( s_OldStringFound, module->GetReference().GetData(), false ) )
{
StartCount++;
if( StartCount > s_ItemCount )
{
foundItem = module;
locate_pos = module->GetPosition();
s_ItemCount++;
break;
}
}
if( WildCompareString( s_OldStringFound, module->m_Value->m_Text.GetData(), false ) )
{
StartCount++;
if( StartCount > s_ItemCount )
{
foundItem = module;
locate_pos = module->m_Pos;
s_ItemCount++;
break;
}
}
}
}
if( foundItem )
{
m_Parent->SetCurItem( foundItem );
if( FindMarker )
msg = _( "Marker found" );
else
msg.Printf( _( "<%s> Found" ), GetChars( s_OldStringFound ) );
m_Parent->SetStatusText( msg );
m_Parent->CursorGoto( locate_pos );
EndModal( 1 );
}
else
{
m_Parent->SetStatusText( wxEmptyString );
if( FindMarker )
msg = _( "Marker not found" );
else
msg.Printf( _( "<%s> Not Found" ), GetChars( s_OldStringFound ) );
DisplayError( this, msg, 10 );
EndModal( 0 );
}
}
/*!
* WinEDA_PcbFindFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbFindFrame, wxDialog )
/*!
* WinEDA_PcbFindFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_PcbFindFrame, wxDialog )
////@begin WinEDA_PcbFindFrame event table entries
EVT_BUTTON( ID_FIND_ITEM, WinEDA_PcbFindFrame::OnFindItemClick )
EVT_BUTTON( ID_FIND_NEXT_ITEM, WinEDA_PcbFindFrame::OnFindNextItemClick )
EVT_BUTTON( ID_FIND_MARKER, WinEDA_PcbFindFrame::OnFindMarkerClick )
EVT_BUTTON( ID_FIND_NEXT_MARKER, WinEDA_PcbFindFrame::OnFindNextMarkerClick )
////@end WinEDA_PcbFindFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_PcbFindFrame constructors
*/
WinEDA_PcbFindFrame::WinEDA_PcbFindFrame()
{
}
WinEDA_PcbFindFrame::WinEDA_PcbFindFrame( PCB_BASE_FRAME* parent,
wxDC* DC,
const wxPoint& pos,
wxWindowID id,
const wxString& caption,
const wxSize& size,
long style )
{
m_Parent = parent;
m_DC = DC;
Create( parent, id, caption, pos, size, style );
m_NewText->SetFocus();
}
/*!
* WinEDA_PcbFindFrame creator
*/
bool WinEDA_PcbFindFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_PcbFindFrame member initialisation
m_NewText = NULL;
////@end WinEDA_PcbFindFrame member initialisation
////@begin WinEDA_PcbFindFrame creation
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
Centre();
////@end WinEDA_PcbFindFrame creation
return true;
}
/*!
* Control creation for WinEDA_PcbFindFrame
*/
void WinEDA_PcbFindFrame::CreateControls()
{
////@begin WinEDA_PcbFindFrame content construction
// Generated by DialogBlocks, 29/04/2009 15:15:49 (unregistered)
WinEDA_PcbFindFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer( itemBoxSizer2 );
wxStaticText* itemStaticText3 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Item to find:" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer2->Add( itemStaticText3,
0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_NewText = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add( m_NewText, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer5,
0,
wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT |
wxBOTTOM,
5 );
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer5->Add( itemBoxSizer6,
0,
wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
wxButton* itemButton7 =
new wxButton( itemDialog1, ID_FIND_ITEM, _( "Find Item" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemButton7->SetDefault();
itemBoxSizer6->Add( itemButton7, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxButton* itemButton8 =
new wxButton( itemDialog1, ID_FIND_NEXT_ITEM, _( "Find Next Item" ),
wxDefaultPosition, wxDefaultSize,
0 );
itemBoxSizer6->Add( itemButton8,
0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer5->Add( itemBoxSizer9,
0,
wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
wxButton* itemButton10 =
new wxButton( itemDialog1, ID_FIND_MARKER, _( "Find Marker" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( itemButton10, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxButton* itemButton11 = new wxButton( itemDialog1,
ID_FIND_NEXT_MARKER,
_( "Find Next Marker" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer9->Add( itemButton11,
0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
////@end WinEDA_PcbFindFrame content construction
}
/*!
* Should we show tooltips?
*/
bool WinEDA_PcbFindFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_PcbFindFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PcbFindFrame bitmap retrieval
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_PcbFindFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_PcbFindFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PcbFindFrame icon retrieval
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_PcbFindFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_ITEM
*/
void WinEDA_PcbFindFrame::OnFindItemClick( wxCommandEvent& event )
{
FindItem( event );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_ITEM
*/
void WinEDA_PcbFindFrame::OnFindNextItemClick( wxCommandEvent& event )
{
FindItem( event );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_MARKER
*/
void WinEDA_PcbFindFrame::OnFindMarkerClick( wxCommandEvent& event )
{
FindItem( event );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_MARKER
*/
void WinEDA_PcbFindFrame::OnFindNextMarkerClick( wxCommandEvent& event )
{
FindItem( event );
}

View File

@ -1,126 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// 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_

View File

@ -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 HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
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 HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
@ -210,8 +210,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkSwitchTrackPosture,
&HkDragTrackKeepSlope,
&HkPlaceItem,
&HkEndTrack, &HkMoveItem,
&HkFlipFootprint, &HkRotateItem, &HkDragFootprint,
&HkEndTrack, &HkMoveItem, &HkFlipItem,
&HkRotateItem, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkLoadfile, &HkFindItem, &HkEditBoardItem,
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,

View File

@ -14,9 +14,9 @@ enum hotkey_id_commnand {
HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE,
HK_ROTATE_ITEM,
HK_FLIP_ITEM,
HK_MOVE_ITEM,
HK_DRAG_ITEM,
HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT,
HK_ADD_NEW_TRACK,

View File

@ -624,9 +624,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
OnHotkeyRotateItem( HK_ROTATE_ITEM );
break;
case HK_FLIP_FOOTPRINT: // move to other side
OnHotkeyRotateItem( HK_FLIP_FOOTPRINT );
case HK_FLIP_ITEM:
OnHotkeyRotateItem( HK_FLIP_ITEM );
break;
case HK_SWITCH_HIGHCONTRAST_MODE: // switch to high contrast mode and refresh the canvas
DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay;
m_canvas->Refresh();
@ -1002,7 +1003,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
if( aIdCommand == HK_ROTATE_ITEM ) // Rotation
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;
}
break;
@ -1010,6 +1011,8 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
case PCB_TEXT_T:
if( aIdCommand == HK_ROTATE_ITEM ) // Rotation
evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB;
else if( aIdCommand == HK_FLIP_ITEM )
evt_type = ID_POPUP_PCB_FLIP_TEXTEPCB;
break;

View File

@ -970,7 +970,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, OUTPUTFORMATTER* aFormatter, int aNe
}
// Save the PolysList
const std::vector< CPolyPt >& fv = aZone->m_FilledPolysList;
const std::vector< CPolyPt >& fv = aZone->GetFilledPolysList();
if( fv.size() )
{

View File

@ -2258,6 +2258,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
else if( TESTLINE( "$POLYSCORNERS" ) )
{
// Read the PolysList (polygons used for fill areas in the zone)
std::vector<CPolyPt> polysList;
while( READLINE( m_reader ) )
{
@ -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
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" ) )
@ -3569,7 +3571,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
}
// Save the PolysList
const CPOLY_PTS& fv = me->m_FilledPolysList;
const CPOLY_PTS& fv = me->GetFilledPolysList();
if( fv.size() )
{
fprintf( m_fp, "$POLYSCORNERS\n" );

View File

@ -295,15 +295,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( swap_layer_xpm ) );
// Reset module reference sizes
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES,
_( "Reset Module &Reference Sizes" ),
_( "Reset text size and width of all module references 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" ),
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
_( "&Reset Module Field Sizes" ),
_( "Reset text size and width of all module fields to current defaults" ),
KiBitmap( reset_text_xpm ) );
/** Create View menu **/

View File

@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ),
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,
_( "Remove Filled Areas in Zone" ), KiBitmap( zone_unfill_xpm ) );
@ -685,7 +685,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
msg, KiBitmap( rotate_module_pos_xpm ) );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
_( "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,
msg, KiBitmap( invert_module_xpm ) );
@ -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 );
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 );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, KiBitmap( edit_text_xpm ) );
AddMenuItem( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE,

View File

@ -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_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_RESET_TEXTMODULE_REFERENCE_SIZES,
PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES,
PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
PCB_EDIT_FRAME::OnResetModuleTextSizes )
// Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )

View File

@ -66,6 +66,7 @@ enum pcbnew_ids
ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
ID_POPUP_PCB_ROTATE_TEXTEPCB,
ID_POPUP_PCB_FLIP_TEXTEPCB,
ID_POPUP_PCB_EDIT_TEXTEPCB,
ID_POPUP_PCB_DELETE_TEXTEPCB,
@ -219,8 +220,7 @@ enum pcbnew_ids
ID_MENU_LIST_NETS,
ID_MENU_PCB_CLEAN,
ID_MENU_PCB_SWAP_LAYERS,
ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES,
ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES,
ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
ID_GEN_EXPORT_FILE_VRML,
ID_GEN_EXPORT_SPECCTRA,

View File

@ -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 )
{
unsigned imax = aZone->m_FilledPolysList.size();
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
unsigned imax = polysList.size();
if( imax == 0 ) // Nothing to draw
return;
@ -540,7 +541,7 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
*/
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) );
if( corner->end_contour ) // Plot the current filled area outline

View File

@ -1152,7 +1152,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
PATH* mainPolygon = new PATH( plane, T_polygon );
plane->SetShape( mainPolygon );
plane->name = TO_UTF8( item->m_Netname );
plane->name = TO_UTF8( item->GetNetName() );
if( plane->name.size() == 0 )
{

View File

@ -800,7 +800,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
if( net ) // net == NULL should not occur
aZone->m_Netname = net->GetNetname();
aZone->SetNetName( net->GetNetname() );
// Combine zones if possible
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );

View File

@ -105,7 +105,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
aZone->m_FilledPolysList.clear();
aZone->ClearFilledPolysList();
aZone->UnFill();
aZone->BuildFilledPolysListData( GetBoard() );

View File

@ -471,6 +471,7 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
KPolygonSet& aKPolyList )
{
int count = 0;
std::vector<CPolyPt> polysList;
for( unsigned ii = 0; ii < aKPolyList.size(); ii++ )
{
@ -487,14 +488,15 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
// Flag this corner if starting a hole connection segment:
// This is used by draw functions to draw only useful segments (and not extra segments)
// corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0;
aZone->m_FilledPolysList.push_back( corner );
polysList.push_back( corner );
count++;
}
corner.end_contour = true;
aZone->m_FilledPolysList.pop_back();
aZone->m_FilledPolysList.push_back( corner );
polysList.pop_back();
polysList.push_back( corner );
}
aZone->AddFilledPolysList( polysList );
return count;
}
@ -503,7 +505,8 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
KPolygonSet& aKPolyList )
{
unsigned corners_count = aZone->m_FilledPolysList.size();
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
unsigned corners_count = polysList.size();
int count = 0;
unsigned ic = 0;
@ -511,7 +514,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
for( unsigned ii = 0; ii < corners_count; ii++ )
{
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
CPolyPt* corner = &polysList[ic];
if( corner->end_contour )
polycount++;
@ -527,7 +530,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
{
for( ; ic < corners_count; ic++ )
{
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
CPolyPt* corner = &polysList[ic];
cornerslist.push_back( KPolyPoint( corner->x, corner->y ) );
count++;

View File

@ -74,7 +74,6 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
SetFocus();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );

View File

@ -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 )
{
if( ref->GetNet() == tst->GetNet() )
return ref->m_FilledPolysList.size() < tst->m_FilledPolysList.size();
return ref->GetFilledPolysList().size() < tst->GetFilledPolysList().size();
else
return ref->GetNet() < tst->GetNet();
}
@ -71,7 +71,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
continue;
if( (aNetcode >= 0) && ( aNetcode != curr_zone->GetNet() ) )
continue;
if( curr_zone->m_FilledPolysList.size() == 0 )
if( curr_zone->GetFilledPolysList().size() == 0 )
continue;
zones_candidates.push_back(curr_zone);
}
@ -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
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
if( curr_zone->m_FilledPolysList[indexend].end_contour )
if( polysList[indexend].end_contour )
{
subnet++;
EDA_RECT bbox = curr_zone->CalculateSubAreaBoundaryBox( indexstart, indexend );
@ -162,7 +163,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
if( bbox.Contains( pos1 ) )
{
if( TestPointInsidePolygon( curr_zone->m_FilledPolysList, indexstart,
if( TestPointInsidePolygon( polysList, indexstart,
indexend, pos1.x, pos1.y ) )
connected = true;
}
@ -170,7 +171,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
{
if( bbox.Contains( pos2 ) )
{
if( TestPointInsidePolygon( curr_zone->m_FilledPolysList,
if( TestPointInsidePolygon( polysList,
indexstart, indexend,
pos2.x, pos2.y ) )
connected = true;

View File

@ -282,7 +282,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{
wxString str;
str.Printf( wxT( "Area %08lX of net \"%s\" has arcs intersecting other sides.\n" ),
aCurrArea->GetTimeStamp(), GetChars( aCurrArea->m_Netname ) );
aCurrArea->GetTimeStamp(), GetChars( aCurrArea->GetNetName() ) );
str += wxT( "This may cause problems with other editing operations,\n" );
str += wxT( "such as adding cutouts. It can't be fixed automatically.\n" );
str += wxT( "Manual correction is recommended." );
@ -305,7 +305,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{
wxString str;
str.Printf( wxT( "Area %08lX of net \"%s\" is self-intersecting and will be clipped.\n" ),
aCurrArea->GetTimeStamp(), GetChars( aCurrArea->m_Netname ) );
aCurrArea->GetTimeStamp(), GetChars( aCurrArea->GetNetName() ) );
str += wxT( "This may result in splitting the area.\n" );
str += wxT( "If the area is complex, this may take a few seconds." );
wxMessageBox( str );
@ -482,7 +482,7 @@ int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode,
str.Printf( wxT( "Areas %d and %d of net \"%s\" intersect, but some of the intersecting sides are arcs.\n" ),
ia1 + 1,
ia2 + 1,
GetChars( curr_area->m_Netname ) );
GetChars( curr_area->GetNetName() ) );
str += wxT( "Therefore, these areas can't be combined." );
wxMessageBox( str );
}