Commit 6b05cf31 authored by jean-pierre charras's avatar jean-pierre charras

Fixed bug in GRLineArray(). Cleanup Gerbview code

parent ee4aadc4
This diff is collapsed.
...@@ -116,26 +116,10 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -116,26 +116,10 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
Close( TRUE ); Close( TRUE );
break; break;
case ID_NEW_PROJECT:
case ID_LOAD_PROJECT:
Files_io( event );
break;
case ID_GERBVIEW_GLOBAL_DELETE: case ID_GERBVIEW_GLOBAL_DELETE:
Erase_Current_Layer( TRUE ); Erase_Current_Layer( TRUE );
break; break;
case ID_GET_TOOLS:
// InstallToolsFrame(this, wxPoint(-1,-1) );
break;
case ID_FIND_ITEMS:
// InstallFindFrame(this, pos);
break;
case ID_NO_SELECT_BUTT: case ID_NO_SELECT_BUTT:
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
break; break;
...@@ -223,19 +207,5 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -223,19 +207,5 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
*/ */
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); // Currently: no nothing
switch( m_ID_current_state )
{
case 0:
if( (DrawStruct == NULL) || ((DrawStruct->m_Flags & ~DRAW_ERASED) == 0) )
{
DrawStruct = GerberGeneralLocateAndDisplay();
}
break;
default:
break;
}
} }
...@@ -169,7 +169,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, ...@@ -169,7 +169,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); // ReCreateVToolbar(); // Currently: no right vertical toolbar
ReCreateOptToolbar(); ReCreateOptToolbar();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
......
...@@ -47,13 +47,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -47,13 +47,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
wxBitmap( open_xpm ), wxBitmap( open_xpm ),
_( "Load a new Gerber file on the current layer. Previous data will be deleted" ) ); _( "Load a new Gerber file on the current layer. Previous data will be deleted" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString,
wxBitmap( undelete_xpm ),
_( "Undelete" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, m_HToolBar->AddTool( wxID_PRINT, wxEmptyString,
wxBitmap( print_button ), wxBitmap( print_button ),
......
...@@ -77,8 +77,6 @@ void GRDashedLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, ...@@ -77,8 +77,6 @@ void GRDashedLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void GRDashedLineTo( EDA_Rect* ClipBox, wxDC* DC, int x2, int y2, int width, int Color ); void GRDashedLineTo( EDA_Rect* ClipBox, wxDC* DC, int x2, int y2, int width, int Color );
void GRMoveTo( int x, int y ); void GRMoveTo( int x, int y );
void GRLineTo( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int width, int Color ); void GRLineTo( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int width, int Color );
void GRMoveRel( int x, int y );
void GRLineRel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int width, int Color );
void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[], bool Fill, void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[], bool Fill,
int width, int Color, int BgColor ); int width, int Color, int BgColor );
...@@ -204,7 +202,16 @@ void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect, ...@@ -204,7 +202,16 @@ void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect,
void GRSFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, void GRSFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
int x2, int y2, int width, int Color, int BgColor ); int x2, int y2, int width, int Color, int BgColor );
void GRLineArray( EDA_Rect* ClipBox, wxDC* DC, wxPoint points[], /** Function GRLineArray
int lines, int width, int Color ); * draws an array of lines (not a polygon).
* @param aClipBox = the clip box
* @param aDC = the device context into which drawing should occur.
* @param aLines = a list of pair of coordinate in user space: a pair for each line.
* @param aWidth = the width of each line.
* @param aColor = an index into our color table of RGB colors.
* @see EDA_Colors and colors.h
*/
void GRLineArray( EDA_Rect* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines,
int aWidth, int aColor );
#endif /* define GR_BASIC */ #endif /* define GR_BASIC */
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "protos.h" #include "protos.h"
/************************/ /************************/
/* class ZONE_CONTAINER */ /* class ZONE_CONTAINER */
/************************/ /************************/
...@@ -477,7 +476,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con ...@@ -477,7 +476,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
// draw the lines // draw the lines
int i_start_contour = 0; int i_start_contour = 0;
wxPoint lines[( GetNumCorners()*2)+2]; std::vector<wxPoint> lines;
lines.reserve( (GetNumCorners()*2)+2);
for( int ic = 0; ic < GetNumCorners(); ic++ ) for( int ic = 0; ic < GetNumCorners(); ic++ )
{ {
seg_start = GetCornerPosition( ic ) + offset; seg_start = GetCornerPosition( ic ) + offset;
...@@ -490,23 +490,24 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con ...@@ -490,23 +490,24 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
seg_end = GetCornerPosition( i_start_contour ) + offset; seg_end = GetCornerPosition( i_start_contour ) + offset;
i_start_contour = ic + 1; i_start_contour = ic + 1;
} }
lines[ic*2].x = seg_start.x; lines.push_back( seg_start );
lines[ic*2].y = seg_start.y; lines.push_back( seg_end );
lines[ic*2+1].x = seg_start.x;
lines[ic*2+1].y = seg_start.y;
} }
GRLineArray(&panel->m_ClipBox, DC, lines, GetNumCorners(), 0, color); GRLineArray(&panel->m_ClipBox, DC, lines, 0, color);
// draw hatches // draw hatches
wxPoint hatches[(m_Poly->m_HatchLines.size() *2)+2]; lines.clear();
lines.reserve( (m_Poly->m_HatchLines.size() *2) +2 );
for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ ) for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ )
{ {
hatches[ic*2].x = m_Poly->m_HatchLines[ic].xi + offset.x; seg_start.x = m_Poly->m_HatchLines[ic].xi + offset.x;
hatches[ic*2].y = m_Poly->m_HatchLines[ic].yi + offset.y; seg_start.y = m_Poly->m_HatchLines[ic].yi + offset.y;
hatches[ic*2+1].x = m_Poly->m_HatchLines[ic].xf + offset.x; seg_end.x = m_Poly->m_HatchLines[ic].xf + offset.x;
hatches[ic*2+1].y = m_Poly->m_HatchLines[ic].yf + offset.y; seg_end.y = m_Poly->m_HatchLines[ic].yf + offset.y;
lines.push_back( seg_start );
lines.push_back( seg_end );
} }
GRLineArray(&panel->m_ClipBox, DC, hatches, m_Poly->m_HatchLines.size(), 0, color ); GRLineArray(&panel->m_ClipBox, DC, lines, 0, color );
} }
......
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