Commit b8a6c53b authored by charras's avatar charras

Some minor changes and enhancements

parent e8cb60f9
......@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#define BUILD_VERSION "(20091021-unstable)"
#define BUILD_VERSION "(20091024-unstable)"
#ifdef HAVE_SVN_VERSION
......
......@@ -97,15 +97,25 @@ WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
{
Centre();
}
else // Ensure the window dialog is on screen :
else // Ensure the window dialog is inside the main window :
{
wxPoint pos;
m_Parent->GetPosition( &pos.x, &pos.y );
if( pos.x < 0 )
pos.x = 0;
if( pos.y < 0 )
pos.y = 0;
pos.x += 20; pos.y += 30;
wxPoint pos = dialog_position;
wxPoint maxpos;
maxpos.x = parent->GetPosition().x + parent->GetSize().x;
maxpos.y = parent->GetPosition().y + parent->GetSize().y;
wxPoint endpoint;
endpoint.x = pos.x + GetSize().x;
endpoint.y = pos.y + GetSize().y;
if( endpoint.x > maxpos.x )
pos.x -= endpoint.x - maxpos.x;
if( endpoint.y > maxpos.y )
pos.y -= endpoint.y - maxpos.y;
if( pos.x < parent->GetPosition().x )
pos.x = parent->GetPosition().x;
if( pos.y < parent->GetPosition().y )
pos.y = parent->GetPosition().y;
Move( pos );
}
}
......
......@@ -88,9 +88,9 @@ void WinEDA_CvpcbFrame::BuildCmpListBox()
BOOST_FOREACH( COMPONENT & component, m_components ) {
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
component.m_Reference.GetData(),
component.m_Value.GetData(),
component.m_Module.GetData() );
GetChars(component.m_Reference),
GetChars(component.m_Value),
GetChars(component.m_Module) );
m_ListCmp->m_ComponentList.Add( msg );
}
......
......@@ -23,7 +23,7 @@ static int CodeOrient[4] =
#define NBSHAPES 7
static wxString shape_list[NBSHAPES] =
{
_( "line" ), _( "invert" ), _( "clock" ), _( "clock inv" ),
_( "line" ), _( "invert" ), _( "clock" ), _( "clock inv" ),
_( "low in" ), _( "low clock" ), _( "low out" )
};
......@@ -572,10 +572,10 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
if( g_EditPinByPinIsOn == false )
CurrentPin->m_Flags |= IS_LINKED;
CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x;
CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y;
CurrentPin->m_PinLen = LastPinSize;
CurrentPin->m_Orient = LastPinOrient;
CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x;
CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y;
CurrentPin->m_PinLen = LastPinSize;
CurrentPin->m_Orient = LastPinOrient;
CurrentPin->m_PinType = LastPinType;
CurrentPin->m_PinShape = LastPinShape;
CurrentPin->m_PinNameSize = LastPinNameSize;
......@@ -931,13 +931,18 @@ bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
}
/* Test for duplicate pins:
/* Test for duplicate pins and off grid pins:
* Pins are considered off grid when they are not on the 25 mils grid
* A grid smaller than 25 mils must be used only to build graphic shapes.
*/
void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
{
int error;
#define MIN_GRID_SIZE 25
int dup_error;
int offgrid_error;
LIB_PIN* Pin;
wxString msg;
wxString aux_msg;
if( m_component == NULL )
return;
......@@ -962,13 +967,11 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
sort( PinList.begin(), PinList.end(), sort_by_pin_number );
// Test for duplicates:
error = 0;
DIALOG_DISPLAY_HTML_TEXT_BASE
error_display( this, wxID_ANY, _( "Marker Info" ),
wxDefaultPosition, wxSize( 750, 600 ) );
dup_error = 0;
DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY, _( "Marker Info" ),
wxDefaultPosition, wxSize( 750, 600 ) );
for( unsigned ii = 1; ii < PinList.size(); ii++ )
{
wxString aux_msg;
wxString stringPinNum, stringCurrPinNum;
LIB_PIN* curr_pin = PinList[ii];
......@@ -979,7 +982,7 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
|| Pin->m_Unit != curr_pin->m_Unit )
continue;
error++;
dup_error++;
Pin->ReturnPinStringNum( stringPinNum );
curr_pin->ReturnPinStringNum( stringCurrPinNum );
msg.Printf( _(
......@@ -1007,12 +1010,50 @@ with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>"
}
msg += wxT( ".<br>" );
error_display.m_htmlWindow->AppendToPage( msg );
}
// Test for off grid pins:
offgrid_error = 0;
for( unsigned ii = 0; ii < PinList.size(); ii++ )
{
Pin = PinList[ii];
if( ( (Pin->m_Pos.x % MIN_GRID_SIZE) == 0 ) &&
( (Pin->m_Pos.y % MIN_GRID_SIZE) == 0 ) )
continue;
// A pin is foun here off grid
offgrid_error++;
wxString stringPinNum;
Pin->ReturnPinStringNum( stringPinNum );
msg.Printf( _( "<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( stringPinNum ),
GetChars( Pin->m_PinName ),
(float) Pin->m_Pos.x / 1000.0, (float) -Pin->m_Pos.y / 1000.0
);
if( m_component->GetPartCount() > 1 )
{
aux_msg.Printf( _( " in part %c" ), 'A' + Pin->m_Unit );
msg += aux_msg;
}
if( m_showDeMorgan )
{
if( Pin->m_Convert )
msg += _( " of converted" );
else
msg += _( " of normal" );
}
msg += wxT( ".<br>" );
error_display.m_htmlWindow->AppendToPage( msg );
}
if( error == 0 )
DisplayInfoMessage( this, _( "No duplicate pins were found." ) );
if( !dup_error && !offgrid_error )
DisplayInfoMessage( this, _( "No off grid or duplicate pins were found." ) );
else
error_display.ShowModal();
}
......@@ -153,7 +153,7 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
wxBitmap( erc_xpm ), _( "Test for duplicate pins" ) );
wxBitmap( erc_xpm ), _( "Test for duplicate pins and off grid pins" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
......
No preview for this file type
This diff is collapsed.
......@@ -266,16 +266,16 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( fillpad )
{
GRFillCSegm( &panel->m_ClipBox, DC,
ux0 + delta_cx + mask_margin, uy0 + delta_cy + mask_margin,
ux0 - delta_cx - mask_margin, uy0 - delta_cy - mask_margin,
rotdx, color );
ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy,
rotdx + mask_margin, color );
}
else
{
GRCSegm( &panel->m_ClipBox, DC,
ux0 + delta_cx + mask_margin, uy0 + delta_cy + mask_margin,
ux0 - delta_cx - mask_margin, uy0 - delta_cy - mask_margin,
rotdx, color );
ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy,
rotdx + mask_margin, color );
}
/* Trace de la marge d'isolement */
......@@ -293,20 +293,20 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
case PAD_TRAPEZOID:
{
int ddx, ddy;
ddx = (m_DeltaSize.x >> 1) + mask_margin;
ddy = (m_DeltaSize.y >> 1) + mask_margin; /* demi dim dx et dy */
ddx = (m_DeltaSize.x >> 1);
ddy = (m_DeltaSize.y >> 1); /* demi dim dx et dy */
coord[0].x = -dx - ddy;
coord[0].y = +dy + ddx;
coord[0].x = -dx - ddy - mask_margin;
coord[0].y = +dy + ddx + mask_margin;
coord[1].x = -dx + ddy;
coord[1].y = -dy - ddx;
coord[1].x = -dx + ddy - mask_margin;
coord[1].y = -dy - ddx - mask_margin;
coord[2].x = +dx - ddy;
coord[2].y = -dy + ddx;
coord[2].x = +dx - ddy + mask_margin;
coord[2].y = -dy + ddx - mask_margin;
coord[3].x = +dx + ddy;
coord[3].y = +dy - ddx;
coord[3].x = +dx + ddy + mask_margin;
coord[3].y = +dy - ddx + mask_margin;
for( ii = 0; ii < 4; ii++ )
{
......
......@@ -91,6 +91,7 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent ) :
Layout();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Center();
}
......
......@@ -258,7 +258,7 @@ void DialogLayerSetup::SetLayerType( int Layer, LAYER_T Type )
}
//==============================================================================
// The layer mask for non-copper layers is obtained from the new
// The layer mask for non-copper layers is obtained from the new
// EDA_BoardDesignSettings::m*EnabledLayers, but for compatibility, the mask
// for the copper-layers is obtained from g_DesignSettings::m_CopperLayerCount
......@@ -445,7 +445,7 @@ DialogLayerSetup::DialogLayerSetup( WinEDA_PcbFrame* parent, const wxPoint& pos,
// The copper layer names can be changed, we need a text control
m_LayerNameTextCtrl[Layer] = new wxTextCtrl( m_LayerNamePanel[Layer], ID_LAYERNAMES + Layer, GetLayerName( Layer ), wxDefaultPosition, wxDefaultSize, 0 /*|wxNO_BORDER*/ );
m_LayerNameTextCtrl[Layer]->SetMaxLength( 20 );
m_LayerNameTextCtrl[Layer]->SetMaxLength( 20 );
#if CONTROL_BACKGROUND_COLORED
m_LayerNameTextCtrl[Layer]->SetBackgroundColour( GetRowColor( Layer ));
......@@ -659,6 +659,8 @@ DialogLayerSetup::DialogLayerSetup( WinEDA_PcbFrame* parent, const wxPoint& pos,
m_LayerEnabledCheckBox[i]->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DialogLayerSetup::OnLayerEnabledKillFocus ), NULL, this );
m_LayerEnabledCheckBox[i]->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DialogLayerSetup::OnLayerEnabledSetFocus ), NULL, this );
}
Centre();
}
//==============================================================================
......@@ -994,7 +996,7 @@ void DialogLayerSetup::OnOKClick( wxCommandEvent& event )
if( m_LayersMask >> i & 0x00000001 )
NumberOfCopperLayers++;
}
m_Pcb->m_BoardSettings->m_CopperLayerCount = NumberOfCopperLayers;
m_Pcb->SetEnabledLayers( m_LayersMask );
......
......@@ -362,7 +362,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
WinEDAListBox* ListBox = new WinEDAListBox( active_window, wxEmptyString,
NULL, OldName, DisplayCmpDoc,
wxColour( 200, 200, 255 ),GetScreen()->m_Curseur );
wxColour( 200, 200, 255 ),
GetComponentDialogPosition());
wxBeginBusyCursor();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment