smd pad in high-contrast mode enhancement

This commit is contained in:
dickelbeck 2007-10-12 03:24:46 +00:00
parent 2d4d427143
commit b8a449e015
7 changed files with 114 additions and 59 deletions

View File

@ -4,6 +4,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Oct-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
* D_PAD::Draw() so that it shows SMD pads as greyed out when in high contrast
mode and not on current layer. Slight variation on this when laying down
tracks: m_Route_Layer_BOTTOM or m_Route_Layer_TOP layers' SMD pads are
not greyed out.
* Changed English UI text for "Cotation" to "Dimension".
2007-Oct-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew

View File

@ -1,6 +1,6 @@
/**************/
/* gr_basic.h */
/**************/
/**************/
/* gr_basic.h */
/**************/
#ifndef GR_BASIC
#define GR_BASIC
@ -13,42 +13,42 @@
/* Constantes utiles */
#define GR_COPY 0
#define GR_OR 0x1000000
#define GR_XOR 0x2000000
#define GR_AND 0x4000000
#define GR_NXOR 0x8000000
#define GR_COPY 0
#define GR_OR 0x01000000
#define GR_XOR 0x02000000
#define GR_AND 0x04000000
#define GR_NXOR 0x08000000
#define GR_SURBRILL 0x80000000
#define GR_SURBRILL 0x80000000
#define GR_M_LEFT_DOWN 0x10000000
#define GR_M_RIGHT_DOWN 0x20000000
#define GR_M_MIDDLE_DOWN 0x40000000
#define GR_M_DCLICK 0x80000000
#define GR_M_LEFT_DOWN 0x10000000
#define GR_M_RIGHT_DOWN 0x20000000
#define GR_M_MIDDLE_DOWN 0x40000000
#define GR_M_DCLICK 0x80000000
/* variables generales */
COMMON_GLOBL int g_XorMode // = GR_XOR ou GR_NXOR selon couleur de fond
#ifdef EDA_BASE // pour les tracés en mode XOR
COMMON_GLOBL int g_XorMode // = GR_XOR ou GR_NXOR selon couleur de fond
#ifdef EDA_BASE // pour les tracés en mode XOR
= GR_NXOR
#endif
;
COMMON_GLOBL int g_DrawBgColor // couleur de fond de la frame de dessin
COMMON_GLOBL int g_DrawBgColor // couleur de fond de la frame de dessin
#ifdef EDA_BASE
= WHITE
#endif
;
typedef enum { /* Line styles for Get/SetLineStyle. */
GR_SOLID_LINE = 0,
GR_DOTTED_LINE = 1,
GR_DASHED_LINE = 3
typedef enum { /* Line styles for Get/SetLineStyle. */
GR_SOLID_LINE = 0,
GR_DOTTED_LINE = 1,
GR_DASHED_LINE = 3
} GRLineStypeType;
typedef enum { /* Line widths for Get/SetLineStyle. */
GR_NORM_WIDTH = 1,
GR_THICK_WIDTH = 3
typedef enum { /* Line widths for Get/SetLineStyle. */
GR_NORM_WIDTH = 1,
GR_THICK_WIDTH = 3
} GRLineWidthType;
@ -87,42 +87,42 @@ void GRSMoveRel(int x, int y);
void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color);
void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color);
void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor);
int Fill, int width, int Color, int BgColor);
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int Color, int BgColor);
int Fill, int Color, int BgColor);
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor);
int Fill, int width, int Color, int BgColor);
void GRSPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor);
int Fill, int width, int Color, int BgColor);
void GRSClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor);
int Fill, int width, int Color, int BgColor);
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color);
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color);
void GRFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r,
int width, int Color, int BgColor);
int width, int Color, int BgColor);
void GRSCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color);
void GRSFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r,
int width, int Color, int BgColor);
int width, int Color, int BgColor);
void GRArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color);
void GRArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color);
void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int Color);
int xc, int yc, int Color);
void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int width, int Color);
int xc, int yc, int width, int Color);
void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int width, int Color);
int xc, int yc, int width, int Color);
void GRSArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color);
void GRFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y,
int StAngle, int EndAngle, int r, int Color, int BgColor);
int StAngle, int EndAngle, int r, int Color, int BgColor);
void GRFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y,
int StAngle, int EndAngle, int r, int width, int Color, int BgColor);
int StAngle, int EndAngle, int r, int width, int Color, int BgColor);
void GRSFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y,
int StAngle, int EndAngle, int r, int width, int Color, int BgColor);
int StAngle, int EndAngle, int r, int width, int Color, int BgColor);
void GRCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRFillCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRSCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRSFillCSegm(EDA_Rect * ClipBox, wxDC * DC,
int x1, int y1, int x2, int y2, int width, int Color);
int x1, int y1, int x2, int y2, int width, int Color);
void GRSetColor(int Color);
void GRSetDefaultPalette();
@ -131,21 +131,21 @@ void GRPutPixel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int color);
void GRSPutPixel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int color);
int GRGetPixel(wxDC * DC, int x, int y);
void GRFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color, int BgColor);
int x2, int y2, int Color, int BgColor);
void GRFilledRect(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 GRSFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color, int BgColor);
int x2, int y2, int Color, int BgColor);
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 GRRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color);
int x2, int y2, int Color);
void GRRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int width, int Color);
int x2, int y2, int width, int Color);
void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color);
int x2, int y2, int Color);
void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int width, int Color);
int x2, int y2, int width, int Color);
/* Routines relatives a l'affichage des textes */
void GRSetFont(wxDC * DC, wxFont * Font);
@ -158,5 +158,5 @@ void GRSetTextBgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextBgColor(wxDC * DC, wxFont * Font);
void GRGetTextExtent(wxDC * DC, const wxChar * Text, long * width, long * height);
#endif /* define GR_BASIC */
#endif /* define GR_BASIC */

