Commit 89e7f965 authored by charras's avatar charras

made kicad compilable with wxWidgets 2.9 (wxWidgets 3)

parent f3e4682f
...@@ -126,7 +126,7 @@ bool IsOK( wxWindow* parent, const wxString& text ) ...@@ -126,7 +126,7 @@ bool IsOK( wxWindow* parent, const wxString& text )
/***********************************************************************/ /***********************************************************************/
int Get_Message( const wxString& title, // The question int Get_Message( const wxString& title, // The question
const wxString& frame_caption, // The frame caption const wxString& frame_caption, // The frame caption
wxString& buffer, // String input buffer wxString& buffer, // String input/return buffer
wxWindow* frame ) wxWindow* frame )
/***********************************************************************/ /***********************************************************************/
...@@ -140,13 +140,10 @@ int Get_Message( const wxString& title, // The question ...@@ -140,13 +140,10 @@ int Get_Message( const wxString& title, // The question
* != 0 if ESCAPE * != 0 if ESCAPE
*/ */
{ {
wxString message, default_text; wxString message;
if( buffer )
default_text = buffer;
message = wxGetTextFromUser( title, frame_caption, message = wxGetTextFromUser( title, frame_caption,
default_text, frame ); buffer, frame );
if( !message.IsEmpty() ) if( !message.IsEmpty() )
{ {
message.Trim( FALSE ); // Remove blanks at beginning message.Trim( FALSE ); // Remove blanks at beginning
......
...@@ -94,36 +94,28 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -94,36 +94,28 @@ bool DrawPage( WinEDA_DrawPanel* panel )
wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/; wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/;
if( !dc.Ok() ) EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc );
GRForceBlackPen( s_PlotBlackAndWhite );
screen->m_IsPrinting = true;
dc.SetUserScale( scale, scale );
ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10;
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
if( DrawBlock )
{ {
DisplayError( NULL, wxT( "CopyToClipboard: DrawPage error: wxMetafileDC not OK" ) ); dc.SetClippingRegion( DrawArea );
success = FALSE;
} }
else panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close();
if( mf )
{ {
EDA_Rect tmp = panel->m_ClipBox; success = mf->SetClipboard( ClipboardSizeX, ClipboardSizeY );
GRResetPenAndBrush( &dc ); delete mf;
GRForceBlackPen( s_PlotBlackAndWhite );
screen->m_IsPrinting = true;
dc.SetUserScale( scale, scale );
ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10;
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
if( DrawBlock )
{
dc.SetClippingRegion( DrawArea );
}
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close();
if( mf )
{
success = mf->SetClipboard( ClipboardSizeX, ClipboardSizeY );
delete mf;
}
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h". // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
...@@ -19,6 +20,12 @@ ...@@ -19,6 +20,12 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#if wxCHECK_VERSION( 2, 9, 0 )
// Do nothing, because wxWidgets 3 supports the SVG format
// previously, was a contribution library, not included in wxWidgets base
#else
#include "dcsvg.h" #include "dcsvg.h"
#include "wx/image.h" #include "wx/image.h"
...@@ -979,3 +986,5 @@ void wxSVGFileDC::write( const wxString& s ) ...@@ -979,3 +986,5 @@ void wxSVGFileDC::write( const wxString& s )
#pragma warn .rch #pragma warn .rch
#pragma warn .ccc #pragma warn .ccc
#endif #endif
#endif // wxCHECK_VERSION
...@@ -41,7 +41,7 @@ static void DrawGraphicTextPline( ...@@ -41,7 +41,7 @@ static void DrawGraphicTextPline(
EDA_Colors aColor, EDA_Colors aColor,
int aWidth, int aWidth,
bool sketch_mode, bool sketch_mode,
int point_count, int point_count,
wxPoint *coord, wxPoint *coord,
void (* aCallback) (int x0, int y0, int xf, int yf)) void (* aCallback) (int x0, int y0, int xf, int yf))
{ {
...@@ -298,20 +298,23 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -298,20 +298,23 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
coord[1].x = overbar_x; coord[1].x = overbar_x;
coord[1].y = overbar_y; coord[1].y = overbar_y;
/* Plot the overbar segment */ /* Plot the overbar segment */
DrawGraphicTextPline(aPanel, aDC, aColor, aWidth, DrawGraphicTextPline(aPanel, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback); sketch_mode, 2, coord, aCallback);
} }
continue; /* Skip ~ processing */ continue; /* Skip ~ processing */
} }
} }
AsciiCode = aText.GetChar(ptr+overbars);
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC) #if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
AsciiCode = aText.GetChar(ptr+overbars) & 0x7FF; AsciiCode &= 0x7FF;
if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr
AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF; AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF;
else else
AsciiCode = AsciiCode & 0xFF; AsciiCode = AsciiCode & 0xFF;
#else #else
AsciiCode = aText.GetChar(ptr+overbars) & 0xFF; AsciiCode &= 0xFF;
#endif #endif
ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
* du caractere a dessiner */ * du caractere a dessiner */
...@@ -334,7 +337,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -334,7 +337,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
{ {
if( aWidth <= 1 ) if( aWidth <= 1 )
aWidth = 0; aWidth = 0;
DrawGraphicTextPline(aPanel, aDC, aColor, aWidth, DrawGraphicTextPline(aPanel, aDC, aColor, aWidth,
sketch_mode, point_count, coord, aCallback); sketch_mode, point_count, coord, aCallback);
} }
plume = f_cod; point_count = 0; plume = f_cod; point_count = 0;
...@@ -386,7 +389,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -386,7 +389,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
coord[1].x = overbar_x; coord[1].x = overbar_x;
coord[1].y = overbar_y; coord[1].y = overbar_y;
/* Plot the overbar segment */ /* Plot the overbar segment */
DrawGraphicTextPline(aPanel, aDC, aColor, aWidth, DrawGraphicTextPline(aPanel, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback); sketch_mode, 2, coord, aCallback);
} }
} }
......
...@@ -698,6 +698,10 @@ void WinEDA_App::SaveSettings() ...@@ -698,6 +698,10 @@ void WinEDA_App::SaveSettings()
/* Sdt font settings */ /* Sdt font settings */
m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize ); m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize );
m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() ); m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() );
#if wxCHECK_VERSION( 2, 9, 0 )
#warning under wxWidgets 3.0, see how to replace the next lines
#else
m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() ); m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() );
m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() ); m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() );
...@@ -717,6 +721,7 @@ void WinEDA_App::SaveSettings() ...@@ -717,6 +721,7 @@ void WinEDA_App::SaveSettings()
m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize ); m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize );
m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits ); m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() ); m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
#endif // wxCHECK_VERSION
/* Save the file history list */ /* Save the file history list */
m_fileHistory.Save( *m_EDA_Config ); m_fileHistory.Save( *m_EDA_Config );
...@@ -857,9 +862,11 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu ) ...@@ -857,9 +862,11 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
menu = new wxMenu; menu = new wxMenu;
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{ {
wxString label = s_Language_List[ii].m_DoNotTranslate ? wxString label;
s_Language_List[ii].m_Lang_Label : if ( s_Language_List[ii].m_DoNotTranslate )
wxGetTranslation( s_Language_List[ii].m_Lang_Label ); label = s_Language_List[ii].m_Lang_Label;
else
label = wxGetTranslation( s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( menu, item = new wxMenuItem( menu,
s_Language_List[ii].m_KI_Lang_Identifier, s_Language_List[ii].m_KI_Lang_Identifier,
......
...@@ -1494,26 +1494,6 @@ void GRSetTextFgColor( wxDC* DC, wxFont*, int Color ) ...@@ -1494,26 +1494,6 @@ void GRSetTextFgColor( wxDC* DC, wxFont*, int Color )
} }
/*****************************************************************************/
void GRGetTextExtent( wxDC* DC, const wxChar* Text, long* width, long* height )
/*****************************************************************************/
/* Return the size of the text
*/
{
long w = 0, h = 0;
if( Text )
{
DC->GetTextExtent( Text, &w, &h );
}
if( width )
*width = w;
if( height )
*height = h;
}
/********************************/ /********************************/
void GRResetTextFgColor( wxDC* DC ) void GRResetTextFgColor( wxDC* DC )
/********************************/ /********************************/
......
...@@ -21,7 +21,7 @@ WinEDA_EnterText::WinEDA_EnterText( wxWindow* parent, ...@@ -21,7 +21,7 @@ WinEDA_EnterText::WinEDA_EnterText( wxWindow* parent,
const wxSize& Size ) const wxSize& Size )
{ {
m_Modify = FALSE; m_Modify = FALSE;
if( TextToEdit ) if( ! TextToEdit.IsEmpty() )
m_NewText = TextToEdit; m_NewText = TextToEdit;
m_Title = new wxStaticText( parent, -1, Title ); m_Title = new wxStaticText( parent, -1, Title );
......
...@@ -505,7 +505,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -505,7 +505,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{ {
// It is an horizontal line // It is an horizontal line
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
if( orient == PIN_RIGHT ) if( orient == PIN_RIGHT )
{ {
...@@ -545,7 +545,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -545,7 +545,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
else /* Its a vertical line. */ else /* Its a vertical line. */
{ {
// Text is drawn from bottom to top (i.e. to negative value for Y axis) // Text is drawn from bottom to top (i.e. to negative value for Y axis)
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
if( orient == PIN_DOWN ) if( orient == PIN_DOWN )
{ {
...@@ -588,7 +588,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -588,7 +588,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{ {
/* Its an horizontal line. */ /* Its an horizontal line. */
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, DrawGraphicText( panel, DC, wxPoint( x,
...@@ -612,7 +612,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -612,7 +612,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
{ {
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
y = (y1 + pin_pos.y) / 2; y = (y1 + pin_pos.y) / 2;
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE,
...@@ -701,7 +701,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -701,7 +701,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
{ {
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */ if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
{ {
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
if( orient == PIN_RIGHT ) if( orient == PIN_RIGHT )
{ {
...@@ -740,7 +740,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -740,7 +740,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
{ {
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
if( orient == PIN_DOWN ) if( orient == PIN_DOWN )
{ {
...@@ -784,7 +784,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -784,7 +784,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{ {
/* Its an horizontal line. */ /* Its an horizontal line. */
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x, PlotGraphicText( g_PlotFormat, wxPoint( x,
...@@ -807,7 +807,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -807,7 +807,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
{ {
if( m_PinName && DrawPinName ) if( DrawPinName )
{ {
y = (y1 + pin_pos.y) / 2; y = (y1 + pin_pos.y) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE,
...@@ -937,7 +937,8 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer ) ...@@ -937,7 +937,8 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
len = 4; len = 4;
for( ii = 0; ii < len; ii++ ) for( ii = 0; ii < len; ii++ )
{ {
ascii_buf[ii] = buffer.GetChar( ii ) & 0xFF; ascii_buf[ii] = buffer.GetChar( ii );
ascii_buf[ii] &= 0xFF;
} }
strncpy( (char*) &m_PinNum, ascii_buf, 4 ); strncpy( (char*) &m_PinNum, ascii_buf, 4 );
......
...@@ -157,12 +157,14 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -157,12 +157,14 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* For more than one part per package, we must add the part selection /* For more than one part per package, we must add the part selection
* A, B, ... or 1, 2, .. to the reference. */ * A, B, ... or 1, 2, .. to the reference. */
wxString fulltext = m_Text; wxString fulltext = m_Text;
char part_id;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fulltext.Append( '.'); fulltext.Append( '.');
fulltext.Append( '1' - 1 + DrawLibItem->m_Multi ); part_id = '1' - 1 + DrawLibItem->m_Multi;
#else #else
fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi ); part_id = 'A' - 1 + DrawLibItem->m_Multi;
#endif #endif
fulltext.Append( part_id );
DrawGraphicText( panel, DC, pos, color, fulltext, DrawGraphicText( panel, DC, pos, color, fulltext,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
......
...@@ -235,30 +235,22 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre ...@@ -235,30 +235,22 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
if( !dc.Ok() ) EDA_Rect tmp = panel->m_ClipBox;
{ GRResetPenAndBrush( &dc );
DisplayError( this, wxT( "SVGprint error: wxSVGFileDC not OK" ) ); g_PlotLine_Width = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
success = FALSE; SetPenMinWidth( g_PlotLine_Width );
} GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
else
{
EDA_Rect tmp = panel->m_ClipBox; panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
GRResetPenAndBrush( &dc ); panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
g_PlotLine_Width = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
SetPenMinWidth( g_PlotLine_Width ); screen->m_IsPrinting = true;
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true ); SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
SetLocaleTo_Default( ); // revert to the current locale
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 ); screen->m_IsPrinting = false;
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); panel->m_ClipBox = tmp;
screen->m_IsPrinting = true;
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
SetLocaleTo_Default( ); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
}
GRForceBlackPen( FALSE ); GRForceBlackPen( FALSE );
......
...@@ -250,7 +250,7 @@ void WinEDA_PartPropertiesFrame::BuildPanelDoc() ...@@ -250,7 +250,7 @@ void WinEDA_PartPropertiesFrame::BuildPanelDoc()
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC]; msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC];
else else
{ {
if( CurrentLibEntry && CurrentLibEntry->m_Doc ) if( CurrentLibEntry )
msg_text = CurrentLibEntry->m_Doc; msg_text = CurrentLibEntry->m_Doc;
} }
m_Doc->SetValue( msg_text ); m_Doc->SetValue( msg_text );
......
...@@ -140,8 +140,7 @@ wxString Line; ...@@ -140,8 +140,7 @@ wxString Line;
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, LibEDA_BaseStruct * DrawItem)
LibEDA_BaseStruct * DrawItem)
{ {
int DrawMode = g_XorMode; int DrawMode = g_XorMode;
...@@ -150,7 +149,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, ...@@ -150,7 +149,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
return; return;
/* Effacement ancien texte */ /* Effacement ancien texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC) if( DC)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, DrawMode); DrawItem, DrawMode);
...@@ -162,7 +161,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, ...@@ -162,7 +161,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Affichage nouveau texte */ /* Affichage nouveau texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC) if( DC )
{ {
if ( (DrawItem->m_Flags & IS_MOVED) == 0 ) if ( (DrawItem->m_Flags & IS_MOVED) == 0 )
DrawMode = GR_DEFAULT_DRAWMODE; DrawMode = GR_DEFAULT_DRAWMODE;
......
...@@ -46,7 +46,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) ...@@ -46,7 +46,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath, wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath,
wxEmptyString, CompLibFileWildcard, wxEmptyString, CompLibFileWildcard,
wxFD_OPEN | wxFILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
......
...@@ -502,8 +502,7 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize ) ...@@ -502,8 +502,7 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
continue; continue;
if( newsize >= 0 ) if( newsize >= 0 )
Pin->m_PinNumSize = newsize; Pin->m_PinNumSize = newsize;
if( newnum ) Pin->m_PinNum = CurrentPin->m_PinNum;
Pin->m_PinNum = CurrentPin->m_PinNum;
} }
} }
......
...@@ -483,12 +483,14 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, ...@@ -483,12 +483,14 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
/* Adding A, B ... to the reference */ /* Adding A, B ... to the reference */
wxString Text; wxString Text;
Text = field->m_Text; Text = field->m_Text;
char unit_id;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
Text.Append( '.' ); Text.Append( '.' );
Text.Append( '1' - 1 + DrawLibItem->m_Multi ); unit_id = '1' - 1 + DrawLibItem->m_Multi;
#else #else
Text.Append( 'A' - 1 + DrawLibItem->m_Multi ); unit_id = 'A' - 1 + DrawLibItem->m_Multi;
#endif #endif
Text.Append( unit_id );
PlotGraphicText( g_PlotFormat, textpos, color, Text, PlotGraphicText( g_PlotFormat, textpos, color, Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size, hjustify, vjustify, field->m_Size, hjustify, vjustify,
......
...@@ -312,12 +312,9 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -312,12 +312,9 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
if( *g_CurrentViewComponentName ) LibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
{ g_CurrentViewLibraryName, FIND_ALIAS );
LibEntry = FindLibPart( g_CurrentViewComponentName.GetData(), ViewCmpEntry = (LibCmpEntry*) LibEntry;
g_CurrentViewLibraryName, FIND_ALIAS );
ViewCmpEntry = (LibCmpEntry*) LibEntry;
}
/* Forcage de la reinit de la brosse et plume courante */ /* Forcage de la reinit de la brosse et plume courante */
GRResetPenAndBrush( DC ); GRResetPenAndBrush( DC );
......
#if wxCHECK_VERSION( 2, 9, 0 )
// Do nothing, because wxWidgets 3 supports the SVG format
// previously, was a contribution library, not included in wxWidgets base
#include "wx/dcsvg.h"
#else
#ifndef __DCSVG_H #ifndef __DCSVG_H
#define __DCSVG_H #define __DCSVG_H
#include "wx/wfstream.h" #include "wx/wfstream.h"
...@@ -413,3 +419,5 @@ public: ...@@ -413,3 +419,5 @@ public:
#pragma warn .ccc #pragma warn .ccc
#endif #endif
#endif #endif
#endif // wxCHECK_VERSION
...@@ -196,7 +196,6 @@ int GRGetTextFgColor(wxDC * DC, wxFont * Font); ...@@ -196,7 +196,6 @@ int GRGetTextFgColor(wxDC * DC, wxFont * Font);
void GRSetTextBgColor(wxDC * DC, int Color); void GRSetTextBgColor(wxDC * DC, int Color);
void GRSetTextBgColor(wxDC * DC, wxFont * Font, int Color); void GRSetTextBgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextBgColor(wxDC * DC, wxFont * Font); int GRGetTextBgColor(wxDC * DC, wxFont * Font);
void GRGetTextExtent(wxDC * DC, const wxChar * Text, long * width, long * height);
#endif /* define GR_BASIC */ #endif /* define GR_BASIC */
...@@ -135,9 +135,12 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event ) ...@@ -135,9 +135,12 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event )
NULL NULL
}; };
wxString cmd = wxT( "-O " ) + zip.GetPathSeparator() + zip.GetFullName(); wxString cmd = wxT( "-O " );
cmd += zip.GetPathSeparator() + zip.GetFullName();
wxDir dir( wxT( "." ) + zip.GetPathSeparator() ); wxString currdirname = wxT( "." );
currdirname += zip.GetPathSeparator();
wxDir dir( currdirname );
if( !dir.IsOpened() ) if( !dir.IsOpened() )
return; return;
...@@ -152,7 +155,8 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event ) ...@@ -152,7 +155,8 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event )
{ {
wxFileName fn( f ); wxFileName fn( f );
cmd += wxT( " ." ) + zip.GetPathSeparator() + fn.GetFullName(); cmd += wxT( " ." );
cmd += zip.GetPathSeparator() + fn.GetFullName();
PrintMsg( _( "Compress file " ) + fn.GetFullName() + wxT( "\n" ) ); PrintMsg( _( "Compress file " ) + fn.GetFullName() + wxT( "\n" ) );
cont = dir.GetNext( &f ); cont = dir.GetNext( &f );
} }
......
...@@ -375,8 +375,7 @@ bool WinEDA_App::OnInit() ...@@ -375,8 +375,7 @@ bool WinEDA_App::OnInit()
GetSettings(); // read current setup GetSettings(); // read current setup
/* Make nameless project translatable */ /* Make nameless project translatable */
wxFileName namelessProject( wxGetCwd(), _( "noname" ), wxFileName namelessProject( wxGetCwd(), _( "noname" ), ProjectFileExtension );
+ ProjectFileExtension );
frame = new WinEDA_MainFrame( NULL, wxT( "KiCad" ), frame = new WinEDA_MainFrame( NULL, wxT( "KiCad" ),
wxPoint( 30, 20 ), wxSize( 600, 400 ) ); wxPoint( 30, 20 ), wxSize( 600, 400 ) );
......
...@@ -333,7 +333,7 @@ void WinEDA_MainFrame::OnOpenFileInTextEditor( wxCommandEvent& event ) ...@@ -333,7 +333,7 @@ void WinEDA_MainFrame::OnOpenFileInTextEditor( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
if( dlg.GetPath() && wxGetApp().GetEditorName() ) if( ! dlg.GetPath().IsEmpty() && ! wxGetApp().GetEditorName().IsEmpty() )
ExecuteFile( this, wxGetApp().GetEditorName(), dlg.GetPath() ); ExecuteFile( this, wxGetApp().GetEditorName(), dlg.GetPath() );
} }
......
...@@ -249,31 +249,22 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre ...@@ -249,31 +249,22 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
if( !dc.Ok() ) EDA_Rect tmp = panel->m_ClipBox;
{ GRResetPenAndBrush( &dc );
DisplayError( this, wxT( "SVGprint error: wxSVGFileDC not OK" ) ); s_PrintPenMinWidth = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
success = FALSE; SetPenMinWidth( s_PrintPenMinWidth );
} GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
else
{
EDA_Rect tmp = panel->m_ClipBox; panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
GRResetPenAndBrush( &dc ); panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
s_PrintPenMinWidth = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
SetPenMinWidth( s_PrintPenMinWidth );
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
screen->m_IsPrinting = true;
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
panel->PrintPage( &dc, aPrint_Framet_Ref, m_PrintMaskLayer, false );
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
}
screen->m_IsPrinting = true;
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
panel->PrintPage( &dc, aPrint_Framet_Ref, m_PrintMaskLayer, false );
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
GRForceBlackPen( FALSE ); GRForceBlackPen( FALSE );
SetPenMinWidth( 1 ); SetPenMinWidth( 1 );
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_orient_footprints.h // Name: dialog_orient_footprints.h
// Purpose: // Purpose:
// Author: // Author:
// Modified by: // Modified by:
// Created: 11/07/2008 13:32:12 // Created: 11/07/2008 13:32:12
// RCS-ID: // RCS-ID:
// Copyright: // Copyright:
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 11/07/2008 13:32:12 // Generated by DialogBlocks (unregistered), 11/07/2008 13:32:12
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define ID_TEXTCTRLROT_VALUE 10003 #define ID_TEXTCTRLROT_VALUE 10003
#define ID_TEXTCTRL_FOOTPRINTS_FILTER 10001 #define ID_TEXTCTRL_FOOTPRINTS_FILTER 10001
#define ID_CHECKBOX_APPLY_TO_LOCKED 10002 #define ID_CHECKBOX_APPLY_TO_LOCKED 10002
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxDIALOG_MODAL|wxTAB_TRAVERSAL #define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_STYLE wxDEFAULT_DIALOG_STYLE
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_TITLE _("Footprints Orientation") #define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_TITLE _("Footprints Orientation")
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_IDNAME ID_DIALOG_ORIENT_FOOTPRINTS #define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_IDNAME ID_DIALOG_ORIENT_FOOTPRINTS
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_SIZE wxSize(400, 300) #define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_SIZE wxSize(400, 300)
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
*/ */
class dialog_orient_footprints: public wxDialog class dialog_orient_footprints: public wxDialog
{ {
DECLARE_DYNAMIC_CLASS( dialog_orient_footprints ) DECLARE_DYNAMIC_CLASS( dialog_orient_footprints )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
......
...@@ -24,25 +24,25 @@ ...@@ -24,25 +24,25 @@
<string name="target_wx_version">"2.6.4"</string> <string name="target_wx_version">"2.6.4"</string>
<string name="cpp_header_comment">"///////////////////////////////////////////////////////////////////////////// <string name="cpp_header_comment">"/////////////////////////////////////////////////////////////////////////////
// Name: %HEADER-FILENAME% // Name: %HEADER-FILENAME%
// Purpose: // Purpose:
// Author: %AUTHOR% // Author: %AUTHOR%
// Modified by: // Modified by:
// Created: %DATE% // Created: %DATE%
// RCS-ID: // RCS-ID:
// Copyright: %COPYRIGHT% // Copyright: %COPYRIGHT%
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
"</string> "</string>
<string name="cpp_implementation_comment">"///////////////////////////////////////////////////////////////////////////// <string name="cpp_implementation_comment">"/////////////////////////////////////////////////////////////////////////////
// Name: %SOURCE-FILENAME% // Name: %SOURCE-FILENAME%
// Purpose: // Purpose:
// Author: %AUTHOR% // Author: %AUTHOR%
// Modified by: // Modified by:
// Created: %DATE% // Created: %DATE%
// RCS-ID: // RCS-ID:
// Copyright: %COPYRIGHT% // Copyright: %COPYRIGHT%
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
"</string> "</string>
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
// Name: %SYMBOLS-FILENAME% // Name: %SYMBOLS-FILENAME%
// Purpose: Symbols file // Purpose: Symbols file
// Author: %AUTHOR% // Author: %AUTHOR%
// Modified by: // Modified by:
// Created: %DATE% // Created: %DATE%
// RCS-ID: // RCS-ID:
// Copyright: %COPYRIGHT% // Copyright: %COPYRIGHT%
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
"</string> "</string>
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
<string name="proxy-Data class manager window">""</string> <string name="proxy-Data class manager window">""</string>
<string name="proxy-Texture">""</string> <string name="proxy-Texture">""</string>
<string name="proxy-Texture style">"Tiled"</string> <string name="proxy-Texture style">"Tiled"</string>
<bool name="proxy-wxDEFAULT_DIALOG_STYLE">0</bool> <bool name="proxy-wxDEFAULT_DIALOG_STYLE">1</bool>
<bool name="proxy-wxCAPTION">1</bool> <bool name="proxy-wxCAPTION">1</bool>
<bool name="proxy-wxRESIZE_BORDER">1</bool> <bool name="proxy-wxRESIZE_BORDER">1</bool>
<bool name="proxy-wxSYSTEM_MENU">1</bool> <bool name="proxy-wxSYSTEM_MENU">1</bool>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
<bool name="proxy-wxCLOSE_BOX">1</bool> <bool name="proxy-wxCLOSE_BOX">1</bool>
<bool name="proxy-wxMAXIMIZE_BOX">0</bool> <bool name="proxy-wxMAXIMIZE_BOX">0</bool>
<bool name="proxy-wxMINIMIZE_BOX">0</bool> <bool name="proxy-wxMINIMIZE_BOX">0</bool>
<bool name="proxy-wxDIALOG_MODAL">1</bool> <bool name="proxy-wxDIALOG_MODAL">0</bool>
<bool name="proxy-wxNO_BORDER">0</bool> <bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool> <bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool> <bool name="proxy-wxDOUBLE_BORDER">0</bool>
......
...@@ -136,7 +136,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) ...@@ -136,7 +136,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
fnFront = GetScreen()->m_FileName; fnFront = GetScreen()->m_FileName;
frontLayerName = GetBoard()->GetLayerName( CMP_N ); frontLayerName = GetBoard()->GetLayerName( CMP_N );
fnFront.SetName( fnFront.GetName() + frontLayerName.GetData() ); fnFront.SetName( fnFront.GetName() + frontLayerName );
fnFront.SetExt( wxT( "pos") ); fnFront.SetExt( wxT( "pos") );
fpFront = wxFopen( fnFront.GetFullPath(), wxT( "wt" ) ); fpFront = wxFopen( fnFront.GetFullPath(), wxT( "wt" ) );
...@@ -151,7 +151,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) ...@@ -151,7 +151,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
{ {
fnBack = GetScreen()->m_FileName; fnBack = GetScreen()->m_FileName;
backLayerName = GetBoard()->GetLayerName( COPPER_LAYER_N ); backLayerName = GetBoard()->GetLayerName( COPPER_LAYER_N );
fnBack.SetName( fnBack.GetName() + backLayerName.GetData() ); fnBack.SetName( fnBack.GetName() + backLayerName );
fnBack.SetExt( wxT( "pos" ) ); fnBack.SetExt( wxT( "pos" ) );
fpBack = wxFopen( fnBack.GetFullPath(), wxT( "wt" ) ); fpBack = wxFopen( fnBack.GetFullPath(), wxT( "wt" ) );
......
...@@ -440,7 +440,7 @@ static void Extract_Parameters( wxArrayString& param_list, char* text ) ...@@ -440,7 +440,7 @@ static void Extract_Parameters( wxArrayString& param_list, char* text )
* last parameter is ) or ] * last parameter is ) or ]
*/ */
{ {
int key; char key;
wxString tmp; wxString tmp;
while( *text != 0 ) while( *text != 0 )
......
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