diff --git a/CODING_GUIDELINES.txt b/CODING_GUIDELINES.txt deleted file mode 100644 index ad03497c9d..0000000000 --- a/CODING_GUIDELINES.txt +++ /dev/null @@ -1,30 +0,0 @@ -== Spaces and Tabs == - -Try to use as many as can TABS instead of spaces, this makes indenting -much more easy. - - -== Function prototypes == - -The name of the function should be on a seperated line, this for easy - searching in long source files. -Each parameter should use a own line, aligned under the first parameter. -Below there is an example, this style is for reading and editing quick trough -sourcecode. Also indenting can be set with a good programmers editor -(visual spaces per tab, this because one tab is normaly 8 spaces on screen) - -Example: - -void -foo( int x, - int y, - int z ) -{ - function1(); - - if(var == 1) - { - dothis(); - dothat(); - } -} diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 91588aa4eb..0d28d34431 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -878,6 +878,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, SEGZONE* edge_poly; edge_poly = new SEGZONE( pcb ); pcb->m_Zone.Append( edge_poly ); + D(printf("R:%p\n", edge_poly );) edge_poly->SetLayer( activeLayer ); edge_poly->m_Width = 1; @@ -933,6 +934,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, case GERB_INTERPOL_LINEAR_1X: track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillLineTRACK( track, dcode, activeLayer, m_PreviousPos, m_CurrentPos, size.x, !(m_LayerNegative ^ m_ImageNegative) ); @@ -948,6 +950,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, case GERB_INTERPOL_ARC_POS: track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillArcTRACK( track, dcode, activeLayer, m_PreviousPos, m_CurrentPos, m_IJPos, size.x, m_Iterpolation==GERB_INTERPOL_ARC_NEG ? false : true, @@ -984,6 +987,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, case APT_CIRCLE: track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillRoundFlashTRACK( track, dcode, activeLayer, m_CurrentPos, size.x, !(m_LayerNegative ^ m_ImageNegative) ); @@ -993,6 +997,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, case APT_RECT: track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillOvalOrRectFlashTRACK( track, dcode, activeLayer, m_CurrentPos, size, aperture == APT_RECT ? S_SPOT_RECT : S_SPOT_OVALE, @@ -1020,6 +1025,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillRoundFlashTRACK( track, dcode, activeLayer, m_CurrentPos, diameter, exposure ); @@ -1049,6 +1055,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, curPos += midPoint; track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillOvalOrRectFlashTRACK( track, dcode, activeLayer, curPos, size, S_SPOT_RECT, exposure ); @@ -1064,6 +1071,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, curPos += mapPt( p->params[3].GetValue( tool ), p->params[4].GetValue( tool ), m_GerbMetric ); track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillOvalOrRectFlashTRACK( track, dcode, activeLayer, curPos, size, S_SPOT_RECT, exposure ); @@ -1083,6 +1091,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, curPos.x += size.x/2; track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillOvalOrRectFlashTRACK( track, dcode, activeLayer, curPos, size, S_SPOT_RECT, exposure ); @@ -1098,11 +1107,13 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillRoundFlashTRACK( track, dcode, activeLayer, curPos, outerDiam, !(m_LayerNegative ^ m_ImageNegative) ); track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillRoundFlashTRACK( track, dcode, activeLayer, curPos, innerDiam, (m_LayerNegative ^ m_ImageNegative) ); @@ -1130,18 +1141,22 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, { track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillCircularTRACK( track, dcode, activeLayer, curPos, outerDiam, penThickness, !(m_LayerNegative ^ m_ImageNegative) ); } track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) fillOvalOrRectFlashTRACK( track, dcode, activeLayer, curPos, wxSize(crossHairThickness,crossHairLength), S_SPOT_RECT, !(m_LayerNegative ^ m_ImageNegative) ); track = new TRACK( pcb ); pcb->m_Track.Append( track ); + D(printf("R:%p\n", track );) + // swap x and y in wxSize() for this one fillOvalOrRectFlashTRACK( track, dcode, activeLayer, curPos, wxSize(crossHairLength,crossHairThickness), diff --git a/gerbview/tracepcb.cpp b/gerbview/tracepcb.cpp index 0f4b375902..80e601956a 100644 --- a/gerbview/tracepcb.cpp +++ b/gerbview/tracepcb.cpp @@ -128,9 +128,11 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay if( !(track->ReturnMaskLayer() & printmasklayer) ) continue; + D(printf("D:%p\n", track );) + if( track->GetNet() == 0 ) // StartPoint { - if( points.size() ) // we have found a new polygon: Draw the old polygon + if( points.size() ) // we have found a new polygon: Draw the old polygon { if( erase ) { diff --git a/gerbview/trpiste.cpp b/gerbview/trpiste.cpp index edca132792..a8538419a3 100644 --- a/gerbview/trpiste.cpp +++ b/gerbview/trpiste.cpp @@ -18,7 +18,7 @@ /***************************************************************************************************/ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode, - int printmasklayer ) + int printmasklayer ) /***************************************************************************************************/ /* Function to draw the tracks (i.e Spots or lines) in gerbview @@ -29,23 +29,25 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_ * @param printmasklayer = mask for allowed layer (=-1 to draw all layers) */ { - int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; - GERBER* gerber = g_GERBER_List[layer]; - int dcode_hightlight = 0; + int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + GERBER* gerber = g_GERBER_List[layer]; + int dcode_hightlight = 0; - if( gerber ) - dcode_hightlight = gerber->m_Selected_Tool; + if( gerber ) + dcode_hightlight = gerber->m_Selected_Tool; - for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) - { - if( !(track->ReturnMaskLayer() & printmasklayer) ) - continue; + for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) + { + if( !(track->ReturnMaskLayer() & printmasklayer) ) + continue; - if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) - Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL ); - else - Trace_Segment( panel, DC, track, draw_mode ); - } + D(printf("D:%p\n", track );) + + if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) + Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL ); + else + Trace_Segment( panel, DC, track, draw_mode ); + } } @@ -61,174 +63,174 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo * draw_mode = mode ( GR_XOR, GR_OR..) */ { - int l_piste; - int color; - int zoom; - int fillopt; - static bool show_err; + int l_piste; + int color; + int zoom; + int fillopt; + static bool show_err; if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview - { - color = g_DrawBgColor; - } - else - { - color = g_DesignSettings.m_LayerColor[track->GetLayer()]; - if( color & ITEM_NOT_SHOW ) - return; + { + color = g_DrawBgColor; + } + else + { + color = g_DesignSettings.m_LayerColor[track->GetLayer()]; + if( color & ITEM_NOT_SHOW ) + return; - if( draw_mode & GR_SURBRILL ) - { - if( draw_mode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; - else - color |= HIGHT_LIGHT_FLAG; - } - if( color & HIGHT_LIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; - } + if( draw_mode & GR_SURBRILL ) + { + if( draw_mode & GR_AND ) + color &= ~HIGHT_LIGHT_FLAG; + else + color |= HIGHT_LIGHT_FLAG; + } + if( color & HIGHT_LIGHT_FLAG ) + color = ColorRefs[color & MASKCOLOR].m_LightColor; + } - GRSetDrawMode( DC, draw_mode ); + GRSetDrawMode( DC, draw_mode ); - zoom = panel->GetZoom(); + zoom = panel->GetZoom(); - fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; + fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; - switch( track->m_Shape ) - { - case S_CIRCLE: - { - int radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x), - (double) (track->m_End.y - track->m_Start.y) ); + switch( track->m_Shape ) + { + case S_CIRCLE: + { + int radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x), + (double) (track->m_End.y - track->m_Start.y) ); - int halfPenWidth = track->m_Width >> 1; - if( (halfPenWidth / zoom) < L_MIN_DESSIN ) - { - GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius, 0, color ); - } + int halfPenWidth = track->m_Width >> 1; + if( (halfPenWidth / zoom) < L_MIN_DESSIN ) + { + GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius, 0, color ); + } - if( fillopt == SKETCH ) - { - // draw the border of the pen's path using two circles, each as narrow as possible - GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius - halfPenWidth, 0, color ); - GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius + halfPenWidth, 0, color ); - } - else - { - GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius, track->m_Width, color ); - } - } - break; + if( fillopt == SKETCH ) + { + // draw the border of the pen's path using two circles, each as narrow as possible + GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius - halfPenWidth, 0, color ); + GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius + halfPenWidth, 0, color ); + } + else + { + GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius, track->m_Width, color ); + } + } + break; - case S_ARC: - if( fillopt == SKETCH ) - { - GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, - track->m_Param, track->GetSubNet(), 0, color ); - } - else - { - GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, - track->m_Param, track->GetSubNet(), - track->m_Width, color ); - } - break; + case S_ARC: + if( fillopt == SKETCH ) + { + GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + track->m_End.x, track->m_End.y, + track->m_Param, track->GetSubNet(), 0, color ); + } + else + { + GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + track->m_End.x, track->m_End.y, + track->m_Param, track->GetSubNet(), + track->m_Width, color ); + } + break; - case S_SPOT_CIRCLE: - { - int radius = track->m_Width >> 1; + case S_SPOT_CIRCLE: + { + int radius = track->m_Width >> 1; - fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; - if( (radius / zoom) < L_MIN_DESSIN ) - { - GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius, 0, color ); - } - else if( fillopt == SKETCH ) - { - GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius, 0, color ); - } - else - { - GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - radius, 0, color, color ); - } - } - break; + fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; + if( (radius / zoom) < L_MIN_DESSIN ) + { + GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius, 0, color ); + } + else if( fillopt == SKETCH ) + { + GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius, 0, color ); + } + else + { + GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + radius, 0, color, color ); + } + } + break; - case S_SPOT_RECT: - case S_RECT: + case S_SPOT_RECT: + case S_RECT: - l_piste = track->m_Width >> 1; + l_piste = track->m_Width >> 1; - fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; - if( (l_piste / zoom) < L_MIN_DESSIN ) - { - GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, 0, color ); - } - else if( fillopt == SKETCH ) - { - GRRect( &panel->m_ClipBox, DC, - track->m_Start.x - l_piste, - track->m_Start.y - l_piste, - track->m_End.x + l_piste, - track->m_End.y + l_piste, - 0, color ); - } - else - { - GRFilledRect( &panel->m_ClipBox, DC, - track->m_Start.x - l_piste, - track->m_Start.y - l_piste, - track->m_End.x + l_piste, - track->m_End.y + l_piste, - 0, color, color ); - } - break; + fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; + if( (l_piste / zoom) < L_MIN_DESSIN ) + { + GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + track->m_End.x, track->m_End.y, 0, color ); + } + else if( fillopt == SKETCH ) + { + GRRect( &panel->m_ClipBox, DC, + track->m_Start.x - l_piste, + track->m_Start.y - l_piste, + track->m_End.x + l_piste, + track->m_End.y + l_piste, + 0, color ); + } + else + { + GRFilledRect( &panel->m_ClipBox, DC, + track->m_Start.x - l_piste, + track->m_Start.y - l_piste, + track->m_End.x + l_piste, + track->m_End.y + l_piste, + 0, color, color ); + } + break; - case S_SPOT_OVALE: - fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; + case S_SPOT_OVALE: + fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; - case S_SEGMENT: - l_piste = track->m_Width >> 1; + case S_SEGMENT: + l_piste = track->m_Width >> 1; - if( (l_piste / zoom) < L_MIN_DESSIN ) - { - GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, 0, color ); - break; - } + if( (l_piste / zoom) < L_MIN_DESSIN ) + { + GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + track->m_End.x, track->m_End.y, 0, color ); + break; + } - if( fillopt == SKETCH ) - { - GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, - track->m_Width, color ); - } - else - { - GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, - track->m_Width, color ); - } - break; + if( fillopt == SKETCH ) + { + GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + track->m_End.x, track->m_End.y, + track->m_Width, color ); + } + else + { + GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, + track->m_End.x, track->m_End.y, + track->m_Width, color ); + } + break; - default: - if( !show_err ) - { - DisplayError( panel, wxT( "Trace_Segment() type error" ) ); - show_err = TRUE; - } - break; - } + default: + if( !show_err ) + { + DisplayError( panel, wxT( "Trace_Segment() type error" ) ); + show_err = TRUE; + } + break; + } } #endif @@ -238,49 +240,49 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode ) /*****************************************************************************************/ { - TRACK* track; - wxPoint pos; - int width, orient; - wxString Line; + TRACK* track; + wxPoint pos; + int width, orient; + wxString Line; - GRSetDrawMode( DC, drawmode ); - track = Pcb->m_Track; - for( ; track != NULL; track = track->Next() ) - { - if( (track->m_Shape == S_ARC) - || (track->m_Shape == S_CIRCLE) - || (track->m_Shape == S_ARC_RECT) ) - { - pos.x = track->m_Start.x; - pos.y = track->m_Start.y; - } - else - { - pos.x = (track->m_Start.x + track->m_End.x) / 2; - pos.y = (track->m_Start.y + track->m_End.y) / 2; - } + GRSetDrawMode( DC, drawmode ); + track = Pcb->m_Track; + for( ; track != NULL; track = track->Next() ) + { + if( (track->m_Shape == S_ARC) + || (track->m_Shape == S_CIRCLE) + || (track->m_Shape == S_ARC_RECT) ) + { + pos.x = track->m_Start.x; + pos.y = track->m_Start.y; + } + else + { + pos.x = (track->m_Start.x + track->m_End.x) / 2; + pos.y = (track->m_Start.y + track->m_End.y) / 2; + } - Line.Printf( wxT( "D%d" ), track->GetNet() ); + Line.Printf( wxT( "D%d" ), track->GetNet() ); - width = track->m_Width; - orient = TEXT_ORIENT_HORIZ; - if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash - { - width /= 3; - } - else // lines - { - int dx, dy; - dx = track->m_Start.x - track->m_End.x; - dy = track->m_Start.y - track->m_End.y; - if( abs( dx ) < abs( dy ) ) - orient = TEXT_ORIENT_VERT; - width /= 2; - } + width = track->m_Width; + orient = TEXT_ORIENT_HORIZ; + if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash + { + width /= 3; + } + else // lines + { + int dx, dy; + dx = track->m_Start.x - track->m_End.x; + dy = track->m_Start.y - track->m_End.y; + if( abs( dx ) < abs( dy ) ) + orient = TEXT_ORIENT_VERT; + width /= 2; + } - DrawGraphicText( panel, DC, - pos, (EDA_Colors) g_DCodesColor, Line, - orient, wxSize( width, width ), - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - } + DrawGraphicText( panel, DC, + pos, (EDA_Colors) g_DCodesColor, Line, + orient, wxSize( width, width ), + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); + } }