Commit 3157b4d1 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Enforced EDA_COLOR_T type and minor const-ification

parent 082d901d
......@@ -117,7 +117,7 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor )
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int w = GetWidth();
......
......@@ -15,7 +15,7 @@
/* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema
* these values are superseded by config reading
*/
static const int default_layer_color[LAYERSCOLORSBUFFERSIZE] =
static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
{
GREEN, BLUE, LIGHTGRAY, BROWN,
RED, MAGENTA, LIGHTGRAY, MAGENTA,
......@@ -34,7 +34,7 @@ static const int default_layer_color[LAYERSCOLORSBUFFERSIZE] =
DARKGRAY
};
static const int default_items_color[LAYERSCOLORSBUFFERSIZE] =
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{
LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE
......@@ -78,13 +78,13 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
return m_LayersColors[aLayer];
}
return -1;
return UNSPECIFIED_COLOR;
}
......@@ -93,7 +93,7 @@ int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, int aColor )
void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
......@@ -107,13 +107,13 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, int aColor )
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
int COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
{
if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{
return m_ItemsColors[aItemIdx];
}
return -1;
return UNSPECIFIED_COLOR;
}
......@@ -122,7 +122,7 @@ int COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
* sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, int aColor )
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor )
{
if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{
......@@ -136,7 +136,7 @@ void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, int aColor )
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( int aColor)
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( EDA_COLOR_T aColor )
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor;
......
......@@ -57,13 +57,13 @@ wxString g_Prj_Config_LocalFilename;
EDA_UNITS_T g_UserUnit;
int g_GhostColor;
EDA_COLOR_T g_GhostColor;
#if defined(KICAD_GOST)
static bool s_gost = true;
static const bool s_gost = true;
#else
static bool s_gost = false;
static const bool s_gost = false;
#endif
bool IsGOST()
......
......@@ -475,7 +475,7 @@ void EDA_DRAW_FRAME::OnGrid( int grid_type )
}
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition )
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
{
wxPoint pos = aPosition;
......@@ -553,7 +553,7 @@ void EDA_DRAW_FRAME::LoadSettings()
int itmp;
if( cfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
SetGridColor( itmp );
SetGridColor( ColorFromInt( itmp ) );
cfg->Read( m_FrameName + LastGridSizeId, &m_LastGridSizeId, 0L );
}
......@@ -575,7 +575,7 @@ void EDA_DRAW_FRAME::SaveSettings()
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
const wxString& textLower,
int color, int pad )
EDA_COLOR_T color, int pad )
{
if( m_messagePanel == NULL )
return;
......@@ -593,12 +593,12 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void )
}
wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils )
wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) const
{
return ::CoordinateToString( aValue, aConvertToMils );
}
wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils )
wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils ) const
{
return ::LengthDoubleToString( aValue, aConvertToMils );
}
......
......@@ -153,7 +153,7 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
}
void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, int aColor )
void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
{
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
return;
......@@ -560,7 +560,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
int axis_color = BLUE;
EDA_COLOR_T axis_color = BLUE;
GRSetDrawMode( DC, GR_COPY );
......@@ -721,7 +721,7 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
if( origin == wxPoint( 0, 0 ) )
return;
int color = DARKRED;
EDA_COLOR_T color = DARKRED;
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
......@@ -752,7 +752,7 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
return;
int color = GetParent()->GetGridColor();
EDA_COLOR_T color = GetParent()->GetGridColor();
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
......
......@@ -237,7 +237,7 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
aColor,
aDrawMode,
aFillMode,
i ? UNSPECIFIED : aAnchor_color,
i ? UNSPECIFIED_COLOR : aAnchor_color,
txt,
pos );
pos += offset;
......@@ -273,7 +273,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode( aDC, aDrawMode );
/* Draw text anchor, if allowed */
if( aAnchor_color != UNSPECIFIED )
if( aAnchor_color != UNSPECIFIED_COLOR )
{
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
......
......@@ -655,9 +655,11 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
}
}
m_settings->Read( wxT( "BgColor" ), &g_DrawBgColor );
int draw_bg_color;
m_settings->Read( wxT( "BgColor" ), &draw_bg_color );
g_DrawBgColor = ColorFromInt( draw_bg_color );
/* Load per-user search paths from settings file */
// Load per-user search paths from settings file
wxString upath;
int i = 1;
......
This diff is collapsed.
......@@ -76,7 +76,7 @@ int EDA_MSG_PANEL::GetRequiredHeight()
}
wxSize EDA_MSG_PANEL::computeTextSize( const wxString& text )
wxSize EDA_MSG_PANEL::computeTextSize( const wxString& text ) const
{
// Get size of the wxSYS_DEFAULT_GUI_FONT
wxSize textSizeInPixels;
......@@ -109,7 +109,7 @@ void EDA_MSG_PANEL::OnPaint( wxPaintEvent& event )
void EDA_MSG_PANEL::AppendMessage( const wxString& textUpper,
const wxString& textLower,
int color, int pad )
EDA_COLOR_T color, int pad )
{
wxString text;
wxSize drawSize = GetClientSize();
......@@ -143,7 +143,7 @@ void EDA_MSG_PANEL::AppendMessage( const wxString& textUpper,
void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
const wxString& aLowerText, int aColor )
const wxString& aLowerText, EDA_COLOR_T aColor )
{
wxPoint pos;
wxSize drawSize = GetClientSize();
......@@ -196,11 +196,11 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
void EDA_MSG_PANEL::showItem( wxDC& dc, const EDA_MSG_ITEM& aItem )
{
int color = aItem.m_Color;
EDA_COLOR_T color = aItem.m_Color;
if( color >= 0 )
{
color &= MASKCOLOR;
color = ColorGetBase( color );
dc.SetTextForeground( wxColour( ColorRefs[color].m_Red,
ColorRefs[color].m_Green,
ColorRefs[color].m_Blue ) );
......
......@@ -463,8 +463,8 @@ void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val,
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
......@@ -475,8 +475,8 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
const wxChar* ident,
int* ptparam,
int default_val,
EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
......@@ -488,9 +488,11 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
{
static const int MAX_COLOR = 0x8001F;
if( m_Pt_param == NULL || aConfig == NULL )
return;
int itmp = aConfig->Read( m_Ident, m_Default );
EDA_COLOR_T itmp = ColorFromInt( aConfig->Read( m_Ident, m_Default ) );
if( (itmp < 0) || (itmp > MAX_COLOR) )
itmp = m_Default;
......
......@@ -45,19 +45,19 @@ BEGIN_EVENT_TABLE( WinEDA_SelColorFrame, wxDialog )
END_EVENT_TABLE()
int DisplayColorFrame( wxWindow* parent, int OldColor )
EDA_COLOR_T DisplayColorFrame( wxWindow* parent, int OldColor )
{
wxPoint framepos;
int color;
EDA_COLOR_T color;
wxGetMousePosition( &framepos.x, &framepos.y );
WinEDA_SelColorFrame* frame = new WinEDA_SelColorFrame( parent,
framepos, OldColor );
color = frame->ShowModal();
color = static_cast<EDA_COLOR_T>( frame->ShowModal() );
frame->Destroy();
if( color > NBCOLOR )
color = -1;
color = UNSPECIFIED_COLOR;
return color;
}
......
......@@ -1606,7 +1606,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
}
const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition )
const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition ) const
{
const PAGE_INFO& pageInfo = GetPageSettings();
......
......@@ -464,7 +464,7 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible()
bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible() const
{
return m_DrawGrid;
}
......@@ -486,7 +486,7 @@ void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible)
* Function GetGridColor() , virtual
* @return the color of the grid
*/
int DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
EDA_COLOR_T DISPLAY_FOOTPRINTS_FRAME::GetGridColor() const
{
return DARKGRAY;
}
......@@ -46,7 +46,7 @@ public:
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible();
virtual bool IsGridVisible() const;
/**
* Function SetGridVisibility() , virtual
......@@ -59,7 +59,7 @@ public:
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor();
virtual EDA_COLOR_T GetGridColor() const;
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
......
......@@ -338,15 +338,15 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert,
g_XorMode, -1, DefaultTransform, true, true, true );
g_XorMode, UNSPECIFIED_COLOR, DefaultTransform, true, true, true );
}
/* Repaint new view */
// Repaint new view
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
GRSetDrawMode( aDC, g_XorMode );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert,
g_XorMode, -1, DefaultTransform, true, true, true );
g_XorMode, UNSPECIFIED_COLOR, DefaultTransform, true, true, true );
}
......@@ -63,13 +63,13 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
bool aErase )
{
SCH_LINE* segment;
int color;
if( s_wires.GetCount() == 0 )
return;
segment = (SCH_LINE*) s_wires.begin();
color = ReturnLayerColor( segment->GetLayer() ) ^ HIGHLIGHT_FLAG;
EDA_COLOR_T color = ReturnLayerColor( segment->GetLayer() );
ColorChangeHighlightFlag( &color, !(color & HIGHLIGHT_FLAG) );
if( aErase )
{
......
......@@ -273,7 +273,7 @@ void LIB_COMPONENT::SetName( const wxString& aName )
void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset, int aMulti,
int aConvert, GR_DRAWMODE aDrawMode, int aColor, const TRANSFORM& aTransform,
int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor, const TRANSFORM& aTransform,
bool aShowPinText, bool aDrawFields, bool aOnlySelected )
{
BASE_SCREEN* screen = aPanel->GetScreen();
......@@ -286,7 +286,8 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
* printing in black and white
* If the color is not the default color (aColor != -1 )
*/
if( ! (screen->m_IsPrinting && GetGRForceBlackPenState()) && (aColor == -1) )
if( ! (screen->m_IsPrinting && GetGRForceBlackPenState())
&& (aColor == UNSPECIFIED_COLOR) )
{
BOOST_FOREACH( LIB_ITEM& drawItem, drawings )
{
......@@ -426,7 +427,7 @@ from component %s in library %s." ),
if( *i == aItem )
{
if( aDc != NULL )
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
drawings.erase( i );
SetModified();
......
......@@ -397,7 +397,8 @@ public:
* Used for block move redraws.
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
int aMulti, int aConvert, GR_DRAWMODE aDrawMode, int aColor = -1,
int aMulti, int aConvert, GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR,
const TRANSFORM& aTransform = DefaultTransform,
bool aShowPinText = true, bool aDrawFields = true,
bool aOnlySelected = false );
......
......@@ -66,7 +66,7 @@ static ButtonIndex buttonGroups[] = {
};
static int currentColors[ MAX_LAYER ];
static EDA_COLOR_T currentColors[ MAX_LAYER ];
IMPLEMENT_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG, wxDialog )
......@@ -253,7 +253,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) );
int color = DisplayColorFrame( this, colorButton->m_Layer );
EDA_COLOR_T color = DisplayColorFrame( this, colorButton->m_Layer );
if( color < 0 || currentColors[ colorButton->m_Layer ] == color )
return;
......
......@@ -65,7 +65,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
NEGATE( offset.y );
GRResetPenAndBrush( &dc );
m_dummyPin->Draw( NULL, &dc, offset, -1, GR_COPY,
m_dummyPin->Draw( NULL, &dc, offset, UNSPECIFIED_COLOR, GR_COPY,
NULL, DefaultTransform );
m_dummyPin->SetParent(NULL);
......
......@@ -415,7 +415,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->m_IsPrinting = true;
int bg_color = g_DrawBgColor;
EDA_COLOR_T bg_color = g_DrawBgColor;
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
......
......@@ -45,7 +45,7 @@
#include <sch_sheet_path.h>
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, int Color )
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, EDA_COLOR_T Color )
{
BASE_SCREEN* screen = panel->GetScreen();
......
......@@ -81,11 +81,11 @@ int g_DrawDefaultLineThickness = 6; /* Default line thickness in
* line width */
// Color to draw selected items
int g_ItemSelectetColor = BROWN;
EDA_COLOR_T g_ItemSelectetColor = BROWN;
// Color to draw items flagged invisible, in libedit (they are invisible
// in Eeschema
int g_InvisibleItemColor = DARKGRAY;
EDA_COLOR_T g_InvisibleItemColor = DARKGRAY;
TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 );
......
......@@ -95,12 +95,12 @@ class LayerStruct
{
public:
char LayerNames[MAX_LAYERS + 1][8];
int LayerColor[MAX_LAYERS + 1];
EDA_COLOR_T LayerColor[MAX_LAYERS + 1];
char LayerStatus[MAX_LAYERS + 1];
int NumberOfLayers;
int CurrentLayer;
int CurrentWidth;
int CommonColor;
EDA_COLOR_T CommonColor;
int Flags;
};
......@@ -149,10 +149,10 @@ extern int g_DrawDefaultLineThickness;
/// Color to draw selected items
extern int g_ItemSelectetColor;
extern EDA_COLOR_T g_ItemSelectetColor;
/// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
extern int g_InvisibleItemColor;
extern EDA_COLOR_T g_InvisibleItemColor;
/* Global Variables */
......
......@@ -341,7 +341,7 @@ int LIB_ARC::GetPenSize() const
}
void LIB_ARC::drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor )
void LIB_ARC::drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor )
{
// The edit indicators only get drawn when a new arc is being drawn.
if( !IsNew() )
......@@ -362,7 +362,8 @@ void LIB_ARC::drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor )
void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform )
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
// Don't draw the arc until the end point is selected. Only the edit indicators
// get drawn at this time.
......@@ -370,7 +371,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
return;
wxPoint pos1, pos2, posc;
int color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
......
......@@ -61,13 +61,13 @@ class LIB_ARC : public LIB_ITEM
* Draws the arc.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
/**
* Draw the graphics when the arc is being edited.
*/
void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor );
void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor );
/**
* Calculates the center, radius, and angles at \a aPosition when the arc is being edited.
......
......@@ -287,12 +287,13 @@ int LIB_BEZIER::GetPenSize() const
void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform )
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
wxPoint pos1;
std::vector<wxPoint> PolyPointsTraslated;
int color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
m_PolyPoints = Bezier2Poly( m_BezierPoints[0],
m_BezierPoints[1],
......
......@@ -43,7 +43,7 @@ class LIB_BEZIER : public LIB_ITEM
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
public:
......
......@@ -210,11 +210,12 @@ int LIB_CIRCLE::GetPenSize() const
void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform )
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
......
......@@ -39,7 +39,7 @@ class LIB_CIRCLE : public LIB_ITEM
int m_Width; // Line width.
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
void calcEdit( const wxPoint& aPosition );
......
......@@ -114,14 +114,14 @@ bool LIB_ITEM::operator<( const LIB_ITEM& aOther ) const
}
void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor,
void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform )
{
if( InEditMode() )
{
// Temporarily disable filling while the item is being edited.
FILL_T fillMode = m_Fill;
int color = GetDefaultColor();
EDA_COLOR_T color = GetDefaultColor();
m_Fill = NO_FILL;
......@@ -150,7 +150,7 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
}
int LIB_ITEM::GetDefaultColor()
EDA_COLOR_T LIB_ITEM::GetDefaultColor()
{
return ReturnLayerColor( LAYER_DEVICE );
}
......@@ -88,7 +88,7 @@ class LIB_ITEM : public EDA_ITEM
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
*/
virtual void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor,
const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform ) = 0;
......@@ -99,7 +99,7 @@ class LIB_ITEM : public EDA_ITEM
* @param aDC The device context to draw on.
* @param aColor The index of the color to draw.
*/
virtual void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor ) {}
virtual void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int EDA_COLOR_T ) {}
/**
* Calculates the attributes of an item at \a aPosition when it is being edited.
......@@ -213,7 +213,7 @@ public:
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint &aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
/**
......@@ -402,7 +402,7 @@ public:
void SetEraseLastDrawItem( bool aErase = true ) { m_eraseLastDrawItem = aErase; }
virtual int GetDefaultColor();
virtual EDA_COLOR_T GetDefaultColor();
void SetUnit( int aUnit ) { m_Unit = aUnit; }
......
......@@ -260,7 +260,8 @@ int LIB_FIELD::GetPenSize() const
void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform )
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
wxPoint text_pos;
int color;
......@@ -514,9 +515,9 @@ EDA_RECT LIB_FIELD::GetBoundingBox() const
}
int LIB_FIELD::GetDefaultColor()
EDA_COLOR_T LIB_FIELD::GetDefaultColor()
{
int color;
EDA_COLOR_T color;
switch( m_id )
{
......
......@@ -71,7 +71,7 @@ class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
* </p>
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
/**
......@@ -205,7 +205,7 @@ public:
*/
wxString GetFullText( int unit = 1 );
int GetDefaultColor();
EDA_COLOR_T GetDefaultColor();
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
......
......@@ -789,7 +789,7 @@ int LIB_PIN::GetPenSize() const
void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aColor,
EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode,
void* aData,
const TRANSFORM& aTransform )
......@@ -854,15 +854,14 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
const wxPoint& aPinPos,
int aOrient,
GR_DRAWMODE aDrawMode,
int aColor )
EDA_COLOR_T aColor )
{
int MapX1, MapY1, x1, y1;
int color;
int width = GetPenSize();
int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
color = ReturnLayerColor( LAYER_PIN );
EDA_COLOR_T color = ReturnLayerColor( LAYER_PIN );
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -1069,7 +1068,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
int TextInside,
bool DrawPinNum,
bool DrawPinName,
int Color,
EDA_COLOR_T Color,
GR_DRAWMODE DrawMode )
{
int x, y, x1, y1;
......@@ -1271,9 +1270,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
{
int MapX1, MapY1, x1, y1;
EDA_COLOR_T color = UNSPECIFIED;
color = ReturnLayerColor( LAYER_PIN );
EDA_COLOR_T color = ReturnLayerColor( LAYER_PIN );
aPlotter->SetColor( color );
......
......@@ -117,7 +117,7 @@ class LIB_PIN : public LIB_ITEM
int m_nameTextSize; /* Pin num and Pin name sizes */
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
public:
......@@ -363,7 +363,7 @@ public:
*/
void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
int aOrientation, GR_DRAWMODE aDrawMode,
int aColor = -1 );
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
/**
* Function DrawPinTexts
......@@ -376,7 +376,7 @@ public:
*/
void DrawPinTexts( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName,
int aColor, GR_DRAWMODE aDrawMode );
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode );
/**
* Function PlotPinTexts
......
......@@ -265,11 +265,11 @@ int LIB_POLYLINE::GetPenSize() const
void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
wxPoint* buffer = NULL;
if( aColor < 0 ) // Used normal color or selected color
......
......@@ -40,7 +40,7 @@ class LIB_POLYLINE : public LIB_ITEM
int m_ModifyIndex; // Index of the polyline point to modify
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
void calcEdit( const wxPoint& aPosition );
......
......@@ -195,12 +195,12 @@ int LIB_RECTANGLE::GetPenSize() const
void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode,
void* aData, const TRANSFORM& aTransform )
{
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
......
......@@ -42,7 +42,7 @@ class LIB_RECTANGLE : public LIB_ITEM
bool m_isStartPointSelected; // Flag: is the upper left edge selected?
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
void calcEdit( const wxPoint& aPosition );
......
......@@ -318,7 +318,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 );
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + offset;
plotter->Text( pos, UNSPECIFIED, m_Text,
plotter->Text( pos, UNSPECIFIED_COLOR, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GetPenSize(), m_Italic, m_Bold );
......@@ -344,9 +344,10 @@ int LIB_TEXT::GetPenSize() const
void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform )
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
int color = GetDefaultColor();
EDA_COLOR_T color = GetDefaultColor();
if( aColor < 0 ) // Used normal color or selected color
{
......
......@@ -48,7 +48,7 @@ class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
bool m_updateText; ///< Flag to indicate text change occurred while editing.
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, GR_DRAWMODE aDrawMode, void* aData,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );
void calcEdit( const wxPoint& aPosition );
......
......@@ -726,9 +726,9 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair();
int oldFlags = m_drawItem->GetFlags();
m_drawItem->ClearFlags();
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) );
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
m_drawItem->SetFlags( oldFlags );
m_lastDrawItem = NULL;
break;
......@@ -932,18 +932,18 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
return;
/* Deleting old text. */
// Deleting old text
if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
frame->ShowModal();
frame->Destroy();
OnModify();
/* Display new text. */
// Display new text
if( DC && !DrawItem->InEditMode() )
DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, NULL,
DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_DEFAULT_DRAWMODE, NULL,
DefaultTransform );
}
......
......@@ -267,7 +267,7 @@ another pin. Continue?" ) );
m_canvas->CrossHairOff( DC );
bool showPinText = true;
CurrentPin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
CurrentPin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_DEFAULT_DRAWMODE,
&showPinText, DefaultTransform );
m_canvas->CrossHairOn( DC );
......@@ -342,13 +342,13 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
if( aErase )
{
CurrentPin->SetPosition( PinPreviousPos );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode,
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
&showPinText, DefaultTransform );
}
// Redraw pin in new position
CurrentPin->SetPosition( aPanel->GetScreen()->GetCrossHairPosition( true ) );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, &showPinText, DefaultTransform );
PinPreviousPos = CurrentPin->GetPosition();
......@@ -412,7 +412,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove );
if( DC )
pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_COPY, &showPinText,
pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_COPY, &showPinText,
DefaultTransform );
}
......@@ -500,7 +500,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
if( selected && !Pin->IsSelected() )
continue;
Pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
Pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, &showPinText, DefaultTransform );
switch( id )
{
......@@ -517,7 +517,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
break;
}
Pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, &showPinText,
Pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_DEFAULT_DRAWMODE, &showPinText,
DefaultTransform );
}
}
......
......@@ -49,7 +49,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false );
/****************/
/* EEREDRAW.CPP */
/****************/
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, int Color );
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, EDA_COLOR_T Color );
/***********************************/
......
......@@ -195,7 +195,7 @@ EDA_RECT SCH_BITMAP::GetBoundingBox() const
void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor )
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
wxPoint pos = m_Pos + aOffset;
......
......@@ -95,7 +95,7 @@ public:
void SwapData( SCH_ITEM* aItem );
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor = -1 );
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
/**
* Function ReadImageFile
......
......@@ -178,9 +178,9 @@ int SCH_BUS_ENTRY::GetPenSize() const
void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor )
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int color;
EDA_COLOR_T color;
if( aColor >= 0 )
color = aColor;
......
......@@ -86,7 +86,7 @@ public:
void SwapData( SCH_ITEM* aItem );
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor = -1 );
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -290,7 +290,7 @@ int SCH_COMPONENT::GetPartCount() const
void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE DrawMode, int Color, bool DrawPinText )
GR_DRAWMODE DrawMode, EDA_COLOR_T Color, bool DrawPinText )
{
bool dummy = false;
......
......@@ -250,7 +250,7 @@ public:
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
int Color = -1 )
EDA_COLOR_T Color = UNSPECIFIED_COLOR )
{
Draw( panel, DC, offset, draw_mode, Color, true );
}
......@@ -259,7 +259,7 @@ public:
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
int Color,
EDA_COLOR_T Color,
bool DrawPinText );
void SwapData( SCH_ITEM* aItem );
......
......@@ -130,7 +130,7 @@ int SCH_FIELD::GetPenSize() const
void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, GR_DRAWMODE DrawMode, int Color )
const wxPoint& offset, GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
int orient;
EDA_COLOR_T color;
......@@ -537,9 +537,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T,
wxT( "Cannot plot field with invalid parent." ) );
EDA_COLOR_T color = UNSPECIFIED;
color = ReturnLayerColor( GetLayer() );
EDA_COLOR_T color = ReturnLayerColor( GetLayer() );
if( m_Attributs & TEXT_NO_VISIBLE )
return;
......
......@@ -138,7 +138,7 @@ public:
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
int aColor = -1 );
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -114,9 +114,9 @@ EDA_RECT SCH_JUNCTION::GetBoundingBox() const
void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor )
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int color;
EDA_COLOR_T color;
if( aColor >= 0 )
color = aColor;
......
......@@ -55,7 +55,7 @@ public:
EDA_RECT GetBoundingBox() const;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor = -1 );
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -222,9 +222,9 @@ int SCH_LINE::GetPenSize() const
void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE DrawMode, int Color )
GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
int color;
EDA_COLOR_T color;
int width = GetPenSize();
if( Color >= 0 )
......
......@@ -85,7 +85,7 @@ public:
double GetLength() const;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor = -1 );
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -103,7 +103,7 @@ bool SCH_MARKER::Save( FILE* aFile ) const
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, GR_DRAWMODE aDrawMode, int aColor )
const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
EDA_COLOR_T color = (EDA_COLOR_T) m_Color;
EDA_COLOR_T tmp = color;
......@@ -118,7 +118,7 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aColor < 0 )
m_Color = color;
else
m_Color = (EDA_COLOR_T) aColor;
m_Color = aColor;
DrawMarker( aPanel, aDC, aDrawMode, aOffset );
m_Color = tmp;
......
......@@ -67,7 +67,7 @@ public:
}
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDraw_mode, int aColor = -1 );
GR_DRAWMODE aDraw_mode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -123,15 +123,16 @@ int SCH_NO_CONNECT::GetPenSize() const
void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor )
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int pX, pY, color;
int pX, pY;
int delta = m_size.x / 2;
int width = g_DrawDefaultLineThickness;
pX = m_pos.x + aOffset.x;
pY = m_pos.y + aOffset.y;
EDA_COLOR_T color;
if( aColor >= 0 )
color = aColor;
else
......
......@@ -55,7 +55,7 @@ public:
void SwapData( SCH_ITEM* aItem );
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor = -1 );
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -156,9 +156,9 @@ int SCH_POLYLINE::GetPenSize() const
void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor )
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int color;
EDA_COLOR_T color;
int width = GetPenSize();
if( aColor >= 0 )
......
......@@ -52,7 +52,7 @@ public:
}
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, int aColor = -1 );
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;
......
......@@ -549,7 +549,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
// note: SCH_SCREEN::Draw is useful only for schematic.
// library editor and library viewer do not use a draw list, and therefore
// SCH_SCREEN::Draw draws nothing
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, int aColor )
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
for( SCH_ITEM* item = m_drawList.begin(); item != NULL; item = item->Next() )
{
......
......@@ -566,11 +566,11 @@ wxPoint SCH_SHEET::GetFileNamePosition()
void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, GR_DRAWMODE aDrawMode, int aColor )
const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int txtcolor;
EDA_COLOR_T txtcolor;
wxString Text;
int color;
EDA_COLOR_T color;
int name_orientation;
wxPoint pos_sheetname,pos_filename;
wxPoint pos = m_pos + aOffset;
......@@ -1102,7 +1102,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
void SCH_SHEET::Plot( PLOTTER* aPlotter )
{
EDA_COLOR_T txtcolor = UNSPECIFIED;
EDA_COLOR_T txtcolor = UNSPECIFIED_COLOR;
wxSize size;
wxString Text;
int name_orientation;
......
......@@ -98,7 +98,7 @@ public:
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDraw_mode,
int aColor = -1 );
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
/**
* Function CreateGraphicShape (virtual)
......@@ -395,7 +395,7 @@ public:
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
int aColor = -1 );
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
EDA_RECT GetBoundingBox() const;
......
......@@ -71,7 +71,7 @@ void SCH_SHEET_PIN::Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDraw_mode,
int aColor )
EDA_COLOR_T aColor )
{
// The icon selection is handle by the virtual method CreateGraphicShape
// called by ::Draw
......
......@@ -370,7 +370,7 @@ int SCH_TEXT::GetPenSize() const
void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
GR_DRAWMODE DrawMode, int Color )
GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
EDA_COLOR_T color;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
......@@ -378,7 +378,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 )
color = (EDA_COLOR_T) Color;
color = Color;
else
color = ReturnLayerColor( m_Layer );
......@@ -386,7 +386,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
wxPoint text_offset = aOffset + GetSchematicTextOffset();
EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED );
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( linewidth, m_Thickness ); // set initial value
if( m_isDangling )
......@@ -880,7 +880,7 @@ bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
void SCH_LABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE DrawMode, int Color )
GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
}
......@@ -1192,14 +1192,14 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& aOffset,
GR_DRAWMODE DrawMode,
int Color )
EDA_COLOR_T Color )
{
static std::vector <wxPoint> Poly;
EDA_COLOR_T color;
wxPoint text_offset = aOffset + GetSchematicTextOffset();
if( Color >= 0 )
color = (EDA_COLOR_T) Color;
color = Color;
else
color = ReturnLayerColor( m_Layer );
......@@ -1208,7 +1208,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
int linewidth = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED );
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( linewidth, m_Thickness ); // set initial value
CreateGraphicShape( Poly, m_Pos + aOffset );
......@@ -1522,7 +1522,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE DrawMode,
int Color )
EDA_COLOR_T Color )
{
static std::vector <wxPoint> Poly;
EDA_COLOR_T color;
......@@ -1531,7 +1531,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 )
color = (EDA_COLOR_T) Color;
color = Color;
else
color = ReturnLayerColor( m_Layer );
......@@ -1539,7 +1539,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
EXCHG( linewidth, m_Thickness ); // Set the minimum width
wxPoint text_offset = offset + GetSchematicTextOffset();
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED );
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( linewidth, m_Thickness ); // set initial value
CreateGraphicShape( Poly, m_Pos + offset );
......
......@@ -134,7 +134,7 @@ public:
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
int Color = -1 );
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
/**
* Function CreateGraphicShape
......@@ -231,7 +231,7 @@ public:
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
int Color = -1 );
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
wxString GetClass() const
{
......@@ -282,7 +282,7 @@ public:
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
int Color = -1 );
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
wxString GetClass() const
{
......@@ -337,7 +337,7 @@ public:
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
int Color = -1 );
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
wxString GetClass() const
{
......
......@@ -240,7 +240,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
if( m_drawItem->ContinueEdit( pos ) )
{
m_drawItem->Draw( m_canvas, DC, pos, -1, g_XorMode, NULL, DefaultTransform );
m_drawItem->Draw( m_canvas, DC, pos, UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
return;
}
......@@ -270,11 +270,11 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
{
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, &text,
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, &text,
DefaultTransform );
}
else
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, NULL,
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL,
DefaultTransform );
}
......@@ -317,7 +317,7 @@ static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
return;
item->SetEraseLastDrawItem( aErase );
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, NULL,
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL,
DefaultTransform );
}
......
......@@ -151,10 +151,9 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositon,
bool aErase )
{
int Color;
BASE_SCREEN* screen = aPanel->GetScreen();
Color = YELLOW;
EDA_COLOR_T Color = YELLOW;
if( aErase )
{
......
......@@ -131,7 +131,7 @@ int AM_PRIMITIVE::GetExposure(GERBER_DRAW_ITEM* aParent) const
void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox,
wxDC* aDC,
int aColor, int aAltColor,
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor,
wxPoint aShapePos,
bool aFilledShape )
{
......@@ -727,7 +727,7 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
*/
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC,
int aColor, int aAltColor,
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor,
wxPoint aShapePos, bool aFilledShape )
{
for( AM_PRIMITIVES::iterator prim_macro = primitives.begin();
......
......@@ -135,7 +135,7 @@ public: AM_PRIMITIVE( bool aGerbMetric, AM_PRIMITIVE_ID aId = AMP_UNKNOWN )
* @param aFilledShape = true to draw in filled mode, false to draw in skecth mode
*/
void DrawBasicShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
int aColor, int aAltColor, wxPoint aShapePos, bool aFilledShape );
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor, wxPoint aShapePos, bool aFilledShape );
/** GetShapeDim
* Calculate a value that can be used to evaluate the size of text
......@@ -207,7 +207,7 @@ struct APERTURE_MACRO
* @param aFilledShape = true to draw in filled mode, false to draw in skecth mode
*/
void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
int aColor, int aAltColor, wxPoint aShapePos, bool aFilledShape );
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor, wxPoint aShapePos, bool aFilledShape );
/**
* Function GetShapeDim
......
......@@ -64,7 +64,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
}
// Returns a color index from the layer id
int GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex )
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const
{
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
......@@ -72,7 +72,7 @@ int GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex )
}
// Returns the name of the layer id
const wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex )
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex ) const
{
wxString name;
name.Printf( _( "Layer %d" ), aLayerIndex + 1 );
......
......@@ -37,15 +37,15 @@ public:
// Returns a color index from the layer id
// Virtual function
int GetLayerColor( int aLayerIndex );
EDA_COLOR_T GetLayerColor( int aLayerIndex ) const;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( int aLayerIndex ) { return true; };
bool IsLayerEnabled( int aLayerIndex ) const { return true; };
// Returns the name of the layer id
// Virtual function
const wxString GetLayerName( int aLayerIndex );
wxString GetLayerName( int aLayerIndex ) const;
};
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H
......@@ -308,7 +308,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
{
// used when a D_CODE is not found. default D_CODE to draw a flashed item
static D_CODE dummyD_CODE( 0 );
int color, alt_color;
EDA_COLOR_T color, alt_color;
bool isFilled;
int radius;
int halfPenWidth;
......@@ -325,12 +325,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
color = gerbFrame->GetLayerColor( GetLayer() );
if( aDrawMode & GR_HIGHLIGHT )
{
if( aDrawMode & GR_AND )
color &= ~HIGHLIGHT_FLAG;
else
color |= HIGHLIGHT_FLAG;
}
ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
if( color & HIGHLIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
......@@ -528,7 +523,7 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon( )
void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox,
wxDC* aDC,
int aColor,
EDA_COLOR_T aColor,
const wxPoint& aOffset,
bool aFilledShape )
{
......
......@@ -237,7 +237,7 @@ public:
* a helper function used to draw the polygon stored in m_PolyCorners
*/
void DrawGbrPoly( EDA_RECT* aClipBox,
wxDC* aDC, int aColor,
wxDC* aDC, EDA_COLOR_T aColor,
const wxPoint& aOffset, bool aFilledShape );
/* divers */
......
......@@ -208,7 +208,7 @@ void GERBER_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
{
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
......@@ -244,7 +244,7 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
myframe->GetCanvas()->Refresh();
}
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor )
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
{
myframe->SetVisibleElementColor( aId, aColor );
myframe->GetCanvas()->Refresh();
......
......@@ -88,10 +88,10 @@ public:
void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor );
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**
* Function SetLayersManagerTabsText
......
......@@ -339,7 +339,8 @@ void GERBVIEW_FRAME::CopyDCodesSizeToItems()
void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC, int aColor, int aAltColor,
EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
EDA_COLOR_T aAltColor,
wxPoint aShapePos, bool aFilledShape )
{
int radius;
......@@ -456,7 +457,7 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC,
int aColor, bool aFilled,
EDA_COLOR_T aColor, bool aFilled,
const wxPoint& aPosition )
{
if( m_PolyCorners.size() == 0 )
......
......@@ -171,7 +171,7 @@ public:
* @param aFilledShape = true to draw in filled mode, false to draw in sketch mode
*/
void DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox,
wxDC* aDC, int aColor, int aAltColor,
wxDC* aDC, EDA_COLOR_T aColor, EDA_COLOR_T aAltColor,
wxPoint aShapePos, bool aFilledShape );
/**
......@@ -188,7 +188,7 @@ public:
* @param aPosition = the actual shape position
*/
void DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC, int aColor,
EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
bool aFilled, const wxPoint& aPosition );
/**
......
......@@ -259,7 +259,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( gerber->m_ImageNegative )
{
// Draw background negative (i.e. in graphic layer color) for negative images.
int color = gerbFrame->GetLayerColor( layer );
EDA_COLOR_T color = gerbFrame->GetLayerColor( layer );
GRSetDrawMode( &layerDC, GR_COPY );
GRFilledRect( &drawBox, plotDC, drawBox.GetX(), drawBox.GetY(),
......
......@@ -44,7 +44,7 @@
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
extern int g_DrawBgColor;
extern EDA_COLOR_T g_DrawBgColor;
int g_Default_GERBER_Format;
......
......@@ -102,7 +102,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
false ) );
// Default colors for layers 0 to 31
static const int color_default[] = {
static const EDA_COLOR_T color_default[] = {
GREEN, BLUE, LIGHTGRAY, MAGENTA,
RED, DARKGREEN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, CYAN,
......@@ -134,7 +134,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
for( unsigned i = 0; i < DIM(keys); ++i )
{
int* prm = &g_ColorsSettings.m_LayersColors[i];
EDA_COLOR_T* prm = &g_ColorsSettings.m_LayersColors[i];
PARAM_CFG_SETCOLOR* prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
......
......@@ -563,9 +563,9 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayerIndex ) const
* returns the color of a pcb visible element.
* @see enum PCB_VISIBLE
*/
int GERBVIEW_FRAME::GetVisibleElementColor( int aItemIdVisible )
EDA_COLOR_T GERBVIEW_FRAME::GetVisibleElementColor( int aItemIdVisible )
{
int color = -1;
EDA_COLOR_T color = UNSPECIFIED_COLOR;
switch( aItemIdVisible )
{
......@@ -594,7 +594,7 @@ void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
}
void GERBVIEW_FRAME::SetVisibleElementColor( int aItemIdVisible, int aColor )
void GERBVIEW_FRAME::SetVisibleElementColor( int aItemIdVisible, EDA_COLOR_T aColor )
{
switch( aItemIdVisible )
{
......@@ -617,7 +617,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aItemIdVisible, int aColor )
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
int GERBVIEW_FRAME::GetLayerColor( int aLayer )
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
{
return m_colorsSettings->GetLayerColor( aLayer );
}
......@@ -627,7 +627,7 @@ int GERBVIEW_FRAME::GetLayerColor( int aLayer )
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
void GERBVIEW_FRAME::SetLayerColor( int aLayer, int aColor )
void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
{
m_colorsSettings->SetLayerColor( aLayer, aColor );
}
......
......@@ -320,21 +320,21 @@ public:
* returns the color of a pcb visible element.
* @see enum PCB_VISIBLE
*/
int GetVisibleElementColor( int aItemIdVisible );
EDA_COLOR_T GetVisibleElementColor( int aItemIdVisible );
void SetVisibleElementColor( int aItemIdVisible, int aColor );
void SetVisibleElementColor( int aItemIdVisible, EDA_COLOR_T aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
int GetLayerColor( int aLayer );
EDA_COLOR_T GetLayerColor( int aLayer ) const;
/**
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
void SetLayerColor( int aLayer, int aColor );
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
/**
* Function ReFillLayerWidget
......
......@@ -124,7 +124,7 @@ public:
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
int aColor );
EDA_COLOR_T aColor );
/**
* Function PushItem
......@@ -147,7 +147,7 @@ public:
*/
void ClearItemsList();
unsigned GetCount()
unsigned GetCount() const
{
return m_items.GetCount();
}
......
......@@ -19,10 +19,10 @@ public:
// Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, GerbView
int m_LayersColors[LAYERSCOLORSBUFFERSIZE]; ///< Layer colors (tracks and graphic items)
EDA_COLOR_T m_LayersColors[LAYERSCOLORSBUFFERSIZE]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
int m_ItemsColors[ITEMSCOLORSBUFFERSIZE]; ///< All others items but layers
EDA_COLOR_T m_ItemsColors[ITEMSCOLORSBUFFERSIZE]; ///< All others items but layers
public:
COLORS_DESIGN_SETTINGS( );
......@@ -32,35 +32,35 @@ public:
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
int GetLayerColor( int aLayer );
EDA_COLOR_T GetLayerColor( int aLayer ) const;
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void SetLayerColor( int aLayer, int aColor );
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
/**
* Function GetItemColor
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
int GetItemColor( int aItemIdx );
EDA_COLOR_T GetItemColor( int aItemIdx );
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
void SetItemColor( int aItemIdx, int aColor );
void SetItemColor( int aItemIdx, EDA_COLOR_T aColor );
/**
* Function SetAllColorsAs
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
void SetAllColorsAs( int aColor);
void SetAllColorsAs( EDA_COLOR_T aColor);
};
#endif // _COLORS_DESIGN_SETTING_H
......@@ -326,7 +326,7 @@ public:
* @param aDC - the device context to draw the cursor
* @param aColor - the color to draw the cursor
*/
void DrawCrossHair( wxDC* aDC, int aColor = WHITE );
void DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor = WHITE );
// Hide the cross hair.
void CrossHairOff( wxDC* DC );
......
......@@ -34,15 +34,15 @@ public:
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
virtual int GetLayerColor( int aLayerIndex ) = 0;
virtual EDA_COLOR_T GetLayerColor( int aLayerIndex ) const = 0;
// Returns the name of the layer id
// Virtual pure function because GerbView uses its own functions in a derived class
virtual const wxString GetLayerName( int aLayerIndex ) = 0;
virtual wxString GetLayerName( int aLayerIndex ) const = 0;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function pure because GerbView uses its own functions in a derived class
virtual bool IsLayerEnabled( int aLayerIndex ) = 0;
virtual bool IsLayerEnabled( int aLayerIndex ) const = 0;
// Get Current Item #
int GetChoice();
......
......@@ -190,7 +190,7 @@ public:
* @param aColor The drawing color.
*/
void Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode,
int aColor = -1 );
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
/**
* Function Plot
......
......@@ -7,43 +7,12 @@
#include <wx/wx.h>
/* Number of colors ( 32 bit palette. ) */
#define NBCOLOR 24
#define MASKCOLOR 31 ///< mask for color index into ColorRefs[]
/// Flag bit display (seen / not seen) items: (defined in the color values
//IMB: Not used anymore #define ITEM_NOT_SHOW (1<<18) // 0x40000
#define HIGHLIGHT_FLAG ( 1<<19 ) // 0x80000
/**
* Function SetAlpha
* ORs in the alpha blend parameter in to a color index.
/** The color enumeration. Also contains a flag and the alpha value in
* the upper bits
*/
static inline void SetAlpha( int* aColor, int aBlend )
{
const int MASKALPHA = 0xFF;
*aColor = (*aColor & ~(MASKALPHA << 24)) | ((aBlend & MASKALPHA) << 24);
}
/**
* Function GetAlpha
* returns the alpha blend parameter from a color index.
*/
static inline int GetAlpha( int aColor )
{
const int MASKALPHA = 0xFF;
return (aColor >> 24) & MASKALPHA;
}
enum EDA_COLOR_T
{
UNSPECIFIED = -1,
UNSPECIFIED_COLOR = -1,
BLACK = 0,
BLUE,
GREEN,
......@@ -68,19 +37,72 @@ enum EDA_COLOR_T
DARKMAGENTA,
DARKBROWN,
LIGHTYELLOW,
LASTCOLOR
LASTCOLOR,
HIGHLIGHT_FLAG = ( 1<<19 ),
NBCOLOR = 24, ///< Number of colors
MASKCOLOR = 31 ///< mask for color index into ColorRefs[]
};
/// Checked cast. Use only when necessary (ex. I/O)
inline EDA_COLOR_T ColorFromInt( int aColor )
{
wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor < LASTCOLOR );
return static_cast<EDA_COLOR_T>( aColor );
}
/// Return only the plain color part
inline EDA_COLOR_T ColorGetBase( EDA_COLOR_T aColor)
{
return static_cast<EDA_COLOR_T>( aColor & MASKCOLOR );
}
/// Force the color part of a color to darkdarkgray
inline void ColorTurnToDarkDarkGray( EDA_COLOR_T *aColor )
{
*aColor = static_cast<EDA_COLOR_T>( (int(*aColor) & ~MASKCOLOR) | DARKDARKGRAY );
}
inline void ColorChangeHighlightFlag( EDA_COLOR_T *aColor, bool flag )
{
if( flag )
*aColor = static_cast<EDA_COLOR_T>( (int(*aColor) | HIGHLIGHT_FLAG ) );
else
*aColor = static_cast<EDA_COLOR_T>( (int(*aColor) & ~HIGHLIGHT_FLAG ) );
}
/**
* Function SetAlpha
* ORs in the alpha blend parameter in to a color index.
*/
inline void SetAlpha( EDA_COLOR_T* aColor, unsigned char aBlend )
{
const unsigned char MASKALPHA = 0xFF;
*aColor = static_cast<EDA_COLOR_T>((*aColor & ~(MASKALPHA << 24))
| ((aBlend & MASKALPHA) << 24));
}
/**
* Function GetAlpha
* returns the alpha blend parameter from a color index.
*/
inline unsigned char GetAlpha( EDA_COLOR_T aColor )
{
const unsigned char MASKALPHA = 0xFF;
return (aColor >> 24) & MASKALPHA;
}
struct StructColors
{
unsigned char m_Blue;
unsigned char m_Green;
unsigned char m_Red;
unsigned char m_Numcolor;
EDA_COLOR_T m_Numcolor;
const wxChar* m_Name;
int m_LightColor;
EDA_COLOR_T m_LightColor;
};
// list of existing Colors:
......@@ -95,7 +117,7 @@ extern StructColors ColorRefs[NBCOLOR];
* not supporting alpha.
* @return wxColour - given a KiCad color index with alpha value
*/
static inline wxColour MakeColour( int aColor )
inline wxColour MakeColour( EDA_COLOR_T aColor )
{
#if wxCHECK_VERSION(2,8,5)
int alpha = GetAlpha( aColor );
......@@ -112,7 +134,4 @@ static inline wxColour MakeColour( int aColor )
);
}
int DisplayColorFrame( wxWindow* parent, int OldColor );
#endif /* ifndef _COLORS_H */
......@@ -40,6 +40,7 @@
#include <richio.h>
#include <convert_to_biu.h>
#include <colors.h>
#if !wxUSE_PRINTING_ARCHITECTURE && !SWIG
# error "You must use '--enable-printarch' in your wx library configuration."
......@@ -465,7 +466,7 @@ extern wxString g_Prj_Config_LocalFilename;
extern EDA_UNITS_T g_UserUnit; ///< display units
/// Draw color for moving objects.
extern int g_GhostColor;
extern EDA_COLOR_T g_GhostColor;
// COMMON.CPP
......@@ -574,7 +575,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info );
*/
time_t GetNewTimeStamp();
int DisplayColorFrame( wxWindow* parent, int OldColor );
EDA_COLOR_T DisplayColorFrame( wxWindow* parent, int OldColor );
int GetCommandOptions( const int argc, const char** argv,
const char* stringtst, const char** optarg,
int* optind );
......
......@@ -166,7 +166,7 @@ public:
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE,
EDA_COLOR_T aAnchor_color = UNSPECIFIED );
EDA_COLOR_T aAnchor_color = UNSPECIFIED_COLOR );
private:
......@@ -180,7 +180,7 @@ private:
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aFillMode = LINE, FILLED or SKETCH
* @param aAnchor_color = anchor color ( UNSPECIFIED = do not draw anchor ).
* @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
* @param aText = the single line of text to draw.
* @param aPos = the position of this line ).
*/
......
......@@ -73,8 +73,6 @@ inline GR_DRAWMODE operator &(const GR_DRAWMODE& a, const GR_DRAWMODE& b)
return static_cast<GR_DRAWMODE>( int( a ) & int( b ) );
}
#define GR_M_LEFT_DOWN 0x10000000
#define GR_M_RIGHT_DOWN 0x20000000
#define GR_M_MIDDLE_DOWN 0x40000000
......@@ -90,7 +88,7 @@ typedef int wxPenStyle;
extern GR_DRAWMODE g_XorMode;
extern int g_DrawBgColor;
extern EDA_COLOR_T g_DrawBgColor;
typedef enum {
......@@ -106,8 +104,8 @@ class EDA_DRAW_PANEL;
void GRSetDrawMode( wxDC* DC, GR_DRAWMODE mode );
GR_DRAWMODE GRGetDrawMode( wxDC* DC );
void GRResetPenAndBrush( wxDC* DC );
void GRSetColorPen( wxDC* DC, int Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
void GRSetBrush( wxDC* DC, int Color, int fill = 0 );
void GRSetColorPen( wxDC* DC, EDA_COLOR_T Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
void GRSetBrush( wxDC* DC, EDA_COLOR_T Color, bool fill = false );
/**
* Function GRForceBlackPen
......@@ -121,23 +119,23 @@ void GRForceBlackPen( bool flagforce );
*/
bool GetGRForceBlackPenState( void );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, int aColor );
void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, EDA_COLOR_T aColor );
void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, int Color );
int width, EDA_COLOR_T Color );
void GRDashedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, int Color );
void GRDashedLineTo( EDA_RECT* ClipBox, wxDC* DC, int x2, int y2, int width, int Color );
int width, EDA_COLOR_T Color );
void GRDashedLineTo( EDA_RECT* ClipBox, wxDC* DC, int x2, int y2, int width, EDA_COLOR_T Color );
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, EDA_COLOR_T Color );
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[], bool Fill,
int width, int Color, int BgColor );
int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRBezier( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int x3, int y3, int width, int Color );
int x3, int y3, int width, EDA_COLOR_T Color );
void GRBezier( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4, int width, int Color );
int x3, int y3, int x4, int y4, int width, EDA_COLOR_T Color );
/**
* Function GRClosedPoly
......@@ -156,8 +154,8 @@ void GRClosedPoly( EDA_RECT* ClipBox,
int aPointCount,
wxPoint aPoints[],
bool doFill,
int aPenColor,
int aFillColor );
EDA_COLOR_T aPenColor,
EDA_COLOR_T aFillColor );
// @todo could make these 2 closed polygons calls a single function and default
// the aPenWidth argument
......@@ -181,8 +179,8 @@ void GRClosedPoly( EDA_RECT* ClipBox,
wxPoint aPoints[],
bool doFill,
int aPenWidth,
int aPenColor,
int aFillColor );
EDA_COLOR_T aPenColor,
EDA_COLOR_T aFillColor );
/**
......@@ -198,56 +196,56 @@ void GRClosedPoly( EDA_RECT* ClipBox,
* @param aColor is an index into our color table of RGB colors.
* @see EDA_COLOR_T and colors.h
*/
void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, int aColor );
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, int Color );
void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, EDA_COLOR_T aColor );
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, EDA_COLOR_T Color );
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width,
int Color, int BgColor );
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aColor );
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, int aColor );
EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, EDA_COLOR_T aColor );
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, EDA_COLOR_T aColor );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle,
int EndAngle, int r, int Color );
int EndAngle, int r, EDA_COLOR_T Color );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle,
int EndAngle, int r, int width, int Color );
int EndAngle, int r, int width, EDA_COLOR_T 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, EDA_COLOR_T 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, EDA_COLOR_T Color );
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
wxPoint aCenter, int aWidth, int aColor );
wxPoint aCenter, int aWidth, EDA_COLOR_T aColor );
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, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, 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 );
int EndAngle, int r, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, int Color );
int width, EDA_COLOR_T Color );
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
int aWidth, int aColor );
int aWidth, EDA_COLOR_T aColor );
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, int aPenSize, int Color );
int width, int aPenSize, EDA_COLOR_T Color );
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
int aWidth, int aColor );
int aWidth, EDA_COLOR_T aColor );
void GRSetColor( int Color );
void GRSetColor( EDA_COLOR_T Color );
void GRSetDefaultPalette();
int GRGetColor();
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int color );
EDA_COLOR_T GRGetColor();
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, EDA_COLOR_T color );
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
int x2, int y2, int Color, int BgColor );
int x2, int y2, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
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 );
void GRRect( EDA_RECT* ClipBox, wxDC* DC,const EDA_RECT& aRect, int aWidth, int Color );
int x2, int y2, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, EDA_COLOR_T Color );
void GRRect( EDA_RECT* ClipBox, wxDC* DC,const EDA_RECT& aRect, int aWidth, EDA_COLOR_T 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, EDA_COLOR_T Color );
void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC,const EDA_RECT& aRect,
int aWidth, int aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
int aWidth, EDA_COLOR_T aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
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, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
/**
* Function GRLineArray
......@@ -260,6 +258,6 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
* @see EDA_COLOR_T and colors.h
*/
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines,
int aWidth, int aColor );
int aWidth, EDA_COLOR_T aColor );
#endif /* define GR_BASIC */
......@@ -9,7 +9,8 @@
#include <wx/confbase.h>
#include <wx/fileconf.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <colors.h>
#include <limits>
......@@ -26,13 +27,6 @@ enum paramcfg_id {
PARAM_FIELDNAME_LIST
};
#define MAX_COLOR 0x8001F
#define IS_VALID_COLOR( c ) ( ( c >= 0 ) && ( c <= 0x8001F ) )
#define INT_MINVAL 0x80000000
#define INT_MAXVAL 0x7FFFFFFF
/**
* Class PARAM_CFG_BASE
......@@ -84,10 +78,14 @@ public:
public:
PARAM_CFG_INT( const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const;
......@@ -102,14 +100,14 @@ public:
class PARAM_CFG_SETCOLOR : public PARAM_CFG_BASE
{
public:
int* m_Pt_param; ///< Pointer to the parameter value
int m_Default; ///< The default value of the parameter
EDA_COLOR_T* m_Pt_param; ///< Pointer to the parameter value
EDA_COLOR_T m_Default; ///< The default value of the parameter
public:
PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
......
......@@ -168,7 +168,7 @@ public:
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
int aColor = -1 ) = 0;
EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) = 0;
/**
* Function Move
......
......@@ -281,7 +281,7 @@ public:
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible();
virtual bool IsGridVisible() const;
/**
* Function SetGridVisibility() , virtual
......@@ -295,13 +295,13 @@ public:
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor();
virtual EDA_COLOR_T GetGridColor() const;
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor(int aColor);
virtual void SetGridColor(EDA_COLOR_T aColor);
// Configurations:
void InstallConfigFrame();
......@@ -513,7 +513,7 @@ public:
* @return bool - true if the element is visible.
* @see enum PCB_VISIBLE
*/
bool IsElementVisible( int aElement );
bool IsElementVisible( int aElement ) const;
/**
* Function SetElementVisibility
......
......@@ -378,7 +378,7 @@ protected:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
EDA_COLOR_T m_GridColor; // Grid color
/// The area to draw on.
EDA_DRAW_PANEL* m_canvas;
......@@ -533,7 +533,7 @@ public:
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible()
virtual bool IsGridVisible() const
{
return m_DrawGrid;
}
......@@ -552,7 +552,7 @@ public:
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor()
virtual EDA_COLOR_T GetGridColor() const
{
return m_GridColor;
}
......@@ -561,7 +561,7 @@ public:
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor( int aColor )
virtual void SetGridColor( EDA_COLOR_T aColor )
{
m_GridColor = aColor;
}
......@@ -574,7 +574,7 @@ public:
* @param aPosition The position to test.
* @return The wxPoint of the appropriate cursor position.
*/
wxPoint GetGridPosition( const wxPoint& aPosition );
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
/**
* Command event handler for selecting grid sizes.
......@@ -694,7 +694,7 @@ public:
* @return a wxString containing the message locator like A3 or B6
* (or ?? if out of page limits)
*/
const wxString GetXYSheetReferences( const wxPoint& aPosition );
const wxString GetXYSheetReferences( const wxPoint& aPosition ) const;
void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
......@@ -816,7 +816,7 @@ public:
* @param pad - Number of spaces to pad between messages (default = 4).
*/
void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
int color, int pad = 6 );
EDA_COLOR_T color, int pad = 6 );
/**
* Clear all messages from the message panel.
......@@ -843,7 +843,7 @@ public:
* the current user unit is millimeters.
* @return The converted string for display in user interface elements.
*/
wxString CoordinateToString( int aValue, bool aConvertToMils = false );
wxString CoordinateToString( int aValue, bool aConvertToMils = false ) const;
/**
* Function LengthDoubleToString
......@@ -854,7 +854,7 @@ public:
* the current user unit is millimeters.
* @return The converted string for display in user interface elements.
*/
wxString LengthDoubleToString( double aValue, bool aConvertToMils = false );
wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ) const;
DECLARE_EVENT_TABLE()
};
......@@ -871,25 +871,7 @@ struct EDA_MSG_ITEM
int m_LowerY;
wxString m_UpperText;
wxString m_LowerText;
int m_Color;
/**
* Function operator=
* overload the assignment operator so that the wxStrings get copied
* properly when copying a EDA_MSG_ITEM.
* No, actually I'm not sure this needed, C++ compiler may auto-generate it.
*/
EDA_MSG_ITEM& operator=( const EDA_MSG_ITEM& rv )
{
m_X = rv.m_X;
m_UpperY = rv.m_UpperY;
m_LowerY = rv.m_LowerY;
m_UpperText = rv.m_UpperText; // overloaded operator=()
m_LowerText = rv.m_LowerText; // overloaded operator=()
m_Color = rv.m_Color;
return * this;
}
EDA_COLOR_T m_Color;
};
......@@ -917,7 +899,7 @@ protected:
/**
* Calculate the width and height of a text string using the system UI font.
*/
wxSize computeTextSize( const wxString& text );
wxSize computeTextSize( const wxString& text ) const;
public:
EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
......@@ -944,7 +926,7 @@ public:
* @param aColor Color of the text to display.
*/
void SetMessage( int aXPosition, const wxString& aUpperText,
const wxString& aLowerText, int aColor );
const wxString& aLowerText, EDA_COLOR_T aColor );
/**
* Append a message to the message panel.
......@@ -960,7 +942,7 @@ public:
* @param pad - Number of spaces to pad between messages (default = 4).
*/
void AppendMessage( const wxString& textUpper, const wxString& textLower,
int color, int pad = 6 );
EDA_COLOR_T color, int pad = 6 );
DECLARE_EVENT_TABLE()
};
......
......@@ -373,7 +373,8 @@ end_of_tst:
void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
{
int color, ii, jj;
int ii, jj;
EDA_COLOR_T color;
int ox, oy;
MATRIX_CELL top_state, bottom_state;
......@@ -896,7 +897,7 @@ double PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
cout = 0;
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
EDA_COLOR_T color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
if( AutoPlaceShowAll )
GRSetDrawMode( DC, GR_XOR );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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