View File

@ -9,6 +9,7 @@
#include "common.h"
#include "pcbnew.h"
#include "trigo.h"
#include "id.h" // ID_TRACK_BUTT
#ifdef PCBNEW
#include "drag.h"
@ -238,13 +239,16 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
wxPoint coord[4];
int zoom;
int fillpad = 0;
PCB_SCREEN* screen;
WinEDA_BasePcbFrame* frame;
wxPoint shape_pos;
screen = panel ? (PCB_SCREEN*) panel->m_Parent->m_CurrentScreen : (PCB_SCREEN*) ActiveScreen;
frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
PCB_SCREEN* screen = panel ?
(PCB_SCREEN*) panel->m_Parent->m_CurrentScreen :
(PCB_SCREEN*) ActiveScreen;
// @todo: if panel could have been NULL above, how can we dereference it here safely?
frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
/* Calcul de l'aspect du pad */
if( frame->m_DisplayPadFill == FILLED )
fillpad = 1;
@ -255,8 +259,10 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( m_Flags & IS_MOVED )
fillpad = 0;
#endif
if( m_Masque_Layer & CMP_LAYER )
color = g_PadCMPColor;
if( m_Masque_Layer & CUIVRE_LAYER )
color |= g_PadCUColor;
@ -322,6 +328,37 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
}
}
//-----<test this>-----
// if SMD pad and high contrast mode
if( m_Attribut==SMD && DisplayOpt.ContrastModeDisplay )
{
// when editing tracks show SMD components on either of the routing
// layers as normal, not greyed out.
if( frame->m_ID_current_state == ID_TRACK_BUTT )
{
if( !IsOnLayer( screen->m_Active_Layer )
&& !IsOnLayer( screen->m_Route_Layer_TOP)
&& !IsOnLayer( screen->m_Route_Layer_BOTTOM) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
// when not edting tracks, show SMD components not on active layer as greyed out
else
{
if( !IsOnLayer( screen->m_Active_Layer ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
}
//-----</test this>----
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
@ -329,6 +366,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
@ -347,6 +385,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
angle = m_Orient;
bool DisplayIsol = DisplayOpt.DisplayPadIsol;
if( ( m_Masque_Layer & ALL_CU_LAYERS ) == 0 )
DisplayIsol = FALSE;
@ -375,12 +414,14 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
/* calcul de l'entraxe de l'ellipse */
if( dx > dy ) /* ellipse horizontale */
{
delta_cx = dx - dy; delta_cy = 0;
delta_cx = dx - dy;
delta_cy = 0;
rotdx = m_Size.y;
}
else /* ellipse verticale */
{
delta_cx = 0; delta_cy = dy - dx;
delta_cx = 0;
delta_cy = dy - dx;
rotdx = m_Size.x;
}
RotatePoint( &delta_cx, &delta_cy, angle );
@ -476,6 +517,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( fillpad && hole )
{
color = g_IsPrinting ? WHITE : BLACK; // ou DARKGRAY;
if( draw_mode != GR_XOR )
GRSetDrawMode( DC, GR_COPY );
else
@ -491,6 +533,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
case OVALE:
dx = m_Drill.x >> 1;
dy = m_Drill.y >> 1; /* demi dim dx et dy */
/* calcul de l'entraxe de l'ellipse */
if( m_Drill.x > m_Drill.y ) /* ellipse horizontale */
{
@ -521,6 +564,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
{
dx0 = MIN( dx0, dy0 );
int nc_color = BLUE;
if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */
GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0,
cx0 + dx0, cy0 + dx0, 0, nc_color );

View File

@ -561,7 +561,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
int rayon;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( Type() == TYPEZONE && (!DisplayOpt.DisplayZones) )
if( Type() == TYPEZONE && !DisplayOpt.DisplayZones )
return;
GRSetDrawMode( DC, draw_mode );

View File

@ -82,7 +82,7 @@ END_EVENT_TABLE()
WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* parent,
COTATION* Cotation, wxDC* DC,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Cotation properties" ), framepos, wxSize( 340, 270 ),
wxDialog( parent, -1, _( "Dimension properties" ), framepos, wxSize( 340, 270 ),
DIALOG_STYLE )
{
wxButton* Button;

View File

@ -317,10 +317,10 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( !flags )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_COTATION,
_( "Edit Cotation" ), edit_xpm );
_( "Edit Dimension" ), edit_xpm );
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_COTATION,
_( "Delete Cotation" ), delete_xpm );
_( "Delete Dimension" ), delete_xpm );
break;
case TYPEMIRE:

View File

@ -422,11 +422,11 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString,
BITMAP( add_tracks_xpm ),
_( "Add Tracks an vias" ), wxITEM_CHECK );
_( "Add tracks and vias" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString,
BITMAP( add_zone_xpm ),
_( "Add Zones" ), wxITEM_CHECK );
_( "Add zones" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
@ -443,12 +443,12 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString,
BITMAP( add_text_xpm ),
_( "Add Text" ), wxITEM_CHECK );
_( "Add text" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_COTATION_BUTT, wxEmptyString,
BITMAP( add_cotation_xpm ),
_( "Add Cotation" ), wxITEM_CHECK );
_( "Add dimension" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString,
BITMAP( add_mires_xpm ),