Commit ccfa4e0a authored by charras's avatar charras

Eeschema: Libedit: fixed hang when using the repeat function (insert key) after creating a pin.

Fixed others minor problems 
parent d1f2a16c
...@@ -76,13 +76,14 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -76,13 +76,14 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Green,
ColorRefs[g_DrawBgColor].m_Blue ) ); ColorRefs[g_DrawBgColor].m_Blue ) );
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
EnableScrolling( TRUE, TRUE ); EnableScrolling( TRUE, TRUE );
m_ClipBox.SetSize( size ); m_ClipBox.SetSize( size );
m_ClipBox.SetX( 0 ); m_ClipBox.SetX( 0 );
m_ClipBox.SetY( 0 ); m_ClipBox.SetY( 0 );
m_CanStartBlock = -1; // Command block can start if >= 0 m_CanStartBlock = -1; // Command block can start if >= 0
m_AbortEnable = m_AbortRequest = FALSE; m_AbortEnable = m_AbortRequest = false;
m_AutoPAN_Enable = TRUE; m_AutoPAN_Enable = TRUE;
m_IgnoreMouseEvents = 0; m_IgnoreMouseEvents = 0;
...@@ -93,8 +94,8 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -93,8 +94,8 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable,
true ); true );
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
m_Block_Enable = FALSE; m_Block_Enable = false;
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW; m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
m_CursorLevel = 0; m_CursorLevel = 0;
m_PrintIsMirrored = false; m_PrintIsMirrored = false;
...@@ -212,7 +213,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) ...@@ -212,7 +213,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
/** Function IsPointOnDisplay /** Function IsPointOnDisplay
* @param ref_pos is the position to test in pixels, relative to the panel. * @param ref_pos is the position to test in pixels, relative to the panel.
* @return TRUE if ref_pos is a point currently visible on screen * @return TRUE if ref_pos is a point currently visible on screen
* FALSE if ref_pos is out of screen * false if ref_pos is out of screen
*/ */
bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
{ {
...@@ -225,7 +226,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) ...@@ -225,7 +226,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
// Slightly decreased the size of the useful screen area to avoid drawing // Slightly decreased the size of the useful screen area to avoid drawing
// limits. // limits.
#define PIXEL_MARGIN 8 #define PIXEL_MARGIN 8
display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN ); display_rect.Inflate( -PIXEL_MARGIN );
// Convert physical coordinates. // Convert physical coordinates.
pos = CalcUnscrolledPosition( display_rect.GetPosition() ); pos = CalcUnscrolledPosition( display_rect.GetPosition() );
...@@ -564,11 +565,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) ...@@ -564,11 +565,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
// Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187 // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
paintDC.GetGraphicsContext()->Translate(0.5, 0.5); paintDC.GetGraphicsContext()->Translate(0.5, 0.5);
#else #else
#ifdef KICAD_USE_BUFFERED_DC INSTALL_PAINTDC( paintDC, this );
wxBufferedPaintDC paintDC( this );
#else
wxPaintDC paintDC( this );
#endif
#endif #endif
EDA_Rect tmp; EDA_Rect tmp;
wxRect PaintClipBox; wxRect PaintClipBox;
...@@ -622,7 +619,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) ...@@ -622,7 +619,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#endif #endif
// Be sure the drawpanel clipbox is bigger than the region to repair: // Be sure the drawpanel clipbox is bigger than the region to repair:
m_ClipBox.Inflate(1,1); // Give it one pixel more in each direction m_ClipBox.Inflate(1); // Give it one pixel more in each direction
#if 0 && defined (DEBUG) #if 0 && defined (DEBUG)
printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n", printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
...@@ -705,7 +702,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -705,7 +702,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
int ii, jj, xg, yg, color; int ii, jj, xg, yg, color;
wxRealPoint screen_grid_size; wxRealPoint screen_grid_size;
bool drawgrid = FALSE; bool drawgrid = false;
wxSize size; wxSize size;
wxPoint org; wxPoint org;
...@@ -729,7 +726,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -729,7 +726,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
dgrid.x *= 2; dgrid.x *= 2;
} }
if( dgrid.x < 5 ) if( dgrid.x < 5 )
drawgrid = FALSE; // The grid is too small: do not show it drawgrid = false; // The grid is too small: do not show it
if( dgrid.y < 5 ) if( dgrid.y < 5 )
{ {
...@@ -737,7 +734,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -737,7 +734,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
dgrid.y *= 2; dgrid.y *= 2;
} }
if( dgrid.y < 5 ) if( dgrid.y < 5 )
drawgrid = FALSE; // The grid is too small drawgrid = false; // The grid is too small
GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj );
...@@ -856,7 +853,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event ) ...@@ -856,7 +853,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
m_IgnoreMouseEvents = TRUE; m_IgnoreMouseEvents = TRUE;
PopupMenu( &MasterMenu, pos ); PopupMenu( &MasterMenu, pos );
MouseToCursorSchema(); MouseToCursorSchema();
m_IgnoreMouseEvents = FALSE; m_IgnoreMouseEvents = false;
return true; return true;
} }
...@@ -866,7 +863,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event ) ...@@ -866,7 +863,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event ) void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
{ {
if( ManageCurseur == NULL ) // No command in progress. if( ManageCurseur == NULL ) // No command in progress.
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents ) if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
return; return;
...@@ -899,11 +896,12 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) ...@@ -899,11 +896,12 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled() if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) ) || !rect.Contains( event.GetPosition() ) )
{ {
#if 0
wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " ) \ wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " ) \
wxT( "rectangle(%d, %d, %d, %d)" ), wxT( "rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y, event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height ); rect.x, rect.y, rect.width, rect.height );
#endif
event.Skip(); event.Skip();
return; return;
} }
...@@ -964,7 +962,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -964,7 +962,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
} }
if( ManageCurseur == NULL ) // No command in progress if( ManageCurseur == NULL ) // No command in progress
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
if( m_Parent->m_FrameIsActive ) if( m_Parent->m_FrameIsActive )
SetFocus(); SetFocus();
...@@ -1123,7 +1121,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1123,7 +1121,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
{ {
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{ {
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
m_Parent->HandleBlockPlace( &DC ); m_Parent->HandleBlockPlace( &DC );
s_IgnoreNextLeftButtonRelease = true; s_IgnoreNextLeftButtonRelease = true;
} }
...@@ -1188,13 +1186,13 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1188,13 +1186,13 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( ForceCloseManageCurseur ) if( ForceCloseManageCurseur )
{ {
ForceCloseManageCurseur( this, &DC ); ForceCloseManageCurseur( this, &DC );
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
} }
SetCursor( m_PanelCursor = m_PanelDefaultCursor ); SetCursor( m_PanelCursor = m_PanelDefaultCursor );
} }
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END ) else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
{ {
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
m_Parent->HandleBlockEnd( &DC ); m_Parent->HandleBlockEnd( &DC );
SetCursor( m_PanelCursor = m_PanelDefaultCursor ); SetCursor( m_PanelCursor = m_PanelDefaultCursor );
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
...@@ -1216,7 +1214,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1216,7 +1214,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( ForceCloseManageCurseur ) if( ForceCloseManageCurseur )
{ {
ForceCloseManageCurseur( this, &DC ); ForceCloseManageCurseur( this, &DC );
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = false;
} }
} }
} }
...@@ -1237,7 +1235,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1237,7 +1235,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
{ {
long key, localkey; long key, localkey;
bool escape = FALSE; bool escape = false;
wxPoint pos; wxPoint pos;
key = localkey = event.GetKeyCode(); key = localkey = event.GetKeyCode();
......
...@@ -1561,7 +1561,7 @@ void LIB_POLYLINE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1561,7 +1561,7 @@ void LIB_POLYLINE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( Buf_Poly_Drawings == NULL ) if( Buf_Poly_Drawings == NULL )
{ {
DisplayError( NULL, _( "Cannot allocate memory to draw polylines." ) ); DisplayError( NULL, wxT( "Cannot allocate memory to draw polylines." ) );
} }
} }
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">&amp;Name:</property> <property name="label">Pin &amp;name:</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticText1</property> <property name="name">m_staticText1</property>
...@@ -376,7 +376,7 @@ ...@@ -376,7 +376,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">N&amp;umber:</property> <property name="label">Pin n&amp;umber:</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticText4</property> <property name="name">m_staticText4</property>
...@@ -385,7 +385,7 @@ ...@@ -385,7 +385,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip">Pin number: 1 to 4 ASCII letters and/or digits</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -918,7 +918,7 @@ ...@@ -918,7 +918,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">&amp;Electical type:</property> <property name="label">&amp;Electrical type:</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticText6</property> <property name="name">m_staticText6</property>
...@@ -927,7 +927,7 @@ ...@@ -927,7 +927,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip">Used by the ERC.</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1060,7 +1060,7 @@ ...@@ -1060,7 +1060,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">&amp;Style:</property> <property name="label">Graphic &amp;Style:</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticText7</property> <property name="name">m_staticText7</property>
......
...@@ -21,7 +21,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID ...@@ -21,7 +21,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
...@@ -42,8 +42,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID ...@@ -42,8 +42,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_staticNameTextSizeUnits->Wrap( -1 ); m_staticNameTextSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticNameTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticNameTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("N&umber:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText4 = new wxStaticText( this, wxID_ANY, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 ); m_staticText4->Wrap( -1 );
m_staticText4->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
fgSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_textNumber = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textNumber = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
...@@ -86,8 +88,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID ...@@ -86,8 +88,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
m_staticLengthUnits->Wrap( -1 ); m_staticLengthUnits->Wrap( -1 );
fgSizer1->Add( m_staticLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("&Electical type:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText6 = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 ); m_staticText6->Wrap( -1 );
m_staticText6->SetToolTip( _("Used by the ERC.") );
fgSizer1->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
wxArrayString m_choiceElectricalTypeChoices; wxArrayString m_choiceElectricalTypeChoices;
...@@ -107,7 +111,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID ...@@ -107,7 +111,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1->Add( 0, 0, 0, wxEXPAND, 3 ); fgSizer1->Add( 0, 0, 0, wxEXPAND, 3 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("&Style:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText7 = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 ); m_staticText7->Wrap( -1 );
fgSizer1->Add( m_staticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
......
...@@ -654,6 +654,9 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -654,6 +654,9 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
INSTALL_DC( dc, DrawPanel ); INSTALL_DC( dc, DrawPanel );
switch( id ) switch( id )
{ {
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
break;
case ID_LIBEDIT_SELECT_CURRENT_LIB: case ID_LIBEDIT_SELECT_CURRENT_LIB:
SelectActiveLibrary(); SelectActiveLibrary();
break; break;
......
...@@ -178,8 +178,12 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC ) ...@@ -178,8 +178,12 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
wxPoint newpos; wxPoint newpos;
bool status; bool status;
if( CurrentPin == NULL ) // Some tests
if( (CurrentPin == NULL) || (CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE) )
{
wxMessageBox( wxT("WinEDA_LibeditFrame::PlacePin() error") );
return; return;
}
newpos.x = GetScreen()->m_Curseur.x; newpos.x = GetScreen()->m_Curseur.x;
newpos.y = -GetScreen()->m_Curseur.y; newpos.y = -GetScreen()->m_Curseur.y;
...@@ -544,20 +548,15 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) ...@@ -544,20 +548,15 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
{ {
LIB_PIN* Pin; LIB_PIN* Pin;
wxString msg; wxString msg;
int ox = 0, oy = 0;
if( m_component == NULL || SourcePin == NULL if( m_component == NULL || SourcePin == NULL
|| SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) || SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE )
return; return;
Pin = (LIB_PIN*) SourcePin->GenCopy(); Pin = (LIB_PIN*) SourcePin->GenCopy();
m_component->AddDrawItem( Pin );
Pin->m_Flags = IS_NEW; Pin->m_Flags = IS_NEW;
Pin->m_Pos.x += g_RepeatStep.x; Pin->m_Pos.x += g_RepeatStep.x;
ox = Pin->m_Pos.x;
Pin->m_Pos.y += -g_RepeatStep.y; Pin->m_Pos.y += -g_RepeatStep.y;
oy = Pin->m_Pos.y;
IncrementLabelMember( Pin->m_PinName ); IncrementLabelMember( Pin->m_PinName );
Pin->ReturnPinStringNum( msg ); Pin->ReturnPinStringNum( msg );
...@@ -573,7 +572,12 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) ...@@ -573,7 +572,12 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur.x = Pin->m_Pos.x; GetScreen()->m_Curseur.x = Pin->m_Pos.x;
GetScreen()->m_Curseur.y = -Pin->m_Pos.y; GetScreen()->m_Curseur.y = -Pin->m_Pos.y;
// Add this new pin in list, and creates pins for others parts if needed
m_drawItem = Pin;
PlacePin( DC ); PlacePin( DC );
m_lastDrawItem = Pin;
GetScreen()->m_Curseur = savepos; GetScreen()->m_Curseur = savepos;
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
......
...@@ -214,7 +214,13 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry, ...@@ -214,7 +214,13 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
Text->m_Orient = m_textOrientation; Text->m_Orient = m_textOrientation;
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->m_Curseur;
NEGATE( Text->m_Pos.y ); NEGATE( Text->m_Pos.y );
// Enter the graphic text info
DrawPanel->m_IgnoreMouseEvents = true;
EditSymbolText( NULL, Text ); EditSymbolText( NULL, Text );
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = false;
if( Text->m_Text.IsEmpty() ) if( Text->m_Text.IsEmpty() )
{ {
SAFE_DELETE( Text ); SAFE_DELETE( Text );
......
...@@ -30,8 +30,11 @@ public: ...@@ -30,8 +30,11 @@ public:
KicadGraphicContext _cDC( parent );\ KicadGraphicContext _cDC( parent );\
wxBufferedDC name(&_cDC, _cDC.GetSize() ); wxBufferedDC name(&_cDC, _cDC.GetSize() );
#define INSTALL_PAINTDC(name,parent) wxBufferedPaintDC name(parent )
#else #else
#define INSTALL_DC(name,parent) KicadGraphicContext name( parent ); #define INSTALL_DC(name,parent) KicadGraphicContext name( parent )
#define INSTALL_PAINTDC(name,parent) wxPaintDC name( parent )
#endif #endif
#endif // __KICAD_DEVICE_CONTEXT_H__ #endif // __KICAD_DEVICE_CONTEXT_H__
...@@ -21,8 +21,16 @@ ...@@ -21,8 +21,16 @@
*/ */
static inline const wxChar* GetChars( wxString s ) static inline const wxChar* GetChars( wxString s )
{ {
#if wxCHECK_VERSION(2,9,0) #if wxCHECK_VERSION( 2, 9, 0 )
return (const wxChar*) s.wx_str();
/* To be Fixed:
* Currently, access to the actual character data in <wxString::Printf
* is a moving target
* So, with wxWidgets 2.9.0 this line is subject to change:
*/
// return (const wxChar*) s.wx_str();
return (const wxChar*) s.c_str();
#else #else
return s.GetData(); return s.GetData();
#endif #endif
...@@ -40,9 +48,10 @@ static inline const wxChar* GetChars( wxString s ) ...@@ -40,9 +48,10 @@ static inline const wxChar* GetChars( wxString s )
#define ABS( y ) ( (y) >= 0 ? (y) : ( -(y) ) ) #define ABS( y ) ( (y) >= 0 ? (y) : ( -(y) ) )
#endif #endif
#define NEGATE(x) (x = -x) #define NEGATE( x ) (x = -x)
/// # of elements in an arrray /// # of elements in an arrray
#define DIM(x) (sizeof(x)/sizeof((x)[0])) #define DIM( x ) ( sizeof(x) / sizeof( (x)[0] ) )
#define DEG2RAD( Deg ) ( (Deg) * M_PI / 180.0 ) #define DEG2RAD( Deg ) ( (Deg) * M_PI / 180.0 )
...@@ -52,28 +61,28 @@ static inline const wxChar* GetChars( wxString s ) ...@@ -52,28 +61,28 @@ static inline const wxChar* GetChars( wxString s )
#define NORMALIZE_ANGLE( Angle ) { while( Angle < 0 ) \ #define NORMALIZE_ANGLE( Angle ) { while( Angle < 0 ) \
Angle += 3600;\ Angle += 3600;\
while( Angle > 3600 ) \ while( Angle > 3600 ) \
Angle -= 3600; } Angle -= 3600;}
/* Normalize angle to be in the 0.0 .. 360.0 range: */ /* Normalize angle to be in the 0.0 .. 360.0 range: */
#define NORMALIZE_ANGLE_POS( Angle ) { while( Angle < 0 ) \ #define NORMALIZE_ANGLE_POS( Angle ) { while( Angle < 0 ) \
Angle += 3600;while( Angle >= 3600 ) \ Angle += 3600;while( Angle >= 3600 ) \
Angle -= 3600; } Angle -= 3600;}
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \ #define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \
{ Angle = -Angle; while( Angle < 0 ) \ { Angle = -Angle; while( Angle < 0 ) \
Angle += 3600;while( Angle >= 3600 ) \ Angle += 3600;while( Angle >= 3600 ) \
Angle -= 3600; } Angle -= 3600;}
/* Normalize angle to be in the -90.0 .. 90.0 range */ /* Normalize angle to be in the -90.0 .. 90.0 range */
#define NORMALIZE_ANGLE_90( Angle ) { while( Angle < -900 ) \ #define NORMALIZE_ANGLE_90( Angle ) { while( Angle < -900 ) \
Angle += 1800;\ Angle += 1800;\
while( Angle > 900 ) \ while( Angle > 900 ) \
Angle -= 1800; } Angle -= 1800;}
/* Normalize angle to be in the -180.0 .. 180.0 range */ /* Normalize angle to be in the -180.0 .. 180.0 range */
#define NORMALIZE_ANGLE_180( Angle ) { while( Angle <= -1800 ) \ #define NORMALIZE_ANGLE_180( Angle ) { while( Angle <= -1800 ) \
Angle += 3600;\ Angle += 3600;\
while( Angle > 1800 ) \ while( Angle > 1800 ) \
Angle -= 3600; } Angle -= 3600;}
/*****************************/ /*****************************/
/* macro to exchange 2 items */ /* macro to exchange 2 items */
...@@ -104,7 +113,7 @@ BOOST_TYPEOF_REGISTER_TYPE( const D_PAD* ); ...@@ -104,7 +113,7 @@ BOOST_TYPEOF_REGISTER_TYPE( const D_PAD* );
class BOARD_ITEM; class BOARD_ITEM;
BOOST_TYPEOF_REGISTER_TYPE( BOARD_ITEM* ); BOOST_TYPEOF_REGISTER_TYPE( BOARD_ITEM* );
#define EXCHG( a, b ) { BOOST_TYPEOF(a) __temp__ = (a); \ #define EXCHG( a, b ) { BOOST_TYPEOF( a ) __temp__ = (a); \
(a) = (b); \ (a) = (b); \
(b) = __temp__; } (b) = __temp__; }
...@@ -140,7 +149,7 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu, ...@@ -140,7 +149,7 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
int id, const wxString& text, int id, const wxString& text,
const wxBitmap& icon ) const wxBitmap& icon )
{ {
wxMenuItem* l_item; wxMenuItem* l_item;
l_item = new wxMenuItem( menu, id, text ); l_item = new wxMenuItem( menu, id, text );
l_item->SetSubMenu( submenu ); l_item->SetSubMenu( submenu );
...@@ -155,7 +164,7 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu, ...@@ -155,7 +164,7 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
const wxString& help, const wxString& help,
const wxBitmap& icon ) const wxBitmap& icon )
{ {
wxMenuItem* l_item; wxMenuItem* l_item;
l_item = new wxMenuItem( menu, id, text, help ); l_item = new wxMenuItem( menu, id, text, help );
l_item->SetSubMenu( submenu ); l_item->SetSubMenu( submenu );
......
No preview for this file type
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment