Browse Source
All: remove macros MAX, MIN, ABS from macros.h and replace these macros by std::max, std::min and std::abs (mainly found in old code).
pull/1/head
All: remove macros MAX, MIN, ABS from macros.h and replace these macros by std::max, std::min and std::abs (mainly found in old code).
pull/1/head
69 changed files with 392 additions and 460 deletions
-
24common/base_struct.cpp
-
10common/class_marker_base.cpp
-
2common/common_plotPS_functions.cpp
-
10common/common_plot_functions.cpp
-
12common/drawpanel.cpp
-
12common/drawtxt.cpp
-
3common/eda_text.cpp
-
10common/gr_basic.cpp
-
4common/selcolor.cpp
-
20common/worksheet.cpp
-
3common/zoom.cpp
-
6eeschema/bus-wire-junction.cpp
-
2eeschema/component_references_lister.cpp
-
55eeschema/database.cpp
-
10eeschema/dialogs/dialog_erc.cpp
-
306eeschema/dialogs/dialog_lib_edit_pin.cpp
-
4eeschema/erc.cpp
-
2eeschema/hierarch.cpp
-
8eeschema/lib_arc.cpp
-
14eeschema/lib_bezier.cpp
-
12eeschema/lib_pin.cpp
-
8eeschema/lib_polyline.cpp
-
2eeschema/libeditframe.cpp
-
2eeschema/netlist.cpp
-
2eeschema/plot_schematic_PDF.cpp
-
2eeschema/plot_schematic_PS.cpp
-
38eeschema/protos.h
-
8eeschema/sch_line.cpp
-
2eeschema/sch_no_connect.cpp
-
4eeschema/sch_screen.cpp
-
4eeschema/sch_sheet.cpp
-
2eeschema/sch_text.cpp
-
2eeschema/schframe.cpp
-
3eeschema/selpart.cpp
-
2eeschema/tool_viewlib.cpp
-
2eeschema/viewlib_frame.cpp
-
6gerbview/class_aperture_macro.cpp
-
2gerbview/class_gerber_draw_item.cpp
-
4gerbview/dcode.cpp
-
2gerbview/gerbview_frame.cpp
-
2gerbview/rs274d.cpp
-
12include/macros.h
-
3kicad/mainframe.cpp
-
6pcbnew/autorouter/autoplac.cpp
-
13pcbnew/board_items_to_polygon_shape_transform.cpp
-
6pcbnew/class_board.cpp
-
34pcbnew/class_dimension.cpp
-
8pcbnew/class_drawsegment.cpp
-
4pcbnew/class_module.cpp
-
8pcbnew/class_pad.cpp
-
8pcbnew/class_pad_draw_functions.cpp
-
16pcbnew/class_track.cpp
-
10pcbnew/class_zone.cpp
-
7pcbnew/controle.cpp
-
6pcbnew/dialogs/dialog_SVG_print.cpp
-
6pcbnew/dialogs/dialog_design_rules.cpp
-
10pcbnew/dialogs/dialog_pad_properties.cpp
-
8pcbnew/drc_clearance_test_functions.cpp
-
2pcbnew/edtxtmod.cpp
-
2pcbnew/export_vrml.cpp
-
4pcbnew/gendrill.cpp
-
5pcbnew/gpcb_exchange.cpp
-
4pcbnew/layer_widget.cpp
-
2pcbnew/modedit.cpp
-
16pcbnew/muonde.cpp
-
14pcbnew/plot_rtn.cpp
-
3pcbnew/ratsnest.cpp
-
5pcbnew/specctra.h
-
2pcbnew/zones_polygons_test_connections.cpp
@ -1,153 +1,153 @@ |
|||
#include <fctsys.h>
|
|||
#include <macros.h>
|
|||
#include <gr_basic.h>
|
|||
#include <base_units.h>
|
|||
|
|||
#include <libeditframe.h>
|
|||
#include <class_libentry.h>
|
|||
#include <lib_pin.h>
|
|||
|
|||
#include <dialog_lib_edit_pin.h>
|
|||
|
|||
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : |
|||
DIALOG_LIB_EDIT_PIN_BASE( parent ) |
|||
{ |
|||
// Creates a dummy pin to show on a panel, inside this dialog:
|
|||
m_dummyPin = new LIB_PIN( *aPin ); |
|||
|
|||
// m_dummyPin changes do not propagate to other pins of the current lib component,
|
|||
// so set parent to null and clear flags
|
|||
m_dummyPin->SetParent( NULL ); |
|||
m_dummyPin->ClearFlags(); |
|||
|
|||
m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); |
|||
|
|||
// Set tab order
|
|||
m_textPadName->MoveAfterInTabOrder(m_textPinName); |
|||
m_sdbSizerButtonsOK->SetDefault(); |
|||
} |
|||
|
|||
|
|||
DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN() |
|||
{ |
|||
delete m_dummyPin; |
|||
} |
|||
|
|||
|
|||
/*
|
|||
* Draw (on m_panelShowPin) the pin currently edited |
|||
* accroding to current settings in dialog |
|||
*/ |
|||
void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) |
|||
{ |
|||
wxPaintDC dc( m_panelShowPin ); |
|||
wxSize dc_size = dc.GetSize(); |
|||
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 ); |
|||
|
|||
// Give a parent to m_dummyPin only from draw purpose.
|
|||
// In fact m_dummyPin should not have a parent, but draw functions need a parent
|
|||
// to know some options, about pin texts
|
|||
LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); |
|||
m_dummyPin->SetParent( libframe->GetComponent() ); |
|||
|
|||
// Calculate a suitable scale to fit the available draw area
|
|||
EDA_RECT bBox = m_dummyPin->GetBoundingBox(); |
|||
double xscale = (double) dc_size.x / bBox.GetWidth(); |
|||
double yscale = (double) dc_size.y / bBox.GetHeight(); |
|||
double scale = MIN( xscale, yscale ); |
|||
|
|||
// Give a 10% margin
|
|||
scale *= 0.9; |
|||
dc.SetUserScale( scale, scale ); |
|||
|
|||
wxPoint offset = bBox.Centre(); |
|||
NEGATE( offset.x ); |
|||
NEGATE( offset.y ); |
|||
|
|||
GRResetPenAndBrush( &dc ); |
|||
m_dummyPin->Draw( NULL, &dc, offset, UNSPECIFIED_COLOR, GR_COPY, |
|||
NULL, DefaultTransform ); |
|||
|
|||
m_dummyPin->SetParent(NULL); |
|||
|
|||
event.Skip(); |
|||
} |
|||
|
|||
void DIALOG_LIB_EDIT_PIN::OnCloseDialog( wxCloseEvent& event ) |
|||
{ |
|||
EndModal( wxID_CANCEL ); |
|||
} |
|||
|
|||
void DIALOG_LIB_EDIT_PIN::OnCancelButtonClick( wxCommandEvent& event ) |
|||
{ |
|||
EndModal( wxID_CANCEL ); |
|||
} |
|||
|
|||
void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) |
|||
{ |
|||
EndModal( wxID_OK ); |
|||
} |
|||
|
|||
// Called when a pin properties changes
|
|||
void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) |
|||
{ |
|||
if( ! IsShown() ) // do nothing at init time
|
|||
return; |
|||
|
|||
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize() ); |
|||
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize()); |
|||
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); |
|||
int pinLength = ReturnValueFromString( g_UserUnit, GetLength() ); |
|||
int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); |
|||
int pinType = GetElectricalType(); |
|||
|
|||
m_dummyPin->SetName( GetName() ); |
|||
m_dummyPin->SetNameTextSize( pinNameSize ); |
|||
m_dummyPin->SetNumber( GetPadName() ); |
|||
m_dummyPin->SetNumberTextSize( pinNumSize ); |
|||
m_dummyPin->SetOrientation( pinOrient ); |
|||
m_dummyPin->SetLength( pinLength ); |
|||
m_dummyPin->SetShape( pinShape ); |
|||
m_dummyPin->SetVisible( GetVisible() ); |
|||
m_dummyPin->SetType( pinType ); |
|||
|
|||
m_panelShowPin->Refresh(); |
|||
} |
|||
|
|||
|
|||
void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list, |
|||
const BITMAP_DEF* aBitmaps ) |
|||
{ |
|||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ ) |
|||
{ |
|||
if( aBitmaps == NULL ) |
|||
m_choiceOrientation->Append( list[ii] ); |
|||
else |
|||
m_choiceOrientation->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii ); |
|||
} |
|||
} |
|||
|
|||
|
|||
void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list, |
|||
const BITMAP_DEF* aBitmaps ) |
|||
{ |
|||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ ) |
|||
{ |
|||
if( aBitmaps == NULL ) |
|||
m_choiceElectricalType->Append( list[ii] ); |
|||
else |
|||
m_choiceElectricalType->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii ); |
|||
} |
|||
} |
|||
|
|||
|
|||
void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps ) |
|||
{ |
|||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ ) |
|||
{ |
|||
if( aBitmaps == NULL ) |
|||
m_choiceStyle->Append( list[ii] ); |
|||
else |
|||
m_choiceStyle->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii ); |
|||
} |
|||
} |
|||
#include <fctsys.h>
|
|||
#include <macros.h>
|
|||
#include <gr_basic.h>
|
|||
#include <base_units.h>
|
|||
|
|||
#include <libeditframe.h>
|
|||
#include <class_libentry.h>
|
|||
#include <lib_pin.h>
|
|||
|
|||
#include <dialog_lib_edit_pin.h>
|
|||
|
|||
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : |
|||
DIALOG_LIB_EDIT_PIN_BASE( parent ) |
|||
{ |
|||
// Creates a dummy pin to show on a panel, inside this dialog:
|
|||
m_dummyPin = new LIB_PIN( *aPin ); |
|||
|
|||
// m_dummyPin changes do not propagate to other pins of the current lib component,
|
|||
// so set parent to null and clear flags
|
|||
m_dummyPin->SetParent( NULL ); |
|||
m_dummyPin->ClearFlags(); |
|||
|
|||
m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); |
|||
|
|||
// Set tab order
|
|||
m_textPadName->MoveAfterInTabOrder(m_textPinName); |
|||
m_sdbSizerButtonsOK->SetDefault(); |
|||
} |
|||
|
|||
|
|||
DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN() |
|||
{ |
|||
delete m_dummyPin; |
|||
} |
|||
|
|||
|
|||
/*
|
|||
* Draw (on m_panelShowPin) the pin currently edited |
|||
* accroding to current settings in dialog |
|||
*/ |
|||
void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) |
|||
{ |
|||
wxPaintDC dc( m_panelShowPin ); |
|||
wxSize dc_size = dc.GetSize(); |
|||
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 ); |
|||
|
|||
// Give a parent to m_dummyPin only from draw purpose.
|
|||
// In fact m_dummyPin should not have a parent, but draw functions need a parent
|
|||
// to know some options, about pin texts
|
|||
LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); |
|||
m_dummyPin->SetParent( libframe->GetComponent() ); |
|||
|
|||
// Calculate a suitable scale to fit the available draw area
|
|||
EDA_RECT bBox = m_dummyPin->GetBoundingBox(); |
|||
double xscale = (double) dc_size.x / bBox.GetWidth(); |
|||
double yscale = (double) dc_size.y / bBox.GetHeight(); |
|||
double scale = std::min( xscale, yscale ); |
|||
|
|||
// Give a 10% margin
|
|||
scale *= 0.9; |
|||
dc.SetUserScale( scale, scale ); |
|||
|
|||
wxPoint offset = bBox.Centre(); |
|||
NEGATE( offset.x ); |
|||
NEGATE( offset.y ); |
|||
|
|||
GRResetPenAndBrush( &dc ); |
|||
m_dummyPin->Draw( NULL, &dc, offset, UNSPECIFIED_COLOR, GR_COPY, |
|||
NULL, DefaultTransform ); |
|||
|
|||
m_dummyPin->SetParent(NULL); |
|||
|
|||
event.Skip(); |
|||
} |
|||
|
|||
void DIALOG_LIB_EDIT_PIN::OnCloseDialog( wxCloseEvent& event ) |
|||
{ |
|||
EndModal( wxID_CANCEL ); |
|||
} |
|||
|
|||
void DIALOG_LIB_EDIT_PIN::OnCancelButtonClick( wxCommandEvent& event ) |
|||
{ |
|||
EndModal( wxID_CANCEL ); |
|||
} |
|||
|
|||
void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) |
|||
{ |
|||
EndModal( wxID_OK ); |
|||
} |
|||
|
|||
// Called when a pin properties changes
|
|||
void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) |
|||
{ |
|||
if( ! IsShown() ) // do nothing at init time
|
|||
return; |
|||
|
|||
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize() ); |
|||
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize()); |
|||
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); |
|||
int pinLength = ReturnValueFromString( g_UserUnit, GetLength() ); |
|||
int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); |
|||
int pinType = GetElectricalType(); |
|||
|
|||
m_dummyPin->SetName( GetName() ); |
|||
m_dummyPin->SetNameTextSize( pinNameSize ); |
|||
m_dummyPin->SetNumber( GetPadName() ); |
|||
m_dummyPin->SetNumberTextSize( pinNumSize ); |
|||
m_dummyPin->SetOrientation( pinOrient ); |
|||
m_dummyPin->SetLength( pinLength ); |
|||
m_dummyPin->SetShape( pinShape ); |
|||
m_dummyPin->SetVisible( GetVisible() ); |
|||
m_dummyPin->SetType( pinType ); |
|||
|
|||
m_panelShowPin->Refresh(); |
|||
} |
|||
|
|||
|
|||
void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list, |
|||
const BITMAP_DEF* aBitmaps ) |
|||
{ |
|||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ ) |
|||
{ |
|||
if( aBitmaps == NULL ) |
|||
m_choiceOrientation->Append( list[ii] ); |
|||
else |
|||
m_choiceOrientation->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii ); |
|||
} |
|||
} |
|||
|
|||
|
|||
void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list, |
|||
const BITMAP_DEF* aBitmaps ) |
|||
{ |
|||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ ) |
|||
{ |
|||
if( aBitmaps == NULL ) |
|||
m_choiceElectricalType->Append( list[ii] ); |
|||
else |
|||
m_choiceElectricalType->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii ); |
|||
} |
|||
} |
|||
|
|||
|
|||
void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps ) |
|||
{ |
|||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ ) |
|||
{ |
|||
if( aBitmaps == NULL ) |
|||
m_choiceStyle->Append( list[ii] ); |
|||
else |
|||
m_choiceStyle->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii ); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue