Commit 1c0f034b authored by Dick Hollenbeck's avatar Dick Hollenbeck

Make KiCad compile with minimal warnings against SVN HEAD of wxWidgets as of today.

parent fe919cd4
...@@ -36,8 +36,10 @@ ...@@ -36,8 +36,10 @@
#include <queue> #include <queue>
#include <vector> #include <vector>
#include "3d_struct.h" #include <3d_struct.h>
#include "modelparsers.h" #include <modelparsers.h>
#include <xnode.h>
X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) : X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
S3D_MODEL_PARSER( aMaster ) S3D_MODEL_PARSER( aMaster )
...@@ -54,13 +56,13 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -54,13 +56,13 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename )
if( !doc.Load( aFilename ) ) if( !doc.Load( aFilename ) )
{ {
wxLogError( wxT( "Error while parsing file <%s>" ), GetChars( aFilename ) ); wxLogError( wxT( "Error while parsing file '%s'" ), GetChars( aFilename ) );
return; return;
} }
if( doc.GetRoot()->GetName() != wxT( "X3D" ) ) if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
{ {
wxLogError( wxT( "Filetype is not X3D <%s>" ), GetChars( aFilename ) ); wxLogError( wxT( "Filetype is not X3D '%s'" ), GetChars( aFilename ) );
return; return;
} }
...@@ -85,24 +87,25 @@ wxString X3D_MODEL_PARSER::VRML_representation() ...@@ -85,24 +87,25 @@ wxString X3D_MODEL_PARSER::VRML_representation()
for( unsigned i = 0; i < vrml_points.size(); i++ ) for( unsigned i = 0; i < vrml_points.size(); i++ )
{ {
output += wxT( "Shape {\n" output +=
" appearance Appearance {\n" wxT( "Shape {\n"
" material Material {\n" ) + " appearance Appearance {\n"
vrml_materials[i] + " material Material {\n" ) +
wxT( " }\n" vrml_materials[i] +
" }\n" wxT( " }\n"
" geometry IndexedFaceSet {\n" " }\n"
" solid TRUE\n" " geometry IndexedFaceSet {\n"
" coord Coordinate {\n" " solid TRUE\n"
" point [\n") + " coord Coordinate {\n"
vrml_points[i] + " point [\n") +
wxT( " ]\n" vrml_points[i] +
" }\n" wxT( " ]\n"
" coordIndex [\n" ) + " }\n"
vrml_coord_indexes[i] + " coordIndex [\n" ) +
wxT( " ]\n" vrml_coord_indexes[i] +
" }\n" wxT( " ]\n"
"},\n" ); " }\n"
"},\n" );
} }
return output; return output;
...@@ -115,6 +118,7 @@ void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent, ...@@ -115,6 +118,7 @@ void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent,
{ {
// Breadth-first search (BFS) // Breadth-first search (BFS)
std::queue< wxXmlNode* > found; std::queue< wxXmlNode* > found;
found.push( aParent ); found.push( aParent );
while( !found.empty() ) while( !found.empty() )
...@@ -140,7 +144,7 @@ void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent, ...@@ -140,7 +144,7 @@ void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent,
void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps ) void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps )
{ {
wxXmlProperty *prop; wxXmlAttribute* prop;
for( prop = aNode->GetAttributes(); for( prop = aNode->GetAttributes();
prop != NULL; prop != NULL;
...@@ -167,6 +171,7 @@ void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode ) ...@@ -167,6 +171,7 @@ void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
childnodes.clear(); childnodes.clear();
PROPERTY_MAP properties; PROPERTY_MAP properties;
GetNodeProperties( aTransformNode, properties ); GetNodeProperties( aTransformNode, properties );
GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes ); GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes );
...@@ -252,7 +257,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode ) ...@@ -252,7 +257,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
wxString vrml_material; wxString vrml_material;
PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF
for(;p != properties.end();p++) for( ; p != properties.end(); p++ )
{ {
vrml_material.Append( p->first + wxT( " " ) + p->second + wxT( "\n" ) ); vrml_material.Append( p->first + wxT( " " ) + p->second + wxT( "\n" ) );
} }
...@@ -270,8 +275,8 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode ) ...@@ -270,8 +275,8 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
{ {
if( material->m_Name == mat_name ) if( material->m_Name == mat_name )
{ {
wxString vrml_material; wxString vrml_material;
vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n" ), vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n" ),
material->m_SpecularColor.x, material->m_SpecularColor.x,
material->m_SpecularColor.y, material->m_SpecularColor.y,
...@@ -457,6 +462,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, ...@@ -457,6 +462,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
while( index_tokens.HasMoreTokens() ) while( index_tokens.HasMoreTokens() )
{ {
long index = 0; long index = 0;
index_tokens.GetNextToken().ToLong( &index ); index_tokens.GetNextToken().ToLong( &index );
// -1 marks the end of polygon // -1 marks the end of polygon
......
...@@ -480,7 +480,12 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE() ...@@ -480,7 +480,12 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
" (release," " (release,"
#endif #endif
__WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL __WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL
__WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 ")"
#if !wxCHECK_VERSION( 3, 0, 0 )
__WX_BO_WXWIN_COMPAT_2_6
#endif
__WX_BO_WXWIN_COMPAT_2_8 ")"
; ;
} }
......
...@@ -41,7 +41,12 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ) ...@@ -41,7 +41,12 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
// Prepare Bitmap // Prepare Bitmap
bmpDC.SelectObject( aLayerbmp ); bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) ); brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
bmpDC.SetBrush( brush ); bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
......
...@@ -396,15 +396,22 @@ void GRSetBrush( wxDC* DC, EDA_COLOR_T Color, bool fill ) ...@@ -396,15 +396,22 @@ void GRSetBrush( wxDC* DC, EDA_COLOR_T Color, bool fill )
|| s_DC_lastbrushfill != fill || s_DC_lastbrushfill != fill
|| s_DC_lastDC != DC ) || s_DC_lastDC != DC )
{ {
wxBrush DrawBrush; wxBrush brush;
DrawBrush.SetColour( MakeColour( Color ) );
brush.SetColour( MakeColour( Color ) );
if( fill ) if( fill )
DrawBrush.SetStyle( wxSOLID ); #if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
else
brush.SetStyle( wxBRUSHSTYLE_TRANSPARENT );
#else
brush.SetStyle( wxSOLID );
else else
DrawBrush.SetStyle( wxTRANSPARENT ); brush.SetStyle( wxTRANSPARENT );
#endif
DC->SetBrush( DrawBrush ); DC->SetBrush( brush );
s_DC_lastbrushcolor = Color; s_DC_lastbrushcolor = Color;
s_DC_lastbrushfill = fill; s_DC_lastbrushfill = fill;
......
...@@ -239,7 +239,12 @@ void EDA_MSG_PANEL::erase( wxDC* aDC ) ...@@ -239,7 +239,12 @@ void EDA_MSG_PANEL::erase( wxDC* aDC )
pen.SetColour( color ); pen.SetColour( color );
brush.SetColour( color ); brush.SetColour( color );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
aDC->SetPen( pen ); aDC->SetPen( pen );
aDC->SetBrush( brush ); aDC->SetBrush( brush );
......
...@@ -160,14 +160,23 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor ) ...@@ -160,14 +160,23 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
butt_ID = ID_COLOR_BLACK + ii; butt_ID = ID_COLOR_BLACK + ii;
wxMemoryDC iconDC; wxMemoryDC iconDC;
wxBitmap ButtBitmap( w, h ); wxBitmap ButtBitmap( w, h );
wxBrush Brush; wxBrush brush;
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
EDA_COLOR_T buttcolor = g_ColorRefs[ii].m_Numcolor; EDA_COLOR_T buttcolor = g_ColorRefs[ii].m_Numcolor;
iconDC.SetPen( *wxBLACK_PEN ); iconDC.SetPen( *wxBLACK_PEN );
ColorSetBrush( &Brush, buttcolor ); ColorSetBrush( &brush, buttcolor );
Brush.SetStyle( wxSOLID );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush );
iconDC.SetBrush( Brush );
iconDC.SetBackground( *wxGREY_BRUSH ); iconDC.SetBackground( *wxGREY_BRUSH );
iconDC.Clear(); iconDC.Clear();
iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 ); iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 );
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <xnode.h> #include <xnode.h>
#include <macros.h> #include <macros.h>
typedef wxXmlProperty XATTR; typedef wxXmlAttribute XATTR;
void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR ) void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
......
...@@ -16,53 +16,73 @@ ...@@ -16,53 +16,73 @@
#define ID_COLOR_SETUP 1800 #define ID_COLOR_SETUP 1800
// Specify the width and height of every (color-displaying / bitmap) button
const int BUTT_SIZE_X = 16;
const int BUTT_SIZE_Y = 16;
static ColorButton GeneralColorButtons[] = {
{ _( "Wire" ), LAYER_WIRE }, /********************/
{ _( "Bus" ), LAYER_BUS }, /* Layer menu list. */
{ _( "Junction" ), LAYER_JUNCTION }, /********************/
{ _( "Label" ), LAYER_LOCLABEL },
{ _( "Global label" ), LAYER_GLOBLABEL }, struct COLORBUTTON
{ _( "Net name" ), LAYER_NETNAM }, {
{ _( "Notes" ), LAYER_NOTES }, wxString m_Name;
int m_Layer;
};
struct BUTTONINDEX
{
wxString m_Name;
COLORBUTTON* m_Buttons;
};
static COLORBUTTON generalColorButtons[] = {
{ _( "Wire" ), LAYER_WIRE },
{ _( "Bus" ), LAYER_BUS },
{ _( "Junction" ), LAYER_JUNCTION },
{ _( "Label" ), LAYER_LOCLABEL },
{ _( "Global label" ), LAYER_GLOBLABEL },
{ _( "Net name" ), LAYER_NETNAM },
{ _( "Notes" ), LAYER_NOTES },
{ _( "No Connect Symbol" ), LAYER_NOCONNECT }, { _( "No Connect Symbol" ), LAYER_NOCONNECT },
{ wxT( "" ), -1 } // Sentinel marking end of list. { wxT( "" ), -1 } // Sentinel marking end of list.
}; };
static ColorButton ComponentColorButtons[] = { static COLORBUTTON componentColorButtons[] = {
{ _( "Body" ), LAYER_DEVICE }, { _( "Body" ), LAYER_DEVICE },
{ _( "Body background" ), LAYER_DEVICE_BACKGROUND }, { _( "Body background" ), LAYER_DEVICE_BACKGROUND },
{ _( "Pin" ), LAYER_PIN }, { _( "Pin" ), LAYER_PIN },
{ _( "Pin number" ), LAYER_PINNUM }, { _( "Pin number" ), LAYER_PINNUM },
{ _( "Pin name" ), LAYER_PINNAM }, { _( "Pin name" ), LAYER_PINNAM },
{ _( "Reference" ), LAYER_REFERENCEPART }, { _( "Reference" ), LAYER_REFERENCEPART },
{ _( "Value" ), LAYER_VALUEPART }, { _( "Value" ), LAYER_VALUEPART },
{ _( "Fields" ), LAYER_FIELDS }, { _( "Fields" ), LAYER_FIELDS },
{ wxT( "" ), -1 } // Sentinel marking end of list. { wxT( "" ), -1 } // Sentinel marking end of list.
}; };
static ColorButton SheetColorButtons[] = { static COLORBUTTON sheetColorButtons[] = {
{ _( "Sheet" ), LAYER_SHEET }, { _( "Sheet" ), LAYER_SHEET },
{ _( "Sheet file name" ), LAYER_SHEETFILENAME }, { _( "Sheet file name" ), LAYER_SHEETFILENAME },
{ _( "Sheet name" ), LAYER_SHEETNAME }, { _( "Sheet name" ), LAYER_SHEETNAME },
{ _( "Sheet label" ), LAYER_SHEETLABEL }, { _( "Sheet label" ), LAYER_SHEETLABEL },
{ _( "Hierarchical label" ), LAYER_HIERLABEL }, { _( "Hierarchical label" ),LAYER_HIERLABEL },
{ wxT( "" ), -1 } // Sentinel marking end of list. { wxT( "" ), -1 } // Sentinel marking end of list.
}; };
static ColorButton MiscColorButtons[] = { static COLORBUTTON miscColorButtons[] = {
{ _( "Erc warning" ), LAYER_ERC_WARN }, { _( "Erc warning" ), LAYER_ERC_WARN },
{ _( "Erc error" ), LAYER_ERC_ERR }, { _( "Erc error" ), LAYER_ERC_ERR },
{ _( "Grid" ), LAYER_GRID }, { _( "Grid" ), LAYER_GRID },
{ wxT( "" ), -1 } // Sentinel marking end of list. { wxT( "" ), -1 } // Sentinel marking end of list.
}; };
static ButtonIndex buttonGroups[] = { static BUTTONINDEX buttonGroups[] = {
{ _( "General" ), GeneralColorButtons }, { _( "General" ), generalColorButtons },
{ _( "Component" ), ComponentColorButtons }, { _( "Component" ), componentColorButtons },
{ _( "Sheet" ), SheetColorButtons }, { _( "Sheet" ), sheetColorButtons },
{ _( "Miscellaneous" ), MiscColorButtons }, { _( "Miscellaneous" ), miscColorButtons },
{ wxT( "" ), NULL } { wxT( "" ), NULL }
}; };
...@@ -81,7 +101,7 @@ DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG() ...@@ -81,7 +101,7 @@ DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG()
DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent )
{ {
m_Parent = aParent; m_parent = aParent;
Init(); Init();
Create( aParent ); Create( aParent );
} }
...@@ -115,38 +135,39 @@ bool DIALOG_COLOR_CONFIG::Create( wxWindow* aParent, ...@@ -115,38 +135,39 @@ bool DIALOG_COLOR_CONFIG::Create( wxWindow* aParent,
void DIALOG_COLOR_CONFIG::Init() void DIALOG_COLOR_CONFIG::Init()
{ {
OuterBoxSizer = NULL; m_outerBoxSizer = NULL;
MainBoxSizer = NULL; m_mainBoxSizer = NULL;
ColumnBoxSizer = NULL; m_columnBoxSizer = NULL;
RowBoxSizer = NULL; m_rowBoxSizer = NULL;
BitmapButton = NULL; m_bitmapButton = NULL;
m_SelBgColor = NULL; m_SelBgColor = NULL;
Line = NULL; m_line = NULL;
StdDialogButtonSizer = NULL; m_stdDialogButtonSizer = NULL;
Button = NULL;
} }
void DIALOG_COLOR_CONFIG::CreateControls() void DIALOG_COLOR_CONFIG::CreateControls()
{ {
wxStaticText* label; wxButton* button;
int buttonId = 1800; wxStaticText* label;
ButtonIndex* groups = buttonGroups; int buttonId = 1800;
OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); BUTTONINDEX* groups = buttonGroups;
SetSizer( OuterBoxSizer );
MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); m_outerBoxSizer = new wxBoxSizer( wxVERTICAL );
OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT, 5 ); SetSizer( m_outerBoxSizer );
m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
m_outerBoxSizer->Add( m_mainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT, 5 );
while( groups->m_Buttons != NULL ) while( groups->m_Buttons != NULL )
{ {
ColorButton* buttons = groups->m_Buttons; COLORBUTTON* buttons = groups->m_Buttons;
ColumnBoxSizer = new wxBoxSizer( wxVERTICAL ); m_columnBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( ColumnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 ); m_mainBoxSizer->Add( m_columnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 );
RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); m_rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); m_columnBoxSizer->Add( m_rowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
// Add a text string to identify the column of color select buttons. // Add a text string to identify the column of color select buttons.
label = new wxStaticText( this, wxID_ANY, groups->m_Name ); label = new wxStaticText( this, wxID_ANY, groups->m_Name );
...@@ -156,34 +177,43 @@ void DIALOG_COLOR_CONFIG::CreateControls() ...@@ -156,34 +177,43 @@ void DIALOG_COLOR_CONFIG::CreateControls()
font.SetWeight( wxFONTWEIGHT_BOLD ); font.SetWeight( wxFONTWEIGHT_BOLD );
label->SetFont( font ); label->SetFont( font );
RowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
while( buttons->m_Layer >= 0 ) while( buttons->m_Layer >= 0 )
{ {
RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); m_rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxALL, 0 ); m_columnBoxSizer->Add( m_rowBoxSizer, 0, wxGROW | wxALL, 0 );
wxMemoryDC iconDC; wxMemoryDC iconDC;
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
EDA_COLOR_T color = GetLayerColor( LayerNumber( buttons->m_Layer ) ); EDA_COLOR_T color = GetLayerColor( LayerNumber( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color; currentColors[ buttons->m_Layer ] = color;
iconDC.SetPen( *wxBLACK_PEN ); iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush; wxBrush brush;
ColorSetBrush( &brush, color ); ColorSetBrush( &brush, color );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush ); iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
BitmapButton = new wxBitmapButton( this, buttonId, bitmap, wxDefaultPosition, m_bitmapButton = new wxBitmapButton( this, buttonId, bitmap, wxDefaultPosition,
wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) ); wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) );
BitmapButton->SetClientData( (void*) buttons ); m_bitmapButton->SetClientData( (void*) buttons );
RowBoxSizer->Add( BitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
m_rowBoxSizer->Add( m_bitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) ); label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) );
RowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); m_rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
buttonId += 1; buttonId += 1;
buttons++; buttons++;
} }
...@@ -195,7 +225,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() ...@@ -195,7 +225,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) ); wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) );
// Add a spacer to improve appearance. // Add a spacer to improve appearance.
ColumnBoxSizer->AddSpacer( 5 ); m_columnBoxSizer->AddSpacer( 5 );
wxArrayString m_SelBgColorStrings; wxArrayString m_SelBgColorStrings;
m_SelBgColorStrings.Add( _( "White" ) ); m_SelBgColorStrings.Add( _( "White" ) );
...@@ -204,30 +234,31 @@ void DIALOG_COLOR_CONFIG::CreateControls() ...@@ -204,30 +234,31 @@ void DIALOG_COLOR_CONFIG::CreateControls()
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
m_SelBgColorStrings, 1, wxRA_SPECIFY_COLS ); m_SelBgColorStrings, 1, wxRA_SPECIFY_COLS );
m_SelBgColor->SetSelection( ( g_DrawBgColor == BLACK ) ? 1 : 0 ); m_SelBgColor->SetSelection( ( g_DrawBgColor == BLACK ) ? 1 : 0 );
ColumnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); m_columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 );
// Provide a line to separate all of the controls added so far from the // Provide a line to separate all of the controls added so far from the
// "OK", "Cancel", and "Apply" buttons (which will be added after that // "OK", "Cancel", and "Apply" buttons (which will be added after that
// line). // line).
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
OuterBoxSizer->Add( Line, 0, wxGROW | wxALL, 5 ); m_outerBoxSizer->Add( m_line, 0, wxGROW | wxALL, 5 );
// Provide a StdDialogButtonSizer to accommodate the OK, Cancel, and Apply // Provide a StdDialogButtonSizer to accommodate the OK, Cancel, and Apply
// buttons; using that type of sizer results in those buttons being // buttons; using that type of sizer results in those buttons being
// automatically located in positions appropriate for each (OS) version of // automatically located in positions appropriate for each (OS) version of
// KiCad. // KiCad.
StdDialogButtonSizer = new wxStdDialogButtonSizer; m_stdDialogButtonSizer = new wxStdDialogButtonSizer;
OuterBoxSizer->Add( StdDialogButtonSizer, 0, wxGROW | wxALL, 10 ); m_outerBoxSizer->Add( m_stdDialogButtonSizer, 0, wxGROW | wxALL, 10 );
button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 );
m_stdDialogButtonSizer->AddButton( button );
Button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 ); button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
StdDialogButtonSizer->AddButton( Button ); m_stdDialogButtonSizer->AddButton( button );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); button->SetFocus();
StdDialogButtonSizer->AddButton( Button );
Button->SetFocus();
Button = new wxButton( this, wxID_APPLY, _( "Apply" ), wxDefaultPosition, wxDefaultSize, 0 ); button = new wxButton( this, wxID_APPLY, _( "Apply" ), wxDefaultPosition, wxDefaultSize, 0 );
StdDialogButtonSizer->AddButton( Button ); m_stdDialogButtonSizer->AddButton( button );
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnOkClick ) ); wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnOkClick ) );
...@@ -236,7 +267,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() ...@@ -236,7 +267,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
Connect( wxID_APPLY, wxEVT_COMMAND_BUTTON_CLICKED, Connect( wxID_APPLY, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnApplyClick ) ); wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnApplyClick ) );
StdDialogButtonSizer->Realize(); m_stdDialogButtonSizer->Realize();
// Dialog now needs to be resized, but the associated command is found elsewhere. // Dialog now needs to be resized, but the associated command is found elsewhere.
} }
...@@ -248,7 +279,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) ...@@ -248,7 +279,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) ); wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) );
ColorButton* colorButton = (ColorButton*) button->GetClientData(); COLORBUTTON* colorButton = (COLORBUTTON*) button->GetClientData();
wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) ); wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) );
...@@ -263,10 +294,17 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) ...@@ -263,10 +294,17 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
wxBitmap bitmap = button->GetBitmapLabel(); wxBitmap bitmap = button->GetBitmapLabel();
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
wxBrush brush;
iconDC.SetPen( *wxBLACK_PEN ); iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
ColorSetBrush( &brush, color); ColorSetBrush( &brush, color);
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush ); iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
...@@ -295,7 +333,7 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() ...@@ -295,7 +333,7 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
warning = true; warning = true;
} }
m_Parent->SetGridColor( GetLayerColor( LAYER_GRID ) ); m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) );
if( g_DrawBgColor == GetLayerColor( LAYER_GRID ) ) if( g_DrawBgColor == GetLayerColor( LAYER_GRID ) )
warning = true; warning = true;
...@@ -313,7 +351,7 @@ void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event ) ...@@ -313,7 +351,7 @@ void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event )
if( warning ) if( warning )
wxMessageBox( _("Warning:\nSome items have the same color as the background\nand they will not be seen on screen") ); wxMessageBox( _("Warning:\nSome items have the same color as the background\nand they will not be seen on screen") );
m_Parent->GetCanvas()->Refresh(); m_parent->GetCanvas()->Refresh();
EndModal( 1 ); EndModal( 1 );
} }
...@@ -328,5 +366,5 @@ void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& event ) ...@@ -328,5 +366,5 @@ void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& event )
void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event ) void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event )
{ {
UpdateColorsSettings(); UpdateColorsSettings();
m_Parent->GetCanvas()->Refresh(); m_parent->GetCanvas()->Refresh();
} }
#ifndef _DIALOG_COLOR_CONFIG_H_ #ifndef DIALOG_COLOR_CONFIG_H_
#define _DIALOG_COLOR_CONFIG_H_ #define DIALOG_COLOR_CONFIG_H_
#include <wx/statline.h> #include <wx/statline.h>
...@@ -13,47 +13,24 @@ class wxStdDialogButtonSizer; ...@@ -13,47 +13,24 @@ class wxStdDialogButtonSizer;
extern void SeedLayers(); extern void SeedLayers();
// Specify the width and height of every (color-displaying / bitmap) button
const int BUTT_SIZE_X = 16;
const int BUTT_SIZE_Y = 16;
/********************/
/* Layer menu list. */
/********************/
struct ColorButton
{
wxString m_Name;
int m_Layer;
};
struct ButtonIndex
{
wxString m_Name;
ColorButton* m_Buttons;
};
/***********************************************/ /***********************************************/
/* Derived class for the frame color settings. */ /* Derived class for the frame color settings. */
/***********************************************/ /***********************************************/
class DIALOG_COLOR_CONFIG: public wxDialog class DIALOG_COLOR_CONFIG : public wxDialog
{ {
private: private:
DECLARE_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG ) DECLARE_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG )
EDA_DRAW_FRAME* m_Parent; EDA_DRAW_FRAME* m_parent;
wxBoxSizer* OuterBoxSizer; wxBoxSizer* m_outerBoxSizer;
wxBoxSizer* MainBoxSizer; wxBoxSizer* m_mainBoxSizer;
wxBoxSizer* ColumnBoxSizer; wxBoxSizer* m_columnBoxSizer;
wxBoxSizer* RowBoxSizer; wxBoxSizer* m_rowBoxSizer;
wxBitmapButton* BitmapButton; wxBitmapButton* m_bitmapButton;
wxRadioBox* m_SelBgColor; wxRadioBox* m_SelBgColor;
wxStaticLine* Line; wxStaticLine* m_line;
wxStdDialogButtonSizer* StdDialogButtonSizer; wxStdDialogButtonSizer* m_stdDialogButtonSizer;
wxButton* Button;
// Creation // Creation
bool Create( wxWindow* aParent, bool Create( wxWindow* aParent,
...@@ -70,7 +47,7 @@ private: ...@@ -70,7 +47,7 @@ private:
void CreateControls(); void CreateControls();
wxBitmap GetBitmapResource( const wxString& aName ); wxBitmap GetBitmapResource( const wxString& aName );
wxIcon GetIconResource( const wxString& aName ); wxIcon GetIconResource( const wxString& aName );
static bool ShowToolTips(); static bool ShowToolTips();
bool UpdateColorsSettings(); bool UpdateColorsSettings();
...@@ -86,4 +63,4 @@ public: ...@@ -86,4 +63,4 @@ public:
~DIALOG_COLOR_CONFIG(); ~DIALOG_COLOR_CONFIG();
}; };
#endif // _DIALOG_COLOR_CONFIG_H_ #endif // DIALOG_COLOR_CONFIG_H_
...@@ -137,7 +137,12 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -137,7 +137,12 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
// artifacts can happen with negative items or negative images // artifacts can happen with negative items or negative images
wxColour bgColor = MakeColour( g_DrawBgColor ); wxColour bgColor = MakeColour( g_DrawBgColor );
#if wxCHECK_VERSION( 3, 0, 0 )
wxBrush bgBrush( bgColor, wxBRUSHSTYLE_SOLID );
#else
wxBrush bgBrush( bgColor, wxSOLID ); wxBrush bgBrush( bgColor, wxSOLID );
#endif
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent(); GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#if wxCHECK_VERSION( 2, 9, 0 ) #if !wxCHECK_VERSION( 2, 9, 0 )
#define wxXmlProperty wxXmlAttribute #define wxXmlAttribute wxXmlProperty
#endif #endif
/** /**
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
} }
XNODE( XNODE* aParent, wxXmlNodeType aType, const wxString& aName, XNODE( XNODE* aParent, wxXmlNodeType aType, const wxString& aName,
const wxString& aContent = wxEmptyString, wxXmlProperty* aProperties = NULL ) : const wxString& aContent = wxEmptyString, wxXmlAttribute* aProperties = NULL ) :
wxXmlNode( aParent, aType, aName, aContent, aProperties ) wxXmlNode( aParent, aType, aName, aContent, aProperties )
{ {
} }
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
{ {
return DeleteProperty( attrName ); return DeleteProperty( attrName );
} }
wxXmlProperty* GetAttributes() const wxXmlAttribute* GetAttributes() const
{ {
return GetProperties(); return GetProperties();
} }
......
...@@ -694,7 +694,13 @@ wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( EDA_COLOR_T aColor ) ...@@ -694,7 +694,13 @@ wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( EDA_COLOR_T aColor )
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
brush.SetColour( MakeColour( aColor ) ); brush.SetColour( MakeColour( aColor ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush ); iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
......
...@@ -260,7 +260,13 @@ wxBitmap DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerBitmap( EDA_COLOR_T aColor ) ...@@ -260,7 +260,13 @@ wxBitmap DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerBitmap( EDA_COLOR_T aColor )
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
brush.SetColour( MakeColour( aColor ) ); brush.SetColour( MakeColour( aColor ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush ); iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
......
...@@ -80,8 +80,16 @@ EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, ...@@ -80,8 +80,16 @@ EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
// listbox events // listbox events
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList ) EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
#if wxCHECK_VERSION( 3, 0, 0 )
EVT_GRID_CMD_CELL_CHANGED( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
#else
EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
#endif
EVT_GRID_CMD_EDITOR_HIDDEN( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, EVT_GRID_CMD_EDITOR_HIDDEN( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
......
...@@ -192,7 +192,13 @@ wxBitmap LAYER_WIDGET::makeBitmap( EDA_COLOR_T aColor ) ...@@ -192,7 +192,13 @@ wxBitmap LAYER_WIDGET::makeBitmap( EDA_COLOR_T aColor )
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
brush.SetColour( MakeColour( aColor ) ); brush.SetColour( MakeColour( aColor ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID ); brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush ); iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X - 2 * BUTT_VOID, BUTT_SIZE_Y - 2 * BUTT_VOID ); iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X - 2 * BUTT_VOID, BUTT_SIZE_Y - 2 * BUTT_VOID );
......
...@@ -495,7 +495,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() ...@@ -495,7 +495,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
void PCB_EDIT_FRAME::SaveMacros() void PCB_EDIT_FRAME::SaveMacros()
{ {
wxXmlDocument xml; wxXmlDocument xml;
wxXmlProperty *macrosProp, *hkProp, *xProp, *yProp; wxXmlAttribute *macrosProp, *hkProp, *xProp, *yProp;
wxString str, hkStr, xStr, yStr; wxString str, hkStr, xStr, yStr;
wxFileName fn = GetBoard()->GetFileName(); wxFileName fn = GetBoard()->GetFileName();
...@@ -513,7 +513,7 @@ void PCB_EDIT_FRAME::SaveMacros() ...@@ -513,7 +513,7 @@ void PCB_EDIT_FRAME::SaveMacros()
for( int number = 9; number >= 0; number-- ) for( int number = 9; number >= 0; number-- )
{ {
str.Printf( wxT( "%d" ), number ); str.Printf( wxT( "%d" ), number );
macrosProp = new wxXmlProperty( wxT( "number" ), str ); macrosProp = new wxXmlAttribute( wxT( "number" ), str );
XNODE * macrosNode = new XNODE( rootNode, wxXML_ELEMENT_NODE, XNODE * macrosNode = new XNODE( rootNode, wxXML_ELEMENT_NODE,
wxT( "macros" ), wxEmptyString, wxT( "macros" ), wxEmptyString,
...@@ -527,9 +527,9 @@ void PCB_EDIT_FRAME::SaveMacros() ...@@ -527,9 +527,9 @@ void PCB_EDIT_FRAME::SaveMacros()
xStr.Printf( wxT( "%d" ), i->m_Position.x ); xStr.Printf( wxT( "%d" ), i->m_Position.x );
yStr.Printf( wxT( "%d" ), i->m_Position.y ); yStr.Printf( wxT( "%d" ), i->m_Position.y );
yProp = new wxXmlProperty( wxT( "y" ), yStr ); yProp = new wxXmlAttribute( wxT( "y" ), yStr );
xProp = new wxXmlProperty( wxT( "x" ), xStr, yProp ); xProp = new wxXmlAttribute( wxT( "x" ), xStr, yProp );
hkProp = new wxXmlProperty( wxT( "hkcode" ), hkStr, xProp ); hkProp = new wxXmlAttribute( wxT( "hkcode" ), hkStr, xProp );
new XNODE( macrosNode, wxXML_ELEMENT_NODE, wxT( "hotkey" ), new XNODE( macrosNode, wxXML_ELEMENT_NODE, wxT( "hotkey" ),
wxEmptyString, hkProp ); wxEmptyString, hkProp );
......
